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

        if (pi)
        {
            pi.OnHit(collision, this);
        }
    }
예제 #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);
         }
     }
 }
예제 #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);
         }
     }
 }
예제 #4
0
파일: Player.cs 프로젝트: Sungki/PuzzleGame
    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();
                }
                /////////////////////////////////////////////////////////
            }
        }
    }