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