public virtual void update(TimeSpan timeSpan) { _stateChanged = false; bool guarding = true;//this is Pikeman || this is Dopple || _type == TYPE_SHOT; if (guarding) { guarding = guardTarget != null && _state != STATE_DYING && _state != STATE_DEAD; if (guardTarget != null && guardTarget._position.X - _screen.getMapOffset().X < 0 - WIDTH) { guardTarget = null; _speed = 0.15f; guarding = false; } } if (_stateToHave != -1) { _state = _stateToHave; _stateToHave = -1; } if (_reacting && _state != STATE_DEAD && _state != STATE_DYING && _state != Targeteer.STATE_SHIELDBREAK && _state != STATE_MELEE_LOSS && _state != STATE_MELEE_WIN && (_state != Cavalry.STATE_SLOWDOWN || !(this is Cavalry)) && (_state != Cavalry.STATE_TURNING || !(this is Cavalry))) { checkReactions(timeSpan); updateState(timeSpan); updateAnimation(timeSpan); return; } // check for REACTIONS else if ((_state == STATE_READY || _state == STATE_CHARGING || _state == STATE_CHARGED) || (this is Colmillos && _state == Colmillos.STATE_COVER) /*&& !guarding*/) { if (checkReactions(timeSpan)) { updateState(timeSpan); updateAnimation(timeSpan); return; } } // Gotta keep enemy charging soldiers charging at teh formation if (_state == STATE_CHARGING && _side == BattleScreen.SIDE_ENEMY) { if (_screen.getPlayerFormation().getPosition().X > _position.X) _destination.X = -1000f; else _destination = new Vector2(_screen.getPlayerFormation().getCenter().X, _screen.getPlayerFormation().getCenter().Y); } if (guarding) { if (Math.Abs(guardTarget.getCenter().X - getCenter().X) > guardTargetRange) { _delta = new Vector2(_destination.X - _position.X, guardTarget.getPosition().Y + guardTarget._guardPositionOffset.Y - _position.Y); _dest = new Vector2(_destination.X, guardTarget.getPosition().Y + guardTarget._guardPositionOffset.Y); } else { _delta = new Vector2(guardTarget.getCenter().X + guardTarget._guardPositionOffset.X - guardTargetDist - _position.X, guardTarget.getPosition().Y + guardTarget._guardPositionOffset.Y - _position.Y); _dest = new Vector2(guardTarget.getCenter().X + guardTarget._guardPositionOffset.X - guardTargetDist, guardTarget.getPosition().Y + guardTarget._guardPositionOffset.Y); } } else if (_state != STATE_MELEE_LOSS && _state != STATE_MELEE_WIN && _state != STATE_ONEATTACK && (_state != Cavalry.STATE_SLOWDOWN || !(this is Cavalry)) && (_state != Cavalry.STATE_TURNING || !(this is Cavalry)) && (_state != Targeteer.STATE_SHIELDBREAK || !(this is Targeteer)) && (_state != Targeteer.STATE_DEFEND || !(this is Targeteer)) && (_state != DismountedCavalry.STATE_FALLING || !(this is DismountedCavalry)) && (_state != Soldier.STATE_ATTACKING || !(this is Arquebusier || this is Dopple || this is CrossbowmanPavise)) && (_state != Soldier.STATE_RELOADING || !(this is Dopple || this is CrossbowmanPavise)) && ((_state != Soldier.STATE_CHARGING || !initCharge )|| !(this is CrossbowmanPavise)) && ((_state != CrossbowmanPavise.STATE_PLACING) || !(this is CrossbowmanPavise)) && ((_state != CrossbowmanPavise.STATE_RETRIEVING) || !(this is CrossbowmanPavise)) && ((_state != Wolf.STATE_KILL && _state != Wolf.STATE_HOWLING) || !(this is Wolf))) { if (terrainCollider != null) { Vector2 tempDest = getCollidedDest(_destination); _delta = tempDest - _position; _dest = tempDest; } else { _delta = _destination - _position; _dest = _destination; } } else { if (terrainCollider != null) { Vector2 tempDest = getCollidedDest(_meleeDestination); _delta = tempDest - _position; _dest = tempDest; } _delta = _meleeDestination - _position; _dest = _meleeDestination; } if (_side == BattleScreen.SIDE_PLAYER && myFormation == _screen.getPlayerFormation()) { _travel.X = (float)timeSpan.TotalMilliseconds * _speed; _travel.Y = (float)timeSpan.TotalMilliseconds * _speed; } else { //float absDeltaX = Math.Abs(_delta.X); //float absDeltaY = Math.Abs(_delta.Y); double angle = Math.Atan2(_delta.Y, _delta.X); //_travel.X = (absDeltaX / (absDeltaX + absDeltaY)) * (float)timeSpan.TotalMilliseconds * _speed; //_travel.Y = (absDeltaY / (absDeltaX + absDeltaY)) * (float)timeSpan.TotalMilliseconds * _speed; double cos = Math.Cos(angle); double sin = Math.Sin(angle); _travel.X = (float)cos * (float)timeSpan.TotalMilliseconds * _speed; _travel.Y = (float)sin * (float)timeSpan.TotalMilliseconds * _speed; //fix the sign for the trig quadrant if (_delta.X < 0) _travel.X *= -1; if (_delta.Y < 0) _travel.Y *= -1; } // check to see if walking if (_delta.Length() != 0) { if (!_feet.getPlaying()) { _feet.playRandomStart(); _feet.nextFrame(); } if (!_retreat.getPlaying()) { _retreat.play(); _retreat.nextFrame(); } } else { _feet.stop(); _feet.reset(); _retreat.stop(); _retreat.reset(); } _feet.update(timeSpan); _retreat.update(timeSpan); if (_feet.getCurrFrame() % 2 > 0) _jostleOffset.Y = 1f; else _jostleOffset.Y = 0f; // as long as we are not at destination, keep trying to get there, but don't overshoot //if (!(this is Wolf && _state == Wolf.STATE_TURNING)) //{ if (_delta.X > 0) { if (_delta.X - _travel.X >= 0) _position.X += _travel.X; else _position.X = _dest.X; } else if (_delta.X < 0) { if (_delta.X + _travel.X <= 0) _position.X -= _travel.X; else _position.X = _dest.X; } if (_delta.Y > 0) { if (_delta.Y - _travel.Y >= 0) _position.Y += _travel.Y; else _position.Y = _dest.Y; } else if (_delta.Y < 0) { if (_delta.Y + _travel.Y <= 0) _position.Y -= _travel.Y; else _position.Y = _dest.Y; } //} updateState(timeSpan); updateAnimation(timeSpan); _drawingY = _position.Y + 36f; }
private void collisionPush(ScreenObject collider) { float coX = collider.getPosition().X; float coY = collider.getPosition().Y; float coW = (float)collider.getWidth(); float coH = (float)collider.getHeight(); if (coX < _position.X) { if(_dest.X > coX + coW) _position.X = coX + coW; } else { if (_dest.X < coX) _position.X = coX - (float)getWidth(); } if (coY < _position.Y) { if (_dest.Y > coY + coH) _position.Y = coY + coH; } else { if (_dest.Y < coY) _position.Y = coY - (float)getHeight(); } }
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; }
public override void collide(ScreenObject collider, TimeSpan timeSpan) { float shimmy = (float)timeSpan.TotalMilliseconds * _speed; if (collider == _killer || _state == STATE_DEAD || _state == STATE_DYING) return; if (collider is Terrain) { terrainCollider = (Terrain)collider; } else if (collider is Shot && collider.getSide() != _side && !(collider is Pavise) && collider.getState() != STATE_DEAD && collider.getState() != Shot.STATE_GROUND) { if (this is Targeteer) { if (collider is ArquebusierShot || (collider is CrossbowShot && collider.getSide() == BattleScreen.SIDE_PLAYER)) ((Targeteer)this).shieldBreak(); else ((Targeteer)this).shieldBlock(); } else if (this is CrossbowmanPavise) { if (_side == BattleScreen.SIDE_PLAYER) ((CrossbowmanPavise)this).shieldBlock(); else hit(); } else if (!(this is Leader) && (this._side == BattleScreen.SIDE_ENEMY || _screen.getPlayerFormation() == this.myFormation)) hit(); ((Shot)collider).hit(); _killer = collider; } else if ((collider is PikeTip && collider.getSide() != _side) && (_state != STATE_DEAD && _state != STATE_DYING && _state != STATE_ROUTE && _state != STATE_ROUTED)) { if (((PikeTip)collider).getSoldierState() == Pikeman.STATE_LOWERED) { if (!(this is Targeteer) && !(this is Wolf) && _side != BattleScreen.SIDE_NEUTRAL) { hit(); _killer = collider; ((PikeTip)collider).getPikeman().recoil(); } else if (this is Targeteer) { if ( (!(this is Colmillos) && ((Targeteer)this)._hasShield) || (this is Colmillos && !((ColmillosFormation)((Colmillos)this).myFormation).attacked)) { ((Targeteer)this).shield(); this.setReactionDest(collider.getCenter().X + 50f);//((collider.getSide() == BattleScreen.SIDE_ENEMY? 1 : -1 ) * collider.getWidth() * 0.5f + Soldier.WIDTH * 0.35f } else { hit(); _killer = collider; ((PikeTip)collider).getPikeman().recoil(); } } } } else if ((collider is WeaponSwing && collider.getSide() != _side) && (_state != STATE_DEAD && _state != STATE_DYING && _state != STATE_ROUTE && _state != STATE_ROUTED)) { if (((WeaponSwing)collider).getSoldier() is Colmillos) { if (!((WeaponSwing)collider).hit) { if (this is Targeteer) ((Targeteer)this).shieldBreak(); else { hit(); _killer = collider; } ((WeaponSwing)collider).hit = true; _screen.removeScreenObject(collider); } } else if (this is Targeteer) ((Targeteer)this).shieldBreak(); else { hit(); _killer = collider; } } else if ((collider is LanceTip && collider.getSide() != _side) && (_state != STATE_DEAD && _state != STATE_DYING && _state != STATE_MELEE_WIN && _state != STATE_MELEE_LOSS && _state != STATE_ROUTE && _state != STATE_ROUTED)) { if (this is Targeteer) ((Targeteer)this).shieldBreak(); else hit(); ((LanceTip)collider).getCavalry().recoil(); _killer = collider; } else if (collider is Soldier) { bool colliderInFormation = false; bool thisInFormation = false; if (_screen.getPlayerFormation() != null && _screen.getPlayerFormation().getSoldiers() != null) { colliderInFormation = ((Soldier)collider).myFormation == _screen.getPlayerFormation(); thisInFormation = myFormation == _screen.getPlayerFormation(); } if (_state != STATE_DEAD && _state != STATE_DYING && _state != STATE_MELEE_WIN && _state != STATE_MELEE_LOSS && (!(this is Targeteer) || _state != Targeteer.STATE_SHIELDBREAK) && (!(this is DismountedCavalry) || _state != DismountedCavalry.STATE_FALLING)) { if (this is CrossbowmanPavise && collider is CrossbowmanPavise && (this._state == STATE_CHARGING || this._state == STATE_RELOADING || this._state == STATE_ATTACKING || this._state == CrossbowmanPavise.STATE_PLACING || this._state == CrossbowmanPavise.STATE_RETRIEVING) && (collider.getState() == STATE_CHARGING || collider.getState() == STATE_RELOADING || collider.getState() == STATE_ATTACKING || collider.getState() == CrossbowmanPavise.STATE_PLACING || collider.getState() == CrossbowmanPavise.STATE_RETRIEVING)) { Vector2 changeVector = new Vector2(0f, (float)timeSpan.TotalMilliseconds * _speed); ((CrossbowmanPavise)this).postRetrieveState = _state; ((CrossbowmanPavise)this).paviseRetrieve(); if (this._position.Y < collider._position.Y) { this._position -= changeVector; ((CrossbowmanPavise)this)._meleeDestination -= changeVector; ((CrossbowmanPavise)this).chargePosition -= changeVector; } else { this._position += changeVector; ((CrossbowmanPavise)this)._meleeDestination += changeVector; ((CrossbowmanPavise)this).chargePosition += changeVector; } } //push from collisions with other charging enemy soldiers else if (myFormation == null && ((Soldier)collider).myFormation == null && _side == BattleScreen.SIDE_ENEMY && collider.getSide() == BattleScreen.SIDE_ENEMY && (collider.getState() != STATE_DYING && collider.getState() != STATE_DEAD)) { if (this._position.Y < collider._position.Y) { this._position -= new Vector2(0f, (float)timeSpan.TotalMilliseconds * _speed); } else { this._position += new Vector2(0f, (float)timeSpan.TotalMilliseconds * _speed); } } else { if (!((collider.getSide() == BattleScreen.SIDE_NEUTRAL && _side == BattleScreen.SIDE_PLAYER) || (collider.getSide() == BattleScreen.SIDE_PLAYER && _side == BattleScreen.SIDE_NEUTRAL))) { //fighting if (_side != collider.getSide() && !(this is Leader || collider is Leader) && collider.getState() != STATE_DEAD && collider.getState() != STATE_DYING && collider.getState() != STATE_MELEE_WIN && collider.getState() != STATE_MELEE_LOSS && (!(collider is Targeteer) || collider.getState() != Targeteer.STATE_SHIELDBREAK) && (!(collider is DismountedCavalry) || collider.getState() != DismountedCavalry.STATE_FALLING) && (!(collider is Wolf) || collider.getState() != Wolf.STATE_KILL) && (!(this is Wolf) || this._state != Wolf.STATE_KILL)) { bool rescueFight = (_side == BattleScreen.SIDE_PLAYER && !thisInFormation) || (collider.getSide() == BattleScreen.SIDE_PLAYER && !colliderInFormation); if (this is Colmillos) { if (_state != Colmillos.STATE_ATTACK) attack(); _destination = _position; } else if (collider is Colmillos) { if (collider.getState() != Colmillos.STATE_ATTACK) ((Colmillos)collider).attack(); ((Colmillos)collider)._destination = ((Colmillos)collider)._position; } else if (this is Dopple) { if (_state != STATE_ATTACKING) attack(); ((Soldier)collider).engage(false, _position, this, rescueFight); } else if (collider is Dopple) { if (collider.getState() != STATE_ATTACKING) ((Dopple)collider).attack(); engage(false, collider.getPosition(), (Soldier)collider, rescueFight); } else if (_side == BattleScreen.SIDE_ENEMY || this is Wolf) { engage(true, collider.getPosition(), (Soldier)collider, rescueFight); ((Soldier)collider).engage(false, _position, this, rescueFight); } else { engage(false, collider.getPosition(), (Soldier)collider, rescueFight); ((Soldier)collider).engage(true, _position, this, rescueFight); } } //rescue else if (_side == BattleScreen.SIDE_PLAYER && collider.getSide() == BattleScreen.SIDE_PLAYER && (thisInFormation != colliderInFormation)) { if (thisInFormation && collider.getState() != STATE_CHARGING && collider.getState() != STATE_DYING && collider.getState() != STATE_DEAD && collider.getState() != STATE_MELEE_LOSS && collider.getState() != STATE_MELEE_WIN && collider.getState() != STATE_ATTACKING && collider.getState() != STATE_RELOADING) { ((Soldier)collider)._state = STATE_READY; ((Soldier)collider)._reacting = false; if (((Soldier)collider).myFormation != null && ((Soldier)collider).myFormation != _screen.getPlayerFormation()) ((Soldier)collider).myFormation.removeSoldier(((Soldier)collider)); _screen.getPlayerFormation().addSoldier((Soldier)collider); _screen.removeLooseSoldier((Soldier)collider); } else if (colliderInFormation && this.getState() != STATE_CHARGING && this.getState() != STATE_DYING && this.getState() != STATE_DEAD && this.getState() != STATE_MELEE_LOSS && this.getState() != STATE_MELEE_WIN && this.getState() != STATE_ATTACKING && this.getState() != STATE_RELOADING) { _reacting = false; _state = STATE_READY; if (myFormation != null) myFormation.removeSoldier(this); _screen.getPlayerFormation().addSoldier(this); _screen.removeLooseSoldier(this); } } } } } } }
public void checkNonFatalCollision(ScreenObject so, TimeSpan timeSpan) { float soX, soY, soWidth, soHeight; float coX, coY, coWidth, coHeight; bool collision = true; _screenColliders.Clear(); // pour all of the screen objects into the list of objects to check for collisions against to start with foreach (ScreenObject sObj in _screenObjects) { if (!(sObj is Soldier) && so.getState() != ScreenObject.STATE_DEAD && so.getState() != ScreenObject.STATE_DYING) _screenColliders.Add(sObj); } if (so.getState() != ScreenObject.STATE_DEAD || so.getState() != ScreenObject.STATE_DYING) { // get the values here so we aren't calling functions like crazy // pavise HACK if (so is Pavise) { soX = so.getPosition().X; soY = so.getPosition().Y - 10; soWidth = so.getWidth(); soHeight = so.getHeight() + 10; } else { soX = so.getPosition().X; soY = so.getPosition().Y; soWidth = so.getWidth(); soHeight = so.getHeight(); } foreach (ScreenObject co in _screenColliders) { if (so != co) { // pavise HACK if (so is Pavise) { coX = co.getPosition().X; coY = co.getPosition().Y - 10; coWidth = co.getWidth(); coHeight = co.getHeight() + 10; } else { coX = co.getPosition().X; coY = co.getPosition().Y; coWidth = co.getWidth(); coHeight = co.getHeight(); } collision = true; // see if we didn't collide if (soX > coX + coWidth) collision = false; else if (soX + soWidth < coX) collision = false; else if (soY > coY + coHeight) collision = false; else if (soY + soHeight < coY) collision = false; if (collision) { so.collide(co, timeSpan); co.collide(so, timeSpan); } } } } }
public void removeScreenObject(ScreenObject so) { _moreDeadThings.Add(so); //_screenObjects.Remove(so); }
public virtual void collide(ScreenObject collider, TimeSpan timeSpan) { }
public void addScreenObject(ScreenObject so) { _screenObjectsToAdd.Add(so); //_screenObjects.Add(so); }
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; }
public override void collide(ScreenObject collider, TimeSpan timeSpan) { if (collider is PikeTip && _side != collider.getSide()) { Pikeman pikeman = ((PikeTip)collider).getPikeman(); if (pikeman.getState() != Pikeman.STATE_RECOILING && pikeman.getState() != STATE_DYING && pikeman.getState() != STATE_DEAD && pikeman.getState() != Soldier.STATE_MELEE_LOSS && pikeman.getState() != Soldier.STATE_MELEE_WIN) pikeman.recoil(); } }
public override void collide(ScreenObject collider, TimeSpan timeSpan) { if (collider is PikeTip) { Pikeman pikeman = ((PikeTip)collider).getPikeman(); if (pikeman.getState() != Pikeman.STATE_RECOILING && pikeman.getState() != STATE_DYING && pikeman.getState() != STATE_DEAD && pikeman.getState() != Soldier.STATE_MELEE_LOSS && pikeman.getState() != Soldier.STATE_MELEE_WIN && pikeman.getState() != Pikeman.STATE_RAISING && pikeman.guardTarget == this._pikeman) { pikeman.recoil(); if (_pikeman is Colmillos) { _pikeman._destination.X = collider.getCenter().X + (collider.getSide() == BattleScreen.SIDE_ENEMY ? 1 : -1) * collider.getWidth() * 0.5f + Soldier.WIDTH * 0.35f; } ((Targeteer)_pikeman).setReactionDest(collider.getCenter().X + (collider.getSide() == BattleScreen.SIDE_ENEMY ? 1 : -1) * collider.getWidth() * 0.5f + Soldier.WIDTH * 0.35f); ((Targeteer)_pikeman).resetDefendTimer(); } } }
public override void collide(ScreenObject collider, TimeSpan timeSpan) { if (_state != STATE_GROUND) { if ((collider is Shot || collider is WeaponAttack) && collider.getSide() != _side && collider.getState() != STATE_DEAD && collider.getState() != STATE_DYING && _state != STATE_GROUND && _state != STATE_GETTINGHIT) { if (collider is PikeTip) { Pikeman pikeman = ((PikeTip)collider).getPikeman(); if (pikeman.getState() != Pikeman.STATE_RECOILING && pikeman.getState() != STATE_DYING && pikeman.getState() != STATE_DEAD && pikeman.getState() != Soldier.STATE_MELEE_LOSS && pikeman.getState() != Soldier.STATE_MELEE_WIN) { pikeman.recoil(); ground(); } } else if (collider is LanceTip) { Cavalry pikeman = ((LanceTip)collider).getCavalry(); if (pikeman.getState() != Cavalry.STATE_RECOILING && pikeman.getState() != STATE_DYING && pikeman.getState() != STATE_DEAD && pikeman.getState() != Soldier.STATE_MELEE_LOSS && pikeman.getState() != Soldier.STATE_MELEE_WIN) { pikeman.recoil(); ground(); } } else if (collider is Shot) { collider.setState(STATE_DEAD); ground(); } } else if ((collider is Soldier) && collider.getSide() != _side && collider.getState() != STATE_DEAD && collider.getState() != STATE_DEAD && collider.getState() != STATE_DYING && collider.getState() != Soldier.STATE_ONEATTACK && _state != STATE_GROUND && _state != STATE_GETTINGHIT) { ((Soldier)collider).oneAttack(this); _state = STATE_GETTINGHIT; _stateTimer = ((Soldier)collider).getOneAttackTime(); } } }
public override void collide(ScreenObject collider, TimeSpan timeSpan) { base.collide(collider, timeSpan); if (collider is Terrain && _state == STATE_FLYING) hit(); }