summaryrefslogtreecommitdiff
path: root/SurvivalTest/Assets/Scripts/Test/TestRobot1.cs
blob: 367a661837608f05a0a4a90177d0b975f2e0727b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TestRobot1 : MonoBehaviour
{
	public Transform shadow;

	public float x = 0;
	public float y = -0.628f;
	public float z;  // fake height

	public AnimationCurve curve;
	public AnimationCurve curveX;
	public AnimationCurve curveY;

	private void Update()
	{
		x = curveX.Evaluate(Time.time % 1f);
		y = curveY.Evaluate(Time.time % 1f);
		z = curve.Evaluate(Time.time % 1f);

		Vector3 pos = transform.position;
		pos.x = x;
		pos.y = y + z;

		transform.position = pos;

		pos.y = y;
		shadow.transform.position = pos;
	}

}