Example #1
0
        public AimedBolt(Vector2 position, BattleScreen screen, int side, float height, Vector2 target, Soldier targetSoldier)
            : base(position, screen, side, height)
        {
            _speed = 0.5f;
            _lifeTime = 1000f;
            Vector2 _delta = target - position;

            double angle = Math.Atan2(_delta.Y, _delta.X);
            double cos = Math.Cos(angle);
            double sin = Math.Sin(angle);
            _trajectory = new Vector2((float)cos * _speed, (float)sin * _speed);
            this.targetSoldier = targetSoldier;
        }
Example #2
0
 public override void addSoldier(Soldier soldier)
 {
     base.addSoldier(soldier);
     if (soldier is Wolf)
     {
         ((Wolf)soldier).bossFormation = this;
         soldier.setSpeed(0.24f);
     }
     
 }
Example #3
0
 protected override void engage(bool win, Vector2 position, Soldier engager, bool rescueFight)
 {
     base.engage(win, position, engager, rescueFight);
 }
Example #4
0
        public Soldier(BattleScreen screen, int side, float x, float y)
            : base(screen, side)
        {
            _position = new Vector2(x, y);
            _destination = new Vector2(x, y);
            _dest = new Vector2(0,0);
            _meleeDestination = new Vector2(0, 0);
            _drawingPosition = Vector2.Zero;
            _randDestOffset = new Vector2(PikeAndShotGame.getRandPlusMinus(3), 0);
            _lastAction = PatternAction.ACTION_IDLE;
            _delta = Vector2.Zero;
            _travel = Vector2.Zero;
            _state = STATE_READY;
            _stateTimer = 0;
            _stateChanged = false;
            _shotMade = false;
            _stateToHave = -1;
            _meleeTime = 1500f;
            _longMeleeTime = 3000f;
            _oneAttackTime = _meleeTime/3f;
            _deathTime = 2000f;
            _routeTime = 500f;
            _routedTime = 100f;
            _plusMinus = 0f;
            _jostleOffset = Vector2.Zero;
            _guardPositionOffset = Vector2.Zero;
            _reacting = false;
            _longMelee = 0;
            _drawingY = _position.Y + 36f;
            _speed = 0.15f;
            _footSpeed = 15;
            _type = Soldier.TYPE_MELEE;
            _class = Soldier.CLASS_MERC_SOLDIER;
            _attackTime = 600f;
            _reloadTime = 1000f;
            guardTarget = null;
            guardTargetRange = 0f;
            guardTargetDist = 0f;
            _engager = null;
            _chargeTime = 800f;//400f;

            _feet = new Sprite(PikeAndShotGame.SOLDIER_FEET, new Rectangle(4, 2, 16, 12), 26, 16, true);
            _idle = new Sprite(PikeAndShotGame.SOLDIER_IDLE, new Rectangle(10, 2, 16, 28), 46, 42);
            _death = new Sprite(PikeAndShotGame.SOLDIER_DEATH, new Rectangle(40, 2, 16, 28), 72, 40);
            _melee1 = new Sprite(PikeAndShotGame.SOLDIER_MELEE1, new Rectangle(14, 10, 16, 28), 62, 46);
            _defend1 = new Sprite(PikeAndShotGame.SOLDIER_DEFEND1, new Rectangle(16, 10, 16, 28), 54, 46);
            // just giving all soldiers the slinger routes for now
            _route = new Sprite(PikeAndShotGame.SOLDIER_ROUTE, new Rectangle(26, 16, 16, 28), 70, 52);
            _routed = new Sprite(PikeAndShotGame.SOLDIER_ROUTED, new Rectangle(16, 16, 16, 28), 50, 52, true);
            _retreat = new Sprite(PikeAndShotGame.SLINGER_RETREAT, new Rectangle(6, 2, 16, 28), 46, 40, true);
            _charge = new Sprite(PikeAndShotGame.SOLDIER_CHARGE, new Rectangle(20, 20, 16, 28), 60, 56);

            _body = _idle;

            _feet.setAnimationSpeed(_footSpeed / 0.11f);
            _retreat.setAnimationSpeed(_footSpeed / 0.11f);
            inPlayerFormation = false;

            // DEBUG VARS
            DEBUGFOUNDPIKE = false;
            bodyFallSound = PikeAndShotGame.BODY_FALL.CreateInstance();
            bodyFallSound.Volume = 0.3f;
            hitSound = PikeAndShotGame.OWW_ALLY.CreateInstance();
            chargeSound = PikeAndShotGame.CHARGE_ROAR.CreateInstance();
            chargeSound.Volume = 0.25f;
            playedFallSound = false;
        }
Example #5
0
 internal void removeLooseSoldier(Soldier sold)
 {
     if (_looseSoldiers.Contains(sold))
         _looseSoldiers.Remove(sold);
 }
Example #6
0
        internal bool findShot(Soldier soldier, float range)
        {
            foreach (ScreenObject pt in _screenObjects)
            {
                if (pt is Shot && !(pt is Pavise) && pt.getSide() != soldier.getSide())
                {
                    // figure out the center of the pike tip and the center of the man
                    float ptX = pt.getPosition().X + pt.getWidth() * 0.5f;
                    float ptY = pt.getPosition().Y + pt.getHeight() * 0.5f;
                    float soX = soldier.getPosition().X + (soldier.getWidth() * 0.5f);
                    float soY = soldier.getPosition().Y + (soldier.getHeight() * 0.5f);

                    if (soldier.getSide() == SIDE_ENEMY && pt.getSide() == SIDE_PLAYER)
                    {
                        if (
                            (ptX < soX && soX - ptX <= Soldier.WIDTH * range + 5f) &&
                            (Math.Abs(ptY - soY) <= Soldier.HEIGHT * 0.5f)
                           )
                        {
                            soldier.react(ptX + Soldier.WIDTH * range);
                            return true;
                        }
                    }
                    else if (soldier.getSide() == SIDE_PLAYER && pt.getSide() == SIDE_ENEMY)
                    {
                        if (
                            (ptX > soX && ptX - soX <= Soldier.WIDTH * range + 5f) &&
                            (Math.Abs(ptY - soY) <= Soldier.HEIGHT * 0.5f)
                           )
                        {
                            soldier.react(ptX - soldier.getWidth() - Soldier.WIDTH * range);
                            return true;
                        }
                    }
                }
            }
            return false;
        }
Example #7
0
 internal void addLooseSoldierNext(Soldier sold)
 {
     if (!_newThings.Contains(sold))
     {
         _newThings.Add(sold);
         sold.myFormation = null;
     }
 }
Example #8
0
 public void collectCoin(Soldier soldier)
 {
     Loot loot = new Loot(this, soldier.getPosition());
     LootTwinkle twinkle = new LootTwinkle(this, soldier.getPosition(), 500f, COIN_METER_POSITION + new Vector2(_coinMeter.getBoundingRect().Width/2, 0f));
     loot.addListener(twinkle);
     twinkle.addListener(this);
 }
Example #9
0
 public WeaponSwing(BattleScreen screen, Soldier pikeman)
     : base(screen, pikeman)
 {
     _width = 31;
     _height = 35;
     _offset = new Vector2(pikeman.getWidth(), 0);
     initiatePosition();
 }
Example #10
0
 public WeaponAttack(BattleScreen screen, Soldier pikeman)
     : base(screen, pikeman.getSide())
 {
     _pikeman = pikeman;
     _screen.removeScreenObject(this);
 }
Example #11
0
 public ShieldBlock(BattleScreen screen, Soldier pikeman)
     : base(screen, pikeman)
 {
     _width = 14;
     _height = 35;
     _offset = new Vector2(pikeman.getWidth(), 0);
     initiatePosition();
 }
Example #12
0
 public PikeTip(BattleScreen screen, Soldier pikeman)
     : base(screen, pikeman)
 {
     _width = 8;
     _height = 4;
     _offset = new Vector2(76, 18);
     initiatePosition();
 }
Example #13
0
 public LanceTip(BattleScreen screen, Soldier pikeman)
     : base(screen, pikeman)
 {
     _width = 8;
     _height = 2;
     _offset = new Vector2(78, 6);
     initiatePosition();
 }
Example #14
0
 private void replaceWithReadyShooter(Soldier s, int ind)
 {
     int index = -1;
     bool eligableMovee = false;
     for (int i = 0; i < _shotRows.Count; i++)
     {
         if(i != getForwardShotRow())
         {
             if (eligableMovee == false)
             {
                 foreach (Soldier movee in (ArrayList)_shotRows[i])
                 {
                     index++;
                     if (movee.getState() == Soldier.STATE_READY)
                     {
                         eligableMovee = true;
                         break;
                     }
                 }
                 if (eligableMovee == true)
                 {
                     // found a guy to move up
                     Soldier temp = (Soldier)((ArrayList)_shotRows[i])[index];
                     Vector2 vect1 = new Vector2(temp._destination.X, temp._destination.Y);
                     Vector2 vect2 = new Vector2(((Soldier)((ArrayList)_shotRows[0])[ind])._destination.X, ((Soldier)((ArrayList)_shotRows[0])[ind])._destination.Y);
                     ((ArrayList)_shotRows[i])[index] = ((ArrayList)_shotRows[0])[ind];
                     ((ArrayList)_shotRows[0])[ind] = temp;
                     ((Soldier)((ArrayList)_shotRows[i])[index])._destination = vect1;
                     ((Soldier)((ArrayList)_shotRows[0])[ind])._destination = vect2;
                     return;
                 }
                 index = -1;
             }
         }
     }
 }
Example #15
0
        private void addSoldierToRow(Soldier soldier, ArrayList rows)
        {
            int addLeader = soldier.getType() == Soldier.TYPE_SWINGER ? 2 : 0;
            int rowsOfType = (getTotalSoldiers(soldier.getType()) + addLeader) / _width;
            Soldier prevSoldier;
            ArrayList row;
            float lastRowStartHeight = 0f;

            if (soldier is Pikeman && _state == STATE_PIKE)
            {
                if (rows.Count < 2)
                    ((Pikeman)soldier).attackLow();
                else
                    ((Pikeman)soldier).attackHigh();
            }

            if (rows.Count < rowsOfType + 1)
            {
                rows.Add(new ArrayList(_width));
                ((ArrayList)rows[rows.Count - 1]).Add(soldier);
                row = (ArrayList)rows[rows.Count - 1];

                if (rowsOfType > 0)
                {
                    prevSoldier = ((Soldier)((ArrayList)rows[rows.Count - 2])[0]);
                    soldier._destination = new Vector2(prevSoldier._destination.X - (_side * Soldier.WIDTH), prevSoldier._destination.Y);
                }
                else
                    soldier._destination = new Vector2(_position.X - (_side * Soldier.WIDTH), _position.Y);
            }
            else
            {
                if (soldier.getType() == Soldier.TYPE_SWINGER && rows.Count < 2 && ((ArrayList)rows[0]).Count % 2 == 0)
                {
                    row = (ArrayList)rows[0];
                    row.Insert(0, soldier);
                }
                else
                {
                    row = findSmallestRow(rows);
                    row.Add(soldier);
                    prevSoldier = ((Soldier)row[row.Count - 2]);
                }
            }

            //see if rows should be evened out a little
            if (rows.Count > 1 && row.Count < _width / 2)
            {
                ArrayList prevRow = ((ArrayList)rows[rows.Count - 2]);
                Soldier oldSoldier = (Soldier)prevRow[prevRow.Count -1];
                row.Add(oldSoldier);
                prevSoldier = ((Soldier)((ArrayList)rows[rows.Count - 1])[0]);
                oldSoldier._destination = new Vector2(prevSoldier._destination.X, prevSoldier._destination.Y);
                prevRow.RemoveAt(prevRow.Count - 1);
                lastRowStartHeight = (float)_width / 2f - (float)(prevRow.Count) / 2f;

                for (int i = 0; i < prevRow.Count; i++)
                {
                    ((Soldier)prevRow[i])._destination.Y = _position.Y + Soldier.HEIGHT * ((float)i + lastRowStartHeight);
                }
            }
            
            lastRowStartHeight = (float)_width / 2f - (float)(row.Count) / 2f;

            for (int i = 0; i < row.Count; i++)
            {
                ((Soldier)row[i])._destination.Y = _position.Y + Soldier.HEIGHT * ((float)i + lastRowStartHeight);
            }

            _soldiers.Add(soldier);
        }
Example #16
0
        public virtual void addSoldier(Soldier soldier)
        {
            _addedSoldier = true;
            switch(soldier.getType())
            {
                case Soldier.TYPE_PIKE:
                    addSoldierToRow(soldier, _pikeRows);
                    break;
                case Soldier.TYPE_SWINGER:
                    addSoldierToRow(soldier, _supportRows);
                    break;
                case Soldier.TYPE_SHOT:
                    addSoldierToRow(soldier, _shotRows);
                    break;
                case Soldier.TYPE_CAVALRY:
                    addSoldierToRow(soldier, _cavRows);
                    break;
                case Soldier.TYPE_SUPPORT:
                    addSoldierToRow(soldier, _supportRows);
                    break;
                case Soldier.TYPE_MELEE:
                    addSoldierToRow(soldier, _meleeRows);
                    break;
                default:
                    addSoldierToRow(soldier, _supportRows);
                    break;
            }

            soldier.setSide(_side);
            if (_screen.getPlayerFormation() == this)
                soldier.inPlayerFormation = true;
            soldier.initCharge = false;
            soldier.setSpeed(0.15f);

            // determine speed
            avgSpeed = 0;

            foreach (Soldier s in _soldiers)
            {
                avgSpeed += s.getSpeed();
            }
            avgSpeed /= (float)_soldiers.Count;
            _speed = avgSpeed - 0.04f;            
            //_speed = avgSpeed - (0.002f * (float)_soldiers.Count);            
            soldier.myFormation = this;

            if (soldier.getType() == Soldier.TYPE_PIKE)
            {
                reiteratePikeCommand((Pikeman)soldier);
                numberOfPikes++;
            }
            else if (soldier is Dopple && _state == STATE_PIKE)
            {
                ((Dopple)soldier).charge();
            }
            else if (soldier.getType() == Soldier.TYPE_SHOT)
            {
                numberOfShots++;
            }
        }
Example #17
0
 public void removeSoldier(Soldier soldier)
 {
     //_soldiers.Remove(soldier);
     _soldiersToRemove.Add(soldier);
 }
Example #18
0
 internal void addLooseSoldier(Soldier sold)
 {
     if(!_looseSoldiers.Contains(sold))
         _looseSoldiers.Add(sold);
 }
Example #19
0
 public override void addSoldier(Soldier soldier)
 {
     base.addSoldier(soldier);
     if (soldier is Wolf)
     {
         ((Wolf)soldier).bossFormation = this;
     }
 }
Example #20
0
        internal bool findPikeTip(Soldier soldier, float range)
        {
            if(soldier.DEBUGFOUNDPIKE)
                soldier.DEBUGFOUNDPIKE = false;

            foreach (ScreenObject pt in _screenObjects)
            {
                if(pt is PikeTip)
                {
                    if(((PikeTip)pt).getSoldierState() != Pikeman.STATE_RECOILING || soldier.getState() == Targeteer.STATE_DEFEND || soldier.getState() == Colmillos.STATE_ATTACK)
                    {
                        // figure out the center of the pike tip and the center of the man
                        float ptX = pt.getPosition().X + pt.getWidth() * 0.5f;
                        float ptY = pt.getPosition().Y + pt.getHeight() * 0.5f;
                        float soX = soldier.getPosition().X + soldier.getWidth() * 0.5f;
                        float soY = soldier.getPosition().Y + soldier.getHeight() * 0.5f;

                        if (soldier.getSide() == SIDE_ENEMY && pt.getSide() == SIDE_PLAYER)
                        {
                            //ptX += pt.getWidth() * 0.5f;
                            //soX -= soldier.getWidth() * 0.5f;
                            if (
                                (ptX < soX && soX - ptX <= Soldier.WIDTH * range) &&
                                (Math.Abs(ptY - soY) <= Soldier.HEIGHT * 0.5f)
                               )
                            {
                                soldier.setReactionDest(ptX + Soldier.WIDTH * range);
                                return true;
                            }
                        }
                        else if (soldier.getSide() == SIDE_PLAYER && pt.getSide() == SIDE_ENEMY)
                        {
                            //ptX -= pt.getWidth() * 0.5f;
                            //soX += soldier.getWidth() * 0.5f;
                            if (
                                (ptX > soX + soldier.getWidth() && ptX - (soX + soldier.getWidth()) <= Soldier.WIDTH * range) &&
                                (Math.Abs(ptY - soY) <= Soldier.HEIGHT * 0.5f)
                               )
                            {
                                soldier.setReactionDest(ptX - soldier.getWidth() - Soldier.WIDTH * range);
                                return true;
                            }
                        }
                    }
                }
            }
            return false;
        }
Example #21
0
        private void assignDoppel(Soldier enemy)
        {
            Soldier guard = null;

            foreach (Soldier dopp in _soldiers)
            {
                if (dopp is Dopple)
                {
                    if (dopp.guardTarget == enemy)
                        return;
                }
            }
            foreach (Soldier dopp in _soldiers)
            {
                if (dopp is Dopple)
                {
                    if (dopp.guardTarget == null)
                    {
                        if (guard == null && dopp.guardTarget == null)
                            guard = dopp;
                        else
                        {
                            bool ySmaller = Math.Abs(enemy.getPosition().Y - dopp.getPosition().Y) < Math.Abs(enemy.getPosition().Y - guard.getPosition().Y);
                            if (ySmaller && dopp.guardTarget == null)
                                guard = dopp;
                        }
                    }
                }
            }
            if (guard != null)
                guard.guardTarget = enemy;
        }
Example #22
0
        internal bool findSoldier(Soldier soldier, float range, float spread)
        {
            foreach (ScreenObject pt in _screenObjects)
            {
                if (pt is Soldier && pt.getSide() != soldier.getSide())
                {
                    if (((Soldier)pt).getState() != Soldier.STATE_DEAD && ((Soldier)pt).getState() != Soldier.STATE_DYING)
                    {
                        // figure out the center of the pike tip and the center of the man
                        float ptX = pt.getPosition().X + pt.getWidth() * 0.5f;
                        float ptY = pt.getPosition().Y + pt.getHeight() * 0.5f;
                        float soX = soldier.getPosition().X; //+ soldier.getWidth() * 0.5f;
                        float soY = soldier.getPosition().Y + soldier.getHeight() * 0.5f;

                        if (soldier.getSide() == SIDE_ENEMY && pt.getSide() == SIDE_PLAYER)
                        {
                            bool bool1 = ptX < soX;
                            bool bool2 = soX - (ptX + pt.getWidth()) <= Soldier.WIDTH * range;
                            bool bool3 = Math.Abs(ptY - soY) <= Soldier.WIDTH * spread;
                            if (
                                (bool1 && bool2) &&
                                (bool3)
                               )
                            {
                                //soldier.react(ptX + Soldier.WIDTH * range);
                                return true;
                            }
                        }
                        else if (soldier.getSide() == SIDE_PLAYER && pt.getSide() == SIDE_ENEMY)
                        {
                            if (
                                (ptX > soX && ptX - (soX + soldier.getWidth()) <= Soldier.WIDTH * range) &&
                                (Math.Abs(ptY - soY) <= Soldier.WIDTH * spread)
                               )
                            {
                                //soldier.react(ptX - soldier.getWidth() - Soldier.WIDTH * range);
                                return true;
                            }
                        }
                    }
                }
            }
            return false;
        }
Example #23
0
        private Soldier checkGuard(Soldier guard, Soldier shot, ScreenObject enemy)
        {
            if (guard == null)
            {
                if (shot.getState() != Soldier.STATE_MELEE_WIN && shot.getState() != Soldier.STATE_MELEE_LOSS)
                    return shot;
                else
                    return null;
            }
            else
            {
                bool ySmaller = Math.Abs(enemy.getPosition().Y - shot.getDestination().Y) < Math.Abs(enemy.getPosition().Y - guard.getDestination().Y);
                if (ySmaller && shot.guardTarget == null && shot.getState() != Soldier.STATE_MELEE_WIN && shot.getState() != Soldier.STATE_MELEE_LOSS)
                    return shot;
            }

            return guard;
        }
Example #24
0
        public override bool attack()
        {
            Vector2 formationPosition = _position - _destination;
            bestTarget = null;
            covering = false;
            uncovering = false;

            if (hasPavise)
            {
                if (_state != STATE_DYING)
                {
                    _state = STATE_PLACING;
                    _stateTimer = _placeTime + PikeAndShotGame.getRandPlusMinus(50);
                    return true;
                }
            }
            else
            {
                if (_state == STATE_READY || _state == STATE_CHARGING)
                {
                    possibleTargets = ((LevelScreen)_screen).dangerOnScreen();
                    Vector2 bestDistance = new Vector2(600, 600);
                    Vector2 distance;
                    double angle;
                    foreach (Soldier s in possibleTargets)
                    {
                        distance = s.getCenter() - this.getCenter();
                        angle = Math.Atan2(distance.Y, distance.X);
                        if ((bestTarget == null || bestDistance.Length() > distance.Length()) && angle < MathHelper.PiOver4 && angle > -MathHelper.PiOver4)
                        {
                            bestTarget = s;
                            bestDistance = distance;
                        }
                    }
                    if (bestTarget != null)
                    {
                        _state = STATE_ATTACKING;
                        _plusMinus = 0;
                        _stateTimer = _attackTime + _plusMinus;
                    }
                    return true;
                }
            }

            return false;
        }
Example #25
0
        private void assignShooter(Soldier enemy)
        {
            if (this is EnemyFormation)
                return;

            Soldier guard = null;

            foreach (Soldier shot in _soldiers)
            {
                if (shot.getType() == Soldier.TYPE_SHOT )
                {
                    if (shot.guardTarget == enemy)
                        return;
                }
            }
            foreach (Soldier shot in (ArrayList)_shotRows[0])
            {
                if (shot.getType() == Soldier.TYPE_SHOT)
                {
                    if (shot.guardTarget == null && shot.getState() != Soldier.STATE_RELOADING)
                    {
                        guard = checkGuard(guard, shot, enemy);
                    }
                }
            }
            if (guard != null)
                guard.guardTarget = enemy;
        }
Example #26
0
        protected virtual void engage(bool win, Vector2 position, Soldier engager, bool rescueFight)
        {
            _stateChanged = true;
            _engager = engager;

            preAttackState = _state;
            if (this is Targeteer && _state == Targeteer.STATE_DEFEND)
            {
                preAttackState = STATE_READY;
            }

            if (rescueFight)
            {
                _longMelee = MELEE_REPETITIONS;
                if (_side == BattleScreen.SIDE_PLAYER)
                    _state = STATE_MELEE_LOSS;
                else
                    _state = STATE_MELEE_WIN;
            }
            else
            {
                _longMelee = 0;
                if (win)
                {
                    _state = STATE_MELEE_WIN;
                }
                else
                    _state = STATE_MELEE_LOSS;
            }

            _stateTimer = _meleeTime;

            _meleeDestination = (_position + position) / 2;

            if (_side == BattleScreen.SIDE_PLAYER)
                _meleeDestination.X -= 0.60f * Soldier.WIDTH;
            else
                _meleeDestination.X += 0.60f * Soldier.WIDTH;
        }
Example #27
0
        private void assignGuard(Soldier enemy)
        {
            Soldier guard = null;

            foreach (Pikeman pike in (ArrayList)_pikeRows[0])
            {
                if (pike.guardTarget == enemy)
                    return;
            }

            if (_pikeRows.Count > 1)
            {
                foreach (Pikeman pike in (ArrayList)_pikeRows[1])
                {
                    if (pike.guardTarget == enemy)
                        return;
                }
            }

            foreach (Pikeman pike in (ArrayList)_pikeRows[0])
            {
                if (pike.guardTarget == null)
                {
                    if (guard == null && pike.getState() != Soldier.STATE_MELEE_WIN && pike.getState() != Soldier.STATE_MELEE_LOSS)
                        guard = pike;
                    else
                    {
                        guard = checkGuard(guard, pike, enemy);
                    }
                }
            }

            if (_pikeRows.Count > 1)
            {
                foreach (Pikeman pike in (ArrayList)_pikeRows[1])
                {
                    if (pike.guardTarget == null && pike.getState() != Soldier.STATE_MELEE_WIN && pike.getState() != Soldier.STATE_MELEE_LOSS)
                    {
                        if (guard == null)
                            guard = pike;
                        else
                        {
                            bool ySmaller = Math.Abs(enemy.getPosition().Y - pike.getDestination().Y) < Math.Abs(enemy.getPosition().Y - guard.getDestination().Y);
                            bool xBigger = (pike.getDestination().X - guard.getDestination().X) * _side >= 0;
                            bool ySubstanciallyBigger = Math.Abs(guard.getDestination().Y - pike.getDestination().Y) > (float)Soldier.HEIGHT * 3f;
                            if (ySmaller && (xBigger || ySubstanciallyBigger) && pike.guardTarget == null && pike.getState() != Soldier.STATE_MELEE_WIN && pike.getState() != Soldier.STATE_MELEE_LOSS)
                                guard = pike;
                        }
                    }
                }
            }
            if (guard != null)
            {
                guard.guardTarget = enemy;
                guard.setSpeed(0.18f);
            }
        }
Example #28
0
 protected override void engage(bool win, Vector2 position, Soldier engager, bool rescueFight)
 {
     base.engage(win, position, engager, rescueFight);
     _screen.removeScreenObject(_lanceTip);
 }
Example #29
0
 internal void addLooseSoldier(Soldier sold)
 {
     if (!_looseSoldiers.Contains(sold))
     {
         _looseSoldiers.Add(sold);
         sold.myFormation = null;
     }
 }