public Vector2 InitiateDirectionGoal(SocialSimulation.Entity.Entity entity, GlobalSimulationParameters parameters) { if (entity.Goals.Any()) { var g = entity.Goals.First(); var end = new Vector2(g.GoalPosition.X, g.GoalPosition.Y); _logger.Log($"Defined goal :{end}"); return(end); } return(Vector2.Zero); }
public void Behave(SocialSimulation.Entity.Entity entity, GlobalSimulationParameters simulationParams, Random random) { var audacityInfluence = random.NextDouble() < entity.Audacity; if (audacityInfluence && entity.CurrentGoal == null) { var newDir = entity.Movement.Direction; while (newDir == entity.Movement.Direction) { newDir = (StartDirection)random.Next(0, 4); } //_logger.Log($"Entity {entity.Id} changed direction from {entity.Direction} to {newDir}"); entity.Movement.Direction = newDir; entity.MovementType = MovementType.Stopped; } }