Example #1
0
    //============================== INTERFACES ===============================================

    /// <summary>
    /// Permite recibir daño e Informar al agresor del resultado de su ataque.
    /// </summary>
    /// <param name="DamageStats">Las estadísticas que afectan el "Daño" recibído.</param>
    public override HitResult Hit(HitData HitInfo)
    {
        HitResult result = HitResult.Default();

        float Damage = HitInfo.Damage;

        if (_Smashed)
        {
            Damage *= DamageMultiplier;
        }
        else
        {
            print("Esta normalito, le doy la data normalita");
            FRitmo.HitRecieved(HitInfo.AttackID, HitInfo.AttackType);
        }

        Health -= Damage;

        if (IsAlive)
        {
            result.bloodEarned  = BloodPerHit;
            result.HitConnected = true;

            var particle = Instantiate(OnHitParticle, transform.position, Quaternion.identity);
            Destroy(particle, 3f);
            EnemyHealthBar.FadeIn();
        }
        else
        {
            result.TargetEliminated = true;
            result.bloodEarned      = BloodForKill;

            var particle = Instantiate(OnHitParticle, transform.position, Quaternion.identity);
            Destroy(particle, 3f);

            sm.Feed(BossStates.dead);
        }
        return(result);
    }
Example #2
0
 public void FeedFSM(BasicEnemyStates nextState)
 {
     sm.Feed(nextState);
 }
Example #3
0
    //======================== OVERRIDES & INTERFACES =========================================

    public override HitResult Hit(HitData HitInfo)
    {
        HitResult result = HitResult.Default();

        if (HitInfo.Damage > 0 && IsAlive)
        {
            //Si el enemigo no me había detectado.
            if (!_targetDetected)
            {
                _targetDetected = true;
            }

            if (_blocking && !Disarmed) //Si estoy bloqueando...
            {
                print("Estoy bloqueando");

                if (sight.angleToTarget < 80 && !HitInfo.BreakDefence)
                {
                    result.HitBlocked = true;
                    onBlockedHit();

                    if (_canParry)
                    {
                        _sm.Feed(ShieldEnemyStates.parry);
                    }
                    else
                    {
                        _sm.Feed(ShieldEnemyStates.think);
                    }
                }
                else if (sight.angleToTarget > 80 || HitInfo.BreakDefence)
                {
                    _sm.Feed(ShieldEnemyStates.vulnerable);
                }
            }
            else //Si no estoy bloqueando...
            {
                anims.SetTrigger("getDamage");

                onGetHit();

                result.HitConnected = true;

                Health -= HitInfo.Damage;

                var particle = Instantiate(OnHitParticle, transform.position, Quaternion.identity);
                Destroy(particle, 3f);
                EnemyHealthBar.FadeIn();

                //Si mi vida es menor a 0...
                if (!IsAlive)
                {
                    result.TargetEliminated = true;    // Aviso que estoy muerto.
                    result.bloodEarned      = BloodForKill;

                    _sm.Feed(ShieldEnemyStates.dead);  // Paso al estado de muerte.
                }
                else
                {
                    _sm.Feed(ShieldEnemyStates.think); //Por default paso a think.
                }
            }
        }
        return(result);
    }