void Start() { targetBehavior = GetComponent <Behavior.ITarget <ITargetable> >(); // Get targetObject ID GameObject targetObject = GameObject.Find(targetObjectName); if (targetObject == null) { Debug.LogError("Error: cannot find a GameObject named " + targetObjectName, this); } targetObjectId = targetObject.GetInstanceID(); }
void Start() { targetBehavior = this.GetComponentInChildren <Behavior.ITarget <ITargetable> >(); aimBehavior = this.GetComponentInChildren <Behavior.IAimable <ITargetable> >(); shootBehavior = this.GetComponentInChildren <Behavior.IShoot>(); }