示例#1
0
    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;
    }
示例#2
0
    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);
    }
示例#3
0
 void Awake()
 {
     troopBehavior = GetComponent<TroopBehavior>();
 }
示例#4
0
 void Awake()
 {
     base.Awake();
     troopBehavior = GetComponent<TroopBehavior>();
 }
示例#5
0
 void Start()
 {
     troopBehavior = GetComponentInParent<TroopBehavior>();
     troopBehavior.changeOfActions += onActionChange;
     anim = GetComponent<Animator>();
 }