void SetReferences() { ResourcesDataControllerRef = GameObject.Find("GameManager").GetComponent <ResourcesDataController>(); _agentsParent = GameObject.Find("Agents"); _agentTargetsParent = GameObject.Find("AgentsTargets"); AgentMemory = GetComponent <AgentMemory>(); NeedsManager = GetComponent <AgentNeedsManager>(); StateMachineRef = GetComponent <AgentStateMachine>(); DecisionMaker = GetComponent <AgentDecisionMaker>(); }
// Use this for initialization void Start() { compileExpressionParser(); //Knowledge update rate KnowledgeUpdateWindow.LoadFromFile(); //Get goal goal = (CompoundTask)serializedGoal.DeSerialize(null); //Initialize knowledge foreach (SerializedFact fact in serializedKnowledge) { Atom newFact = new Atom(fact.name, fact.sign); foreach (string objName in fact.values) { newFact.addTerm(new Term(GameObject.Find(objName))); } state.addFact(newFact); } //Initialize variables foreach (SerializedVariable var in serializedDomainVariables) { if (var.key != "" && var.value != "") { domainVariables [serializedDomainVariables.IndexOf(var)].value = GameObject.Find(var.value); } } //Instantiate variables InstantiateVariables(goal, domainVariables); //Add sensor if (sensor == 0) { sensorySystem = new CameraSensor(this); } else if (sensor == 1) { sensorySystem = new RadiusSensor(this, radiusLength); } try { definitions = FactDefinitionsContainer.Load(FactsDefinitionWindow.definitionsPath).list; } catch (Exception e) { Debug.Log(e.Message); } //Agent FSM FSM = new AgentStateMachine(AgentState.IDLE, this); //Action manager actionManager = new ActionManager(this); //Coordination communicationSystem = new CommunicationSystem(this); groupMembers = new List <HTNAgent> (); //Personalities knownPersonalities = PersonalitiesContainer.Load(PersonalityEditorWindow.path).list; }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { agentStateMachine = animator.GetComponent <AgentStateMachine>(); }
private void Start() { m_SteerBehavior = GetComponent <SteerComponent>(); m_LifeComponent = GetComponent <LifeComponent>(); m_FSM = new AgentStateMachine(this); }