Exemplo n.º 1
0
 private UnitStratey CreateUnitStratey(UnitBase unit)
 {
     var unitStratey = CreateUnitStratey(unit, GetSituation(unit));
     Console.ForegroundColor = ConsoleColor.DarkGreen;
     Console.WriteLine(string.Format("Situation of {0}: {1}", unitStratey.Target.Id, unitStratey.Situation));
     Console.ForegroundColor = ConsoleColor.Gray;
     _unitStrategyProcessor.Process(unitStratey);
     return unitStratey;
 }
Exemplo n.º 2
0
 public bool TryProcess(UnitBase source, out Enum.Situation result)
 {
     var id = source.Id;
     return _out.Generic(out result, _componentService.Get<UnitAttacking>().Any(x => x.UnitId == id),
                         Enum.Situation.Attacking);
 }
 private UnitBase GetPreferedUnitToWalkWith(UnitBase sourceUnit, IEnumerable<UnitBase> units)
 {
     var position = sourceUnit.Position;
     return units.OrderBy(y => _vector2Service.GetDistance(y.Position, position))
         .ThenBy(y => y.Health)
         .First();
 }
 private MoveUnitEvent GetMoveUnitEvent(UnitBase unit, Vector2 position)
 {
     return new MoveUnitEvent(_ai.Id, unit.Id, position.X, position.Y);
 }
Exemplo n.º 5
0
 private Situation GetSituation(UnitBase unit)
 {
     return _situationHandlingProcessor.Process(unit);
 }
Exemplo n.º 6
0
 private UnitStratey CreateUnitStratey(UnitBase unit, Situation situation)
 {
     return new UnitStratey {Target = unit, Situation = situation};
 }
Exemplo n.º 7
0
 public bool TryProcess(UnitBase source, out Enum.Situation result)
 {
     return _out.True(out result, Enum.Situation.DoNothing);
 }
 private IEnumerable<EnemyUnitSignature> GetEnemySignaturesAround(UnitBase unit)
 {
     return GetEnemySignaturesAround(unit.Position, unit.FieldOfVisionRadius);
 }
Exemplo n.º 9
0
 private MoveUnitEvent GetMoveUnitEvent(UnitBase unit, Vector2 position)
 {
     Console.WriteLine(string.Format("Jfis {0} will move to defend the Barrack", unit.Id));
     return new MoveUnitEvent(_ai.Id, unit.Id, position.X, position.Y);
 }
Exemplo n.º 10
0
 private float GetOwnUnitsHealth(IEnumerable<EnemyAround> attackingUnits, UnitBase myself)
 {
     return attackingUnits.Sum(x => x.AttackingUnitsHealth) + myself.Health;
 }