예제 #1
0
    public void Damage(int damage, float criticalMultiplier, GameObject origin, Faction originFaction, DamageType normalType, DamageType criticalType)
    {
        Character c = Character.FromHitbox(this);

        if (c == null || originFaction == null || originFaction.Affiliation(c.faction) == FactionState.Hostile)
        {
            if (healthScript != null)
            {
                // Calculates appropriate damage to deal
                DamageType dt = normalType;
                float      d  = damage * damageMultiplier;
                if (critical == true)
                {
                    d *= criticalMultiplier;
                    dt = criticalType;
                }
                healthScript.TakeDamage(Mathf.RoundToInt(d), origin, dt);
            }

            PlayerHandler ph = origin.GetComponent <PlayerHandler>(); // Checks for WeaponHandler script i.e. if the thing that shot the projectile was a player
            if (ph != null)
            {
                ph.hud.PlayHitMarker(critical);
            }
        }
    }
예제 #2
0
    bool IsAlly(GameObject g)
    {
        Character ch = Character.FromHit(g);

        if (ch != null && originFaction.Affiliation(ch.faction) == FactionState.Allied)
        {
            return(true);
        }
        return(false);
    }
예제 #3
0
    // public bool ricochetsBullets; This currently does not do anything

    public void Damage(int damage, GameObject origin, Faction originFaction, DamageType damageSource, bool isSevere)
    {
        Character c = Character.FromHitbox(this);

        if (c == null || originFaction == null || originFaction.Affiliation(c.faction) == FactionState.Hostile)
        {
            if (healthScript != null)
            {
                healthScript.TakeDamage(Mathf.RoundToInt(damage * damageMultiplier), origin, damageSource);
            }

            PlayerHandler ph = origin.GetComponent <PlayerHandler>(); // Checks for WeaponHandler script i.e. if the thing that shot the projectile was a player
            if (ph != null)
            {
                ph.hud.PlayHitMarker(isSevere);
            }
        }
    }