/* This method will be called before Update, FixedUpdate and LateUpdate * This makes sure that the first method which gets called each frame (which can vary) * forces the controlcenter to calculate which behaviour(s) to execute exactly one time * each frame */ public void PreExecuteCalculations() { if (lastArbitratedFrame != Time.frameCount) { strategyToUse = StrategyManager.GetStrategy(); // Get the strategy to use toExecute = ArbitrationManager.Arbitrate(strategyToUse.GetBehaviours()); // Get the behaviour(s) to execute if (CommunicationManager.EnableBroadcasting) { AgentBehaviour broadcastedBehaviourToDo = CommunicationManager.GetBehaviourToDo(toExecute); if (broadcastedBehaviourToDo != null) { toExecute.Clear(); toExecute.Add(broadcastedBehaviourToDo); } } SuppressBehaviours(); lastArbitratedFrame = Time.frameCount; } }