Skip to content
Permalink
c177fed86b
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
61 lines (50 sloc) 1.23 KB
using UnityEngine;
using System.Collections;
public class MasterControl : MonoBehaviour
{
private FPS_HERO hero;
private GameObject[] eGen;
public int Win_Cond = 40;
public int Lose_Cond = 0;
private bool neverdone = true;
public Material skyboxNight;
public Material skyboxDay;
private Skybox skyBox;
private Light lightChange;
// Use this for initialization
void Start ()
{
skyBox = GetComponent("Skybox") as Skybox;
hero = (FPS_HERO)FindObjectOfType(typeof(FPS_HERO));
eGen = GameObject.FindGameObjectsWithTag("Respawn");
skyBox.material = skyboxNight;
lightChange = GameObject.Find("sun").GetComponent("Light") as Light;
lightChange.enabled = false;
}
//*** put swap skybox somewhere here**
// Update is called once per frame
void Update ()
{
#region WinLose
if(hero.Health <= Lose_Cond)
Application.LoadLevel("GameOver");
if(hero.Score >= Win_Cond)
Application.LoadLevel("VictoryScreen");
#endregion
#region speedup
if(neverdone ==true)
{
if(hero.Score >= (0.7f * Win_Cond))
{
skyBox.material = skyboxDay;
lightChange.enabled = true;
foreach(GameObject e in eGen)
{
e.SendMessage("SpeedUp");
}
neverdone = false;
}
}
#endregion
}
}