void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
// activate game complete public void gameComplete() { // turn off the fourth video Video4.SetActive(false); // Switch out the material on the screen to the success video GetComponent <Renderer>().material = VideoSuccessMaterial; // set the success video active VideoSuccess.SetActive(true); // open the door Animator mainDoorAnimation = MainDoor.GetComponent <Animator>(); mainDoorAnimation.PlayInFixedTime("LiftDoorOpen"); }
//This all collision is for button and others related. OK public void OnCollisionEnter2D(Collision2D collision) { if (collision.collider.tag == "Button") { Button.gameObject.SetActive(false); ButtonPressed.gameObject.SetActive(true); Jail.gameObject.SetActive(false); } if (collision.collider.tag == "MainDoorButton") { MainDoorButton.SetActive(false); MainDoor.SetActive(false); } if (collision.collider.tag == "Finish") { SoundManager.PlaySound("LevelWin"); } }
void Start() { mainDoor = GetComponentInParent <MainDoor>(); animator = GetComponent <Animator>(); }