Permalink
Cannot retrieve contributors at this time
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?
Silverkeep/Guardian of Silverkeep/Assets/Scripts/MasterControl.cs
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
61 lines (50 sloc)
1.23 KB
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 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 | |
} | |
} |