Beispiel #1
0
    // Use this for initialization
    void Awake()
    {
        attackType = (int)specialAttackType;

        chase   = new NodeChase(this);
        attack  = new NodeAttack(this);
        stunned = new NodeStunned(this);
        melee   = new NodeAttackMelee(this);
        if (attackType == (int)SpecialAttackType.Lunge)
        {
            special = new NodeSpecialAttackLunge(this);
        }
        if (attackType == (int)SpecialAttackType.Ranged)
        {
            special = new NodeSpecialAttackRanged(this);
        }
        if (attackType == (int)SpecialAttackType.DoubleShot)
        {
            special = new NodeSpecialAttackRangedDouble(this);
        }

        npcNav = GetComponent <NPCNavigation>();
        if (npcNav == null)
        {
            npcNav = transform.parent.GetComponent <NPCNavigation>();
        }

        navMeshAgent = GetComponent <NavMeshAgent>();
        if (navMeshAgent == null)
        {
            navMeshAgent = transform.parent.GetComponent <NavMeshAgent>();
        }

        targets = new Transform[2];
    }
Beispiel #2
0
 private void Awake()
 {
     _bio     = GetComponent <Biology>();
     _harvest = GetComponent <IHarvest>();
     _attack  = GetComponent <IAttack>();
     _memory  = GetComponent <CreatureMemory>();
     _nav     = GetComponent <NPCNavigation>();
     _reach   = GetComponent <IHaveReach>();
     _drink   = GetComponent <CreatureDrink>();
 }