Пример #1
0
    void OnTriggerStay2D(Collider2D other)
    {
        if (explosionDone)
        {
            return;
        }

        Target target = other.gameObject.GetComponent <Target> ();

        if (target == null || target.Allegiance == mSource.Allegiance)
        {
            return;
        }

        int damage = (int)WeaponStats.GetStat(WeaponType.IceWand, WeaponStat.Damage);

        if (target is Tower)
        {
            return;
        }

        if (!(target is Unit))
        {
            return;
        }

        // assuming that the target is a Unit

        IceBlock f = other.gameObject.GetComponent <IceBlock> ();

        // do not retarget frozen units
        if (f != null)
        {
            return;
        }

        Unit unit = (Unit)target;

        for (int i = unit.Squad.SquadMembers.Count - 1; i >= 0; --i)
        {
            Unit u = unit.Squad.SquadMembers[i];

            u.gameObject.AddComponent("IceBlock");
            f = u.gameObject.GetComponent <IceBlock> ();
            f.Freeze(u);

            u.Damage(damage);
            if (u.IsDead)
            {
                f.Unfreeze();
            }

            if (u.IsDead && mSource.Allegiance == Allegiance.Rodelle)
            {
                UnitStats.AddToExperience(mSource.UnitType, 1);
            }
        }
    }
Пример #2
0
    protected void InitializeStats()
    {
        this.Damage         = (int)WeaponStats.GetStat(mWeaponType, WeaponStat.Damage);
        this.Range          = WeaponStats.GetStat(mWeaponType, WeaponStat.Range);
        this.ReloadTime     = WeaponStats.GetStat(mWeaponType, WeaponStat.ReloadTime);
        this.ReloadVariance = WeaponStats.GetStat(mWeaponType, WeaponStat.ReloadVariance);
        this.Accuracy       = WeaponStats.GetStat(mWeaponType, WeaponStat.Accuracy);

        this.UpgradeWeapon(mLevel);
        Reset();
    }