public void Sound() { sound = !sound; gameController = GameObject.Find("GameController").GetComponent <GameControllerTest>(); gameController.scoreOn = !gameController.scoreOn; GameObject.Find("Sound/Background/Checkmark").GetComponent <Image>().enabled = sound; }
public void clickOnFloor() { parent = EventSystem.current.currentSelectedGameObject.transform.parent.name; destFloor = Int32.Parse(EventSystem.current.currentSelectedGameObject.name); gameController = GameObject.Find("GameController").GetComponent <GameControllerTest>(); MoveElevator(); }
public void Restart() { gameScript = GameObject.Find("GameController").GetComponent <GameControllerTest>(); scoreScript = GameObject.Find("Coins/CoinText").GetComponent <Score>(); scoreScript.AddCoins(gameScript.score); GameObject.Find("Menu").transform.GetComponent <Canvas>().enabled = false; SceneManager.LoadScene(SceneManager.GetActiveScene().name); Time.timeScale = 1; }
// Use this for initialization void Start() { gameController = GameObject.Find("GameController").GetComponent <GameControllerTest> (); floorPosY = new List <float>(); GameObject floors = GameObject.Find("Floors"); foreach (Transform child in floors.transform) { floorPosY.Add(child.position.y + FLOOR_NUDGE); } destPos = gameObject.transform.position; destPos.y = floorPosY [currFloor]; gameObject.transform.position = destPos; door = transform.Find("door").gameObject; upActive = transform.Find("up-active").gameObject; downActive = transform.Find("down-active").gameObject; upActive.SetActive(false); downActive.SetActive(false); destFloor = currFloor; lvl1Indicators = gameObject.transform.FindChild("lvl1-Destinations").gameObject; lvl2Indicators = gameObject.transform.FindChild("lvl2-Destinations").gameObject; foreach (Transform child in lvl1Indicators.transform) { child.gameObject.SetActive(true); } foreach (Transform child in lvl2Indicators.transform) { child.gameObject.SetActive(true); } iTween.Init(gameObject); if (gameObject.name == "Elevator1") { openDoor(); } else { closeDoor(); } disableFloorIndicator(); }