示例#1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Character")
        {
            if (other.name == vader.name)
            {
                vaderEnterd = true;
            }
            else if (other.name == broer.name)
            {
                broerEnterd = true;
            }
            else if (other.name == zus.name)
            {
                zusEnterd = true;
            }

            if (Player.hasKey || debugKey)
            {
                // Check if all has enterd
                if (vaderAlive && vaderEnterd == false)
                {
                    return;
                }
                if (broerAlive && broerEnterd == false)
                {
                    return;
                }
                if (zusAlive && zusEnterd == false)
                {
                    return;
                }

                // Clear
                animator.Play("DoorOpen");
                managerUI.BlackScreen(true);
                Player.hasKey = false;
                if (nextLevel != null)
                {
                    nextLevel.EnterNextLevel();
                }
            }
        }
    }