internal bool CanBuildHouse() { if (!agentBehaviours) { agentBehaviours = gameObject.GetComponent <AgentBehaviourLibrary>(); } return(agentBehaviours.HasRock() && agentBehaviours.IsGoingHome); }
internal bool CanBuildBridge() { if (!agentBehaviours) { agentBehaviours = gameObject.GetComponent <AgentBehaviourLibrary>(); } return(agentBehaviours.HasRock() && agentBehaviours.IsBuildingBridge); }
void Awake() { if (agentBehaviours == null) { agentBehaviours = gameObject.GetComponent <AgentBehaviourLibrary>(); } if (timeDistribution = null) { timeDistribution = gameObject.transform.parent.GetComponent("TimeDistribution") as TimeDistribution; } }
// Update is called once per frame void Update() { transform.rotation = Quaternion.Euler(90, 0, 0); if (agentBehaviours.Home == null) { FindHouse(); } if (!agentBehaviours) { agentBehaviours = gameObject.GetComponent <AgentBehaviourLibrary>(); } ChangeWorkIndex(); CheckIfAlive(); UpdateStamina(); ActionSelection(); }
// Use this for initialization void Start() { numberOfBots = numberOfBots + 1; botNumber = numberOfBots; agentsManager = transform.parent.gameObject; agentBehaviours = gameObject.GetComponent <AgentBehaviourLibrary>(); timeDistribution = gameObject.transform.parent.GetComponent("TimeDistribution") as TimeDistribution; dateBorn = timeDistribution.DaysPassed; nextStaminaUpdate = timeDistribution.TimeInDay; staminaUpdateTime = timeDistribution.TimeInDay / 1.75f; SetRandomAge(); defaultColor = new Color(0, 1, 1, 1); GetComponent <SpriteRenderer>().color = defaultColor; worksIndex = Random.Range(-2, 3) + 1; FindHouse(); agentBehaviours.SetBotNumber(botNumber); }