void Start() { foreach (Goal goal in goals) { if (!goalMap.ContainsKey(goal.type)) { goalMap.Add(goal.type, goal); } } AbstractRobotComponent [] compenents = GetComponentsInChildren <AbstractRobotComponent> (); foreach (AbstractRobotComponent component in compenents) { componentMap[component.GetType()] = component; } foreach (Label location in locations) { if (location == null) { Debug.LogWarning("Null location attached to AI with name: " + gameObject.name); continue; } mentalModel.addSighting(location.labelHandle, location.transform.position, null); trackTarget(location.labelHandle); } InvokeRepeating("evaluateActions", .1f, .2f); }
// Use this for initialization void Start() { mentalModel.addUpdateListener(this); for (int i = 0; i < robots.Length; i++) { if (robots[i] == null) { Debug.LogWarning("Null robot attached to CRC with name: " + gameObject.name); continue; } RobotAntenna antenna = robots[i].GetComponentInChildren <RobotAntenna>(); if (antenna != null) { listeners.Add(antenna.getController()); antenna.getController().attachMentalModel(mentalModel); } } foreach (Label location in locations) { if (location == null) { if (location == null) { Debug.LogWarning("Null location attached to CRC with name: " + gameObject.name); continue; } } else { mentalModel.addSighting(location.labelHandle, location.transform.position, null); } } }
private void sightingFound(LabelHandle target, Vector3 pos, Vector3?dir) { if (externalMentalModel != null) { externalMentalModel.addSighting(target, pos, dir); } mentalModel.addSighting(target, pos, dir); }