Beispiel #1
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        jumpCount = 0;
        PlayerInteractable pi = collision.gameObject.GetComponent <PlayerInteractable>();

        if (pi)
        {
            pi.OnHit(collision, this);
        }
    }
Beispiel #2
0
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
     if (this.currentState != State.Won)
     {
         //hit.gameObject.GetComponent<PlayerInteractable>()?.OnHit(hit, this);
         PlayerInteractable pi = hit.gameObject.GetComponent <PlayerInteractable>();
         if (pi)
         {
             pi.OnHit(hit, this);
         }
     }
 }
Beispiel #3
0
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
     if (this.currentState != State.Won)
     {
         //hit.gameObject.GetComponent<PlayerInteractable>()?.OnHit(hit, this);
         PlayerInteractable pi = hit.gameObject.GetComponent <PlayerInteractable>();
         if (pi)
         {
             if (pi.GetType() == typeof(Killing))
             {
                 gameManager.CountDeath();
                 gameManager.RespawnPlayer();
             }
             pi.OnHit(hit, this);
         }
     }
 }
Beispiel #4
0
    void OnControllerColliderHit(ControllerColliderHit hit)
    {
        if (this.currentState != State.Won)
        {
            PlayerInteractable pi = hit.gameObject.GetComponent <PlayerInteractable>();
            if (pi)
            {
                pi.OnHit(hit, this);

                /////////////////////////////////////////////////////////
                if (pi.GetComponent <Killing>())
                {
                    Toolbox.GetInstance().GetManager <GameManager>().AddSceneTime();
                    Toolbox.GetInstance().GetManager <GameManager>().AddDiedCount();
                    Toolbox.GetInstance().GetManager <GameManager>().Respawn();
                }
                /////////////////////////////////////////////////////////
            }
        }
    }