Ejemplo n.º 1
0
    void Start()
    {
        health = GetComponentInChildren <EnemyHealth>();
        traits = GetComponentInChildren <EnemyTraits>();

        hasMelee  = traits.Melee;
        hasRanged = traits.Ranged;
        hasBlock  = traits.Block;
        hasDash   = traits.Dash;

        if (hasDash)
        {
            dashing = GetComponentInChildren <DashingFeature>();
        }
        controlManager = GetComponent <EnemyControlManager>();

        player       = GameObject.FindGameObjectWithTag("Player").transform;
        playerHealth = player.GetComponent <PlayerHealth>();

        playerHasMelee = player.GetComponent <PlayerTraits>().Melee;
        if (playerHasMelee)
        {
            playerMeleeAttacking = player.GetComponentInChildren <MeleeAttackFeature>();
        }

        playerHasBlock = player.GetComponent <PlayerTraits>().Block;
        if (playerHasBlock)
        {
            playerBlocking = player.GetComponentInChildren <BlockingFeature>();
        }

        navAgent          = GetComponent <NavMeshAgent>();
        meleeRangeTracker = GetComponentInChildren <MeleeRangeTracker>();

        currentState = EnemyState.Approach;
    }