// Use this for initialization void Start() { spawnRate = 100.0f; //Find man in the boat script. manInTheBoatScript = GameObject.Find("ManInTheBoatObject").GetComponent <ManInTheBoatScript> (); currentLevel = Application.loadedLevel - 1; if (GameObject.FindGameObjectsWithTag("fish").Length < 2) { if (currentLevel == 2) { tunaSpawn(); tunaSpawn(); } else { spawn(); spawn(); } } else if (GameObject.FindGameObjectsWithTag("fish").Length < 3) { spawn(); } }
// Use this for initialization void Awake() { //Check if instance already exists if (instance == null) { //if not, set instance to this instance = this; } //If instance already exists and it's not this: else if (instance != this) { //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager. Destroy(gameObject); } //Sets this to not be destroyed when reloading scene // DontDestroyOnLoad(gameObject); GameObject instanc = Instantiate(ringManager, new Vector3(0f, 0f, 0f), Quaternion.identity) as GameObject; instanc.transform.SetParent(transform); level3switch = false; man = GameObject.Find("ManInTheBoatObject").GetComponent <ManInTheBoatScript> (); ring = instanc.GetComponent <RingManagerScript> (); // Debug.Log ("We are in level: " + (Application.loadedLevel - 1)); currentLevel = Application.loadedLevel - 1; if (currentLevel == 1) { man.health = 50.0f; Camera.main.orthographicSize = 6; } if (currentLevel == 2) { man.health = 30.0f; Camera.main.orthographicSize = 7; } if (currentLevel == 3) { man.health = 90.0f; Camera.main.orthographicSize = 8.0f; } if (currentLevel == 4) { man.health = 65.0f; Camera.main.orthographicSize = 8.0f; } if (currentLevel == 5) { man.health = 50.0f; Camera.main.orthographicSize = 8.0f; } if (currentLevel == 6) { man.health = 60.0f; Camera.main.orthographicSize = 8.0f; } if (currentLevel == 7) { man.health = 60.0f; Camera.main.orthographicSize = 8.0f; } if (currentLevel == 8) { man.health = 50.0f; Camera.main.orthographicSize = 8.0f; Time.timeScale = 1.5f; } if (currentLevel == 9) { man.health = 50.0f; Camera.main.orthographicSize = 8.0f; Time.timeScale = 1.5f; } if (currentLevel == 10) { man.health = 50.0f; Camera.main.orthographicSize = 8.0f; Time.timeScale = 1.75f; } }
void Start() { manInTheBoatScript = GameObject.Find("ManInTheBoatObject").GetComponent <ManInTheBoatScript> (); sharkTimer = 0.0f; sharkSpawnTime = 5.0f; }