void Awake() { // Set up references troopBehavior = GetComponent<TroopBehavior>(); troopStats = GetComponent<TroopStats>(); // Subscribe to appropriate events References.stateManager.changeState += onStateChange; troopBehavior.changeOfActions += onChangeAction; troopBehavior.onTroopDeath += onDeath; }
void Awake() { // Set up references troopBehavior = GetComponent<TroopBehavior>(); troopStats = GetComponent<TroopStats>(); navigation = GetComponent<NavMeshAgent>(); troopTargetSeeking = GetComponent<TroopTargetSeeking>(); References.stateManager.changeState += onStateChange; troopBehavior.changeOfActions += onChangeAction; troopBehavior.changeOfIntentions += onChangeIntent; troopTargetSeeking.onTargetVisible += onTargetVisible; troopBehavior.onTroopDeath += onDeath; RaycastHit hitInfo; Physics.Raycast(new Ray(transform.position, Vector3.down), out hitInfo, 10000f); transform.position = new Vector3(hitInfo.point.x, hitInfo.point.y + (transform.localScale.y / 2), hitInfo.point.z); }
void Awake() { troopBehavior = GetComponent<TroopBehavior>(); }
void Awake() { base.Awake(); troopBehavior = GetComponent<TroopBehavior>(); }
void Start() { troopBehavior = GetComponentInParent<TroopBehavior>(); troopBehavior.changeOfActions += onActionChange; anim = GetComponent<Animator>(); }