Commit 40d58a49 authored by Nathan Hertz's avatar Nathan Hertz

Added AtmosphereDecay script

parent ca0c3675
using UnityEngine;
using System.Collections;
public class AtmosphereDecay : MonoBehaviour {
// Use this for initialization
public Color color = Color.black;
void ColorSet() {
//set the color (r, g, b) and opacity (a) of the atmosphere
color.r = 0f;
color.g = 0f;
color.b = 0f;
color.a = 0.3f;
}
void Start()
{
gameObject.GetComponent<Renderer>().material.color = new Color(color.r, color.g, color.b, color.a);
}
// Update is called once per frame
void OnCollisionEnter (Collision col) {
gameObject.GetComponent<Renderer>().material.color = new Color(color.r + 0.1f, color.g, color.b, color.a);
if (gameObject.GetComponent<Renderer>().material.color.r == 1f)
{
Destroy(gameObject, 0f);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment