internal void StarNewWork(int workIndex) { try { if (workIndex == 3) { isNight = true; } else { isNight = false; } if ((gameObject != null) && (agentActionsHandler != null)) { agentActionsHandler.StarNewWork(workIndex); } else { agentActionsHandler = new AgentActionsHandler(agentPathfinding, agentResources); agentActionsHandler.StarNewWork(workIndex); } } catch (System.Exception e) // REALLY BAD FIX! { Debug.LogError(e); } }
void Update() { CheckIfAlive(); if (agentActionsHandler != null) { agentActionsHandler.PerformActionSelection(); } else { agentActionsHandler = new AgentActionsHandler(agentPathfinding, agentResources); agentActionsHandler.PerformActionSelection(); } UpdateStamina(); }
void Start() { defaultColor = new Color(0, 1, 1, 1); GetComponent <SpriteRenderer>().color = defaultColor; agentPathfinding = gameObject.GetComponent("NavMeshAgentPath") as NavMeshAgentPath; agentActionsHandler = new AgentActionsHandler(agentPathfinding, agentResources); agentsManager = transform.parent.gameObject; ResetToDefaultValues(); dateBorn = (agentsManager.GetComponent("TimeDistribution") as TimeDistribution).DaysPassed; SetRandomAge(); }