Пример #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
        public virtual void Add(State state)
        {
            switch (state)
            {
            case State.Burning:
                Burning = Emitter();
                Burning.Pour(FlameParticle.Factory, 0.06f);
                if (Visible)
                {
                    Sample.Instance.Play(Assets.SND_BURNING);
                }
                break;

            case State.Levitating:
                Levitation = Emitter();
                Levitation.Pour(Speck.Factory(Speck.JET), 0.02f);
                break;

            case State.Invisible:
                PotionOfInvisibility.Melt(Ch);
                break;

            case State.Paralysed:
                paused = true;
                break;

            case State.Frozen:
                IceBlock = IceBlock.Freeze(this);
                paused   = true;
                break;

            case State.Illuminated:
                GameScene.Effect(Halo = new TorchHalo(this));
                break;
            }
        }