Ejemplo n.º 1
0
 //if the player touches the hazard then they will die and have to respawn
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player"))
     {
         RobotControllerScript player = collision.GetComponent <RobotControllerScript>();
         player.Death();
     }
 }
Ejemplo n.º 2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("Player") && !isActivated)

        {
            Debug.Log("Player has entered the checkpoint.");
            RobotControllerScript player = collision.GetComponent <RobotControllerScript>();
            player.SetCurrentCheckpoint(this);
            audioSource.Play();
        }
    }
Ejemplo n.º 3
0
    //if the player walks into the trigger for the door
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.CompareTag("Player"))
        {
            isPlayerInTrigger = true;
            RobotControllerScript player = collision.GetComponent<RobotControllerScript>();

            //determines whether the player has the key for the door or not
            openDoor = player.GiveDoorKey();

            //turns the sprite renderer on so that the player can see if they can enter the door
            spriteRenderer.enabled = true;

            //tells the doors animator about the players key status
            anim.SetBool("hasKey", openDoor);
        }
    }
Ejemplo n.º 4
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("Player"))
        {
            Debug.Log("Player entered hazard.");
            RobotControllerScript player = collision.GetComponent <RobotControllerScript>();
            player.Die();

            //CharacterController player = collision.GetComponent<CharacterController>();
            // SceneManager.LoadScene("GameOver");
        }

        else
        {
            Debug.Log("Something other than the player entered the hazard.");
        }

        Debug.Log("Something entered the hazard");
    }