public void Start() { // cache for quick lookup behavior = GetComponent<Behavior>(); health = GetComponent<Health>(); health.onDeath += destroySelf; }
public void Start() { // cache for quick lookup health = GetComponent<Health>(); behavior = GetComponent<Behavior>(); // continue initialization by resetting the variables reset(); }
public override void OnStart() { // the target may be null if it has been destoryed. In that case set the health to null and return if (target.Value == null) { health = null; return; } // cache the health component health = target.Value.GetComponent<Health>(); }