Created
December 1, 2016 15:50
-
-
Save ted80/b8abb422f9c234e474204356bb23a365 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class FireAnimation : MonoBehaviour | |
{ | |
private Vector3 originalPosition; | |
public Light light; | |
public float baseLight = 0.5f; | |
public float randLight = 1f; | |
public float size = 0.15f; | |
public float speed = 20f; | |
void Start () | |
{ | |
originalPosition = gameObject.transform.position; | |
} | |
void Update () | |
{ | |
light.intensity = baseLight + Random.value * randLight; | |
gameObject.transform.position = originalPosition + new Vector3(Mathf.Cos(Time.timeSinceLevelLoad * speed), Mathf.Sin(Time.timeSinceLevelLoad * (speed * 1.1f) + 1f), Mathf.Cos(Time.timeSinceLevelLoad * (speed * 1.2f) + 2f)) * size; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment