protected override void Execute() { MovePathAction ma = new MovePathAction(this.Source, path, this.Source.Module<MoveModule>().MoveDuration); AttackUnitAction aa = new AttackUnitAction(this.attackUnit); PlayerDeclareMoveAttackEvent evt = new PlayerDeclareMoveAttackEvent(player,(UnitEntity)this.Source,this.attackUnit,ma,aa); this.EventManager.Raise(evt); }
protected override void Execute() { MovePathAction ma = new MovePathAction(this.Source, path, this.Source.Module <MoveModule>().MoveDuration); AttackUnitAction aa = new AttackUnitAction(this.attackUnit); PlayerDeclareMoveAttackEvent evt = new PlayerDeclareMoveAttackEvent(player, (UnitEntity)this.Source, this.attackUnit, ma, aa); this.EventManager.Raise(evt); }
public void OnPlayerDeclare(PlayerDeclareMoveAttackEvent evt) { Path <TileWorld, TilePosition> path; if (this.routes.TryGetValue(evt.Entity, out path)) { this.unDrawRoute(path); this.routes.Remove(evt.Entity); } this.routes.Add(evt.Entity, evt.MoveAction.Path); this.drawRoute(evt.MoveAction.Path, Color.red); }
private void OnPlayerDeclareMoveAttack(PlayerDeclareMoveAttackEvent evt) { if (currentPhase == Phases.Declare && evt.Player == playersTurn) { PlayerDeclareMoveAttackEvent oldevt; if (moveAttackDeclaration.TryGetValue(evt.Entity, out oldevt) && oldevt.AttackUnit != null) { oldevt.AttackUnit.Raise(new UnitDeclaredAsAttacked(evt.AttackUnit, evt.Entity, false)); } moveAttackDeclaration[evt.Entity] = evt; if (evt.AttackUnit != null) { var attackee = evt.Entity; var attacked = evt.AttackUnit; evt.AttackUnit.Raise(new UnitDeclaredAsAttacked(attacked, attackee, true)); } } }
public void OnPlayerDeclare(PlayerDeclareMoveAttackEvent evt) { Path<TileWorld,TilePosition> path; if(this.routes.TryGetValue(evt.Entity,out path)) { this.unDrawRoute(path); this.routes.Remove(evt.Entity); } this.routes.Add(evt.Entity, evt.MoveAction.Path); this.drawRoute(evt.MoveAction.Path,Color.red); }