Exemplo n.º 1
0
    /////////////////////////
    //ACTION HELPER METHODS//
    /////////////////////////
    private void ShootGun()
    {
        if (targetedEnemy == null)
        {
            return;
        }
        float remainingDistance = Vector3.Distance(targetedEnemy.position, transform.position);

        if (remainingDistance <= abilities.Basic.effectiveRange && isTargetVisible(targetedEnemy))
        {
            //Within range, look at enemy and shoot
            transform.LookAt(targetedEnemy);
            //animController.AnimateAimStanding();

            if (abilities.Basic.isReady() && !targetedEnemy.GetComponent <EnemyHealth>().isDead)
            {
                animController.AnimateShoot();
                abilities.Basic.Execute(player, gameObject, targetedEnemy.gameObject);
                if (targetedEnemy.GetComponent <EnemyHealth>().isDead)
                {
                    navMeshAgent.destination = transform.position;
                }
            }
            animSpeed = 0.0f;
        }
    }