void DemolishDamage(Transform loot)
    {
        demolishRate = 0;
        PlaneStats uS = loot.GetComponent <PlaneStats>();

        if (uS != null)
        {
            uS.TakeDamage(demolishDamage);
        }
    }
    void DemolishDamage(Transform loot)
    {
        demolishRate = 0;
        PlaneStats uS = loot.GetComponent <PlaneStats>();

        if (uS != null)
        {
            uS.TakeDamage(demolishDamage);
        }
        ScoreInScene.lootGathered += demolishDamage;
    }
Beispiel #3
0
    void DirectDamage(Transform enemy)
    {
        if (enemy.tag == "Enemy")
        {
        }
        PlaneStats ps = enemy.GetComponent <PlaneStats>();

        if (ps != null)
        {
            ps.TakeDamage(damage);
        }
    }
    void PlayerDamage(Transform player)
    {
        if (shotAnimation != null)
        {
            GameObject go = objectPooling.SpawnFromPool(shotAnimation.name, transform.position, transform.rotation);
            go.SetActive(true);
        }
        shootingRate = 0;
        PlaneStats uS = player.GetComponent <PlaneStats>();

        if (uS != null)
        {
            uS.TakeDamage(shootDamage);
        }
    }
Beispiel #5
0
    void ExplosionDamage(Transform enemy)
    {
        if (enemy.tag == "Enemy")
        {
        }
        PlaneStats ps = enemy.GetComponent <PlaneStats>();

        if (ps != null)
        {
            Vector3 psr = ps.transform.position;

            float distanceFromBulletToObj = Vector3.Distance(ps.transform.position, this.transform.position);
            float damageDoneBasedOnRange  = 1 - distanceFromBulletToObj / explosionRadius;

            if (damageDoneBasedOnRange > 0)
            {
                ps.TakeDamage(damage * damageDoneBasedOnRange);
            }
        }
    }