Exemple #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;
 }
 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);
 }
Exemple #5
0
 private Situation GetSituation(UnitBase unit)
 {
     return _situationHandlingProcessor.Process(unit);
 }
Exemple #6
0
 private UnitStratey CreateUnitStratey(UnitBase unit, Situation situation)
 {
     return new UnitStratey {Target = unit, Situation = situation};
 }
 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);
 }
 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);
 }
 private float GetOwnUnitsHealth(IEnumerable<EnemyAround> attackingUnits, UnitBase myself)
 {
     return attackingUnits.Sum(x => x.AttackingUnitsHealth) + myself.Health;
 }