Esempio n. 1
0
    public override Attack_Result TakeDamage(int dmg, Vector3 attack_pos, Damagetype dmgtype)
    {
        SetTarget(entityTarget);

        if (cooldown || Invinsible || sm.Current.Name == "Dead")
        {
            return(Attack_Result.inmune);
        }

        Debug.Log("damagetype" + dmgtype.ToString());

        Vector3 aux = (this.transform.position - attack_pos).normalized;

        if (dmgtype == Damagetype.explosion)
        {
            rb.AddForce(aux * explosionForce, ForceMode.Impulse);
        }
        else
        {
            rb.AddForce(aux * forceRecall, ForceMode.Impulse);
        }

        sm.SendInput(JabaliInputs.TAKE_DMG);

        greenblood.Play();
        cooldown = true;

        bool death = lifesystem.Hit(dmg);

        return(death ? Attack_Result.death : Attack_Result.sucessful);
    }
Esempio n. 2
0
    public override Attack_Result TakeDamage(int dmg, Vector3 dir, Damagetype dmgtype)
    {
        greenblood.Play();
        bool death = lifesystem.Hit(dmg);

        return(death ? Attack_Result.death : Attack_Result.sucessful);
    }
Esempio n. 3
0
    public override Attack_Result TakeDamage(int dmg, Vector3 attack_pos, Damagetype dmgtype)
    {
        SetTarget(entityTarget);

        if (cooldown || Invinsible || sm.Current.Name == "Die")
        {
            return(Attack_Result.inmune);
        }

        // Debug.Log("damagetype" + dmgtype.ToString()); ;

        Vector3 aux = this.transform.position - attack_pos;

        aux.Normalize();
        rb = GetComponent <Rigidbody>();
        if (dmgtype == Damagetype.explosion)
        {
            Debug.Log(rb);
            rb.AddForce(aux * explosionForce, ForceMode.Impulse);
        }
        else
        {
            rb.AddForce(aux * forceRecall, ForceMode.Impulse);
        }

        sm.SendInput(DummyEnemyInputs.TAKE_DAMAGE);

        greenblood.Play();

        cooldown = true;

        bool death = lifesystem.Hit(dmg);

        return(death ? Attack_Result.death : Attack_Result.sucessful);
    }