Пример #1
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Пример #2
0
    // 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");
    }
Пример #3
0
    //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");
        }
    }
Пример #4
0
 void Start()
 {
     mainDoor = GetComponentInParent <MainDoor>();
     animator = GetComponent <Animator>();
 }