示例#1
0
 public void Start()
 {
     // cache for quick lookup
     behavior = GetComponent<Behavior>();
     health = GetComponent<Health>();
     health.onDeath += destroySelf;
 }
示例#2
0
        public void Start()
        {
            // cache for quick lookup
            health = GetComponent<Health>();
            behavior = GetComponent<Behavior>();

            // continue initialization by resetting the variables
            reset();
        }
示例#3
0
 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>();
 }