예제 #1
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.GetComponent <Killing>())
                {
                    Die();
                    return;
                }

                pi.OnHit(hit, this);
            }
        }
    }
예제 #2
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();
                }
                /////////////////////////////////////////////////////////
            }
        }
    }