Skip to content

Instantly share code, notes, and snippets.

@ted80
Created December 1, 2016 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ted80/b8abb422f9c234e474204356bb23a365 to your computer and use it in GitHub Desktop.
Save ted80/b8abb422f9c234e474204356bb23a365 to your computer and use it in GitHub Desktop.
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