public void MainUpdate(FishSimulator.Delta delta, FishSimulator.Solution solution) { this.localDelta.current += delta.deltaTime; this.localDelta.local += delta.deltaTime; this.localDelta.deltaTime = delta.deltaTime; this.UpdatePerception(this.localDelta); this.UpdateBrain(this.localDelta); this.UpdateFocusser(this.localDelta); this.UpdateMotorController(this.localDelta); this.UpdateBody(this.localDelta); this.UpdateSolution(this.localDelta, solution); }
// public FishBrain Brain => this.brain; // public bool IsDone { get; set; } public void Init() { this.body = this.GetComponentInChildren <FishBody>(); this.body.Init(); this.brain = this.GetComponentInChildren <FishBrain>(); this.brain.Init(); this.perception = this.GetComponentInChildren <Perception>(); this.perception.Init(); this.logger = this.logger ?? new FishLogger(); this.localDelta = this.localDelta ?? new FishSimulator.Delta(); this.Reset(); FishSimulatorRunner.Instance.Controller.AddController(this); }
protected void UpdateMotorController(FishSimulator.Delta delta) { var behaviorRoutine = this.GenerateBehaviorRoutine(this.brain.CurrentIntension, this.perception); foreach (var mc in behaviorRoutine.ToMC()) { if (mc is MuscleMC) { var mmc = mc as MuscleMC; if (this.muscleMCs.Count > 1) { this.muscleMCs.RemoveLast(); } this.muscleMCs.AddLast(mmc); } if (mc is BalanceMC) { this.balanceMC = mc as BalanceMC; } } this.ApplyBehaviorRoutine(delta); }
protected void UpdateFocusser(FishSimulator.Delta delta) { this.perception.FocusserUpdate(this.brain.CurrentIntension, this.brain.CurrentDesire, this.body); }
protected void UpdateBrain(FishSimulator.Delta delta) { this.brain.UpdateBrain(delta, this.perception); }
protected void UpdatePerception(FishSimulator.Delta delta) { this.perception.SensorUpdate(delta); }
public void SensorUpdate(FishSimulator.Delta delta) { this.sensorData.Clear(); this.visionSensor.Scan(this.sensorData); }