protected override void OnManagedStart() { this.OnAgentStart(); this.currentState = State.Idle; if (this.hasBehavior) { this.behavior = StratusBehaviorSystem.InitializeSystemInstance(this, this.behavior); } }
/// <summary> /// Initializes an instance of this system, unique for the given agent /// </summary> /// <param name="agent"></param> /// <param name="system"></param> public static StratusBehaviorSystem InitializeSystemInstance(StratusAgent agent, StratusBehaviorSystem system) { if (!agentBehaviors.ContainsKey(agent)) { agentBehaviors.Add(agent, system.Instantiate(agent)); } StratusBehaviorSystem instance = agentBehaviors[agent]; instance.InitializeSystem(); return(instance); }