summaryrefslogtreecommitdiff
path: root/Assets/ProFlares/DemoScripts/TranslateCurve.cs
blob: 32619aedd5afbfa9abbeb188762bf782ac6c0bf5 (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
/// ProFlares - v1.08 - Copyright 2014-2015 All rights reserved - ProFlares.com


using UnityEngine;
using System.Collections;

namespace ProFlares {
	public class TranslateCurve : MonoBehaviour {
		Transform thisTransform;
		Vector3 pos;
		public float speed = 0.3f;
		public WrapMode wrapMode;
		public Vector3 axis = Vector3.one;
		
		public AnimationCurve Curve = new AnimationCurve(new Keyframe(0, 0.1f), new Keyframe(0.5f, 1.0f), new Keyframe(1.0f, 0.1f));
		void Start () {
			thisTransform = transform;
			pos = thisTransform.localPosition;
			Curve.postWrapMode = wrapMode;
		}
		
		void Update () {
			thisTransform.transform.localPosition = pos+(axis*Curve.Evaluate(Time.time*speed));
		}
	}
}