Esempio n. 1
0
    public int Hurt(int dmg, Script_HitBox hitBox)
    {
        int dmgActuallyTaken = stats.Hurt(dmg, hitBox);

        Script_HurtBoxEventsManager.Hurt(tag, hitBox);

        print($"{this.name} took {dmgActuallyTaken} damage from hitbox ${hitBox.Id}.");

        return(dmgActuallyTaken);
        // consider doing something with state, closing hurtbox?
    }
Esempio n. 2
0
    public override void Hit(Collider col)
    {
        print(col.tag);
        if (col.tag == Const_Tags.Player)
        {
            print($"{name} Player hit: {col}");
            Debug.Log($"Time Left (s): {Script_ClockManager.Control.TimeLeft}");

            if (Const_Dev.IsDevMode && Debug.isDebugBuild)
            {
                return;
            }

            // Ignore this behavior if the hit caused Time to run out.
            if (
                Script_ClockManager.Control.ClockState == Script_Clock.States.Done ||
                Script_ClockManager.Control.TimeLeft == 0
                )
            {
                return;
            }

            Script_Game.Game.ChangeStateCutScene();

            StartCoroutine(Script_Game.Game.TransitionFadeIn(
                               Script_TransitionManager.RestartPlayerFadeInTime, () =>
            {
                Script_Player p = col.transform.parent.GetComponent <Script_Player>();

                Vector3 prevPlayerPos = p.transform.position;

                p.Teleport(restartDestination.position);
                p.FaceDirection(facingDirection);

                Script_Game.Game.SnapActiveCam(prevPlayerPos);
                FadeOut();
            }
                               ));
        }

        void FadeOut()
        {
            StartCoroutine(Script_Game.Game.TransitionFadeOut(
                               Script_TransitionManager.RestartPlayerFadeOutTime, () =>
            {
                Script_Game.Game.ChangeStateInteract();

                Script_HurtBoxEventsManager.PlayerRestart(col);
            }
                               ));
        }
    }