void Awake() { LevelsController = GameObject.Find("LevelsController").GetComponent <LevelsControllerCS>(); //--hide the score modal so we can show it later ScoreModal.SetActive(false); Player1 = LoadPlayer("Player1Dummy", 1); Player2 = LoadPlayer("Player2Dummy", 2); Player1Script = Player1.GetComponent <PlayerScriptCS>(); Player2Script = Player2.GetComponent <PlayerScriptCS>(); Player1Movement = Player1.GetComponent <PlayerMovementCS>(); Player2Movement = Player2.GetComponent <PlayerMovementCS>(); //--hide the "play again" button initially, so we can show it later PlayAgainBtn.SetActive(false); //--set the players to know what they are if (LevelsController.p1SelectedCharString.Length > 0) { Player1Script.playerCharacter = LevelsController.p1SelectedCharString; } else { Player1Script.playerCharacter = defaultPlayer; } if (LevelsController.p2SelectedCharString.Length > 0) { Player1Script.playerCharacter = LevelsController.p2SelectedCharString; } else { Player1Script.playerCharacter = defaultPlayer; } //--if the game is single player, disable the normal player movement script //--and activate the object containing single player scripts if (LevelsController.singlePlayer) { Debug.Log("this is single player mode"); Player2.GetComponent <PlayerMovementCS>().enabled = false; Player2.transform.Find("PlayerSeeker").gameObject.SetActive(true); RBtn.SetActive(false); RInstruction.SetActive(false); } else { Debug.Log("disable playerseeker"); Player2.transform.Find("PlayerSeeker").gameObject.SetActive(false); RBtn.SetActive(true); } Debug.Log("start the level"); gameObject.SendMessage("StartLevel", 0); //--get the advert script - load last AdvertController = GetComponent <AdvertControllerCS>(); }
// Use this for initialization void Start() { LevelsController = GameObject.Find("LevelsController").GetComponent <LevelsControllerCS>(); VersionController = GameObject.Find("VersionController").GetComponent <VersionController>(); HideUnlockModal(); CheckIfLevelsUnlocked(); }
void Start() { p1SelectedCharString = ""; p2SelectedCharString = ""; LoadingPanel.SetActive(false); P1WaitMsg.SetActive(false); P2WaitMsg.SetActive(false); //--check whether cogbot has been unlocked isCogUnlocked = Convert.ToBoolean(PlayerPrefs.GetInt("UnlockedCog")); isSolarUnlocked = Convert.ToBoolean(PlayerPrefs.GetInt("UnlockedSolar")); isRazorbackUnlocked = Convert.ToBoolean(PlayerPrefs.GetInt("UnlockedRazorback")); isPooperUnlocked = Convert.ToBoolean(PlayerPrefs.GetInt("UnlockedPooper")); isFlatUnlocked = Convert.ToBoolean(PlayerPrefs.GetInt("UnlockedFlat")); isBoxerUnlocked = Convert.ToBoolean(PlayerPrefs.GetInt("UnlockedBoxer")); isWalleUnlocked = Convert.ToBoolean(PlayerPrefs.GetInt("UnlockedWalle")); Debug.Log("solar unlocked = " + isSolarUnlocked); if (GameObject.Find("LevelsController")) { LevelsController = GameObject.Find("LevelsController").GetComponent <LevelsControllerCS>(); //--loading in menu. Persistant } else { Debug.Log("not found levelscontroller"); } if (GameObject.Find("VersionController")) { VersionController = GameObject.Find("VersionController").GetComponent <VersionController>(); } else { Debug.Log("not found VersionController"); } //--hide all the characters apart from the 1st showOnlyP1Character(p1VisibleChar); showOnlyP2Character(p2VisibleChar); closeUnlockModal(); }
void Awake() { VersionController = GameObject.Find("VersionController").GetComponent <VersionController>(); //--a singleton LevelsController = GameObject.Find("LevelsController").GetComponent <LevelsControllerCS>(); //--a singleton LevelSelectScript = GameObject.Find("GameController").GetComponent <LevelSelectScript>(); }