//private MissionType mType; // Use this for initialization void Start() { audioengine = (AudioEngine)FindObjectOfType(typeof(AudioEngine)); galaxy = (Galaxy)FindObjectOfType(typeof(Galaxy)); godMission = (PersistentMission)FindObjectOfType(typeof(PersistentMission)); DontDestroyOnLoad(gameObject); firstUpdate = true; whatControllerAmIUsing = WhatControllerAmIUsing.MOUSE_KEYBOARD; GameObject newGalaxy = Instantiate(GalaxyPrefab, new Vector3(0, 0 ,0), Quaternion.identity) as GameObject; newGalaxy.name = "Galaxy"; if (!GOD.goToRandomPointInGalaxy) { Invoke("waitForaBit", 0.5f); } }
void Update() { if (firstUpdate) { if (SixenseInput.IsBaseConnected(0)) { whatControllerAmIUsing = WhatControllerAmIUsing.HYDRA; firstUpdate = false; } } switch (Application.loadedLevelName) { case "DockedScene": break; case "GameScene": sexyShip = GameObject.Find("sexyShip"); if (GOD.goToRandomPointInGalaxy ) { int randIndex = UnityEngine.Random.Range(1, GameObject.FindGameObjectsWithTag("Moon").Length - 1); targetPlanet = GameObject.FindGameObjectsWithTag("Moon")[randIndex]; GameObject.Find("BackgroundCamera").transform.position = targetPlanet.transform.position - new Vector3(rangeFromPlanet, 0, 0); GameObject.Find("BackgroundCamera").transform.LookAt(targetPlanet.transform.position); GOD.goToRandomPointInGalaxy = false; } if (GOD.goToSpecificSystem) { GameObject.Find("BackgroundCamera").transform.position = targetPlanet.transform.position - new Vector3(rangeFromPlanet, 0, 0); GameObject.Find("BackgroundCamera").transform.LookAt(targetPlanet.transform.position); GOD.goToSpecificSystem = false; } if (currentMissionLocation == currentLocation) { if (currentMission == "Exterminate") { sexyShip.GetComponent<PlayerMissionController>().GenerateNewExterminateMission(); } else if (currentMission == "Distress Call") { sexyShip.GetComponent<PlayerMissionController>().GenerateNewDistressMission(); } else if (currentMission == "Destroy Structure") { sexyShip.GetComponent<PlayerMissionController>().GenerateNewDestroyStructureMission(); } else if (currentMission == "Gather") { //start new Gather Mission } else if (currentMission == "Fedex") { //start new Fedex Mission } else if(currentMission == "Race") { sexyShip.GetComponent<PlayerMissionController>().GenerateNewRaceMission(); } currentMission = ""; currentLocation = ""; } break; case "MainMenu": break; case "FTLScene": break; case "GameOverScene": Destroy(gameObject); //am I doing this right? break; default: break; } }