void _aiEventProcessor_OnUnitUnderAttack(object sender, OnUnitUnderAttackHandlerArgs args) { var attackedComponent = _componentService.Get(args.AffectedUnitId); if(attackedComponent == null) return; var infanteryMinds = InfanteryMinds.Get().Where(x => x.MindState != EMindState.Engaged).ToList(); foreach (var infanteryMind in infanteryMinds) { var heatMapSector = _heatMapService.Get().Where(x => attackedComponent.Position.IsIn(x.Bounds)).Last(); heatMapSector.HeatFactor += 5; infanteryMind.ChangeState(EMindState.Bored); } }
void aiEventProcessor_OnUnitUnderAttack(object sender, OnUnitUnderAttackHandlerArgs args) { if(MindState != EMindState.Engaged) { ChangeState(EMindState.Scouting); var way = new WayPoint(args.Position); WayPointStore.Store(way.Id,way); } }