void Start() { controller = GetComponent <AIController1>(); sensorType = SensorType.sight; manager.RegisterSensor(this); bb = GameObject.FindGameObjectWithTag("Blackboard").GetComponent <Blackboard>(); memoryScript = GetComponent <SenseMemory>(); }
public override void Try(Sensor sensor) { if (isTouchingTrigger(sensor) && isActive) { //Health healthScript = sensor.gameObject.GetComponent<Health>(); AIController1 controller = sensor.GetComponent <AIController1>(); if (controller != null) { //healthScript.health += healthGiven; controller.health += healthGiven; //print("now my health is :" + healthScript.health); print("now my health is :" + controller.health); this.GetComponent <Renderer>().material.color = Color.green; StartCoroutine("TurnColorBack"); sensor.Notify(this); } else { print("Can't get health script!"); } Deactivate(); } }