Пример #1
0
        private IEnumerator PowerfullAttackCharging(float time)
        {
            managerUI.ActivateActionSlider(time, SliderType.STATE_CHARGING, false);
            yield return(new WaitForSeconds(time));

            animator.SetTrigger("PowerAttack");
            yield return(new WaitForSeconds(currentWeapon.GetPowTimeOffset()));

            GameObject damageArea = Instantiate(currentWeapon.GetDamageAreaPrefab(), this.transform.position, this.transform.rotation);

            switch (currentWeapon.GetWeaponType())
            {
            case 1:
            {
                Vector3 destinationPoint;
                float   destinationShorteningCoef = 0;
                mover.ActivateNavMeshAgent(true);
                do
                {
                    destinationPoint = transform.position + transform.forward * (currentWeapon.MoveForwardDist - destinationShorteningCoef);
                    destinationShorteningCoef++;
                } while (!mover.CanReachDestination(destinationPoint));
                mover.ActivateNavMeshAgent(false);
                transform.position = destinationPoint;

                if (chargeParticle != null)
                {
                    chargeParticle.GetComponent <ParticleSystem>().Stop();
                }
                playerCamera.SetIsChangingCameraDist(false);
                playerCamera.ChangeVirtualCameraStat(2.5f, 1, 1);
                playerCamera.ChangeVirtualCameraStat(2.5f, 1, 2);
                playerCamera.ChangeVirtualCameraStat(playerCamera.GetDefDist(), 1, 3);
                break;
            }

            case 2:
            {
                GameObject temp1 = Instantiate(
                    currentWeapon.GetMovePowParticle(),
                    currentWeaponPrefab.transform.GetChild(0).transform);
                GameObject temp2 = Instantiate(currentWeapon.GetSplashPowParticle(), this.transform);
                temp2.transform.parent = null;
                temp2 = Instantiate(currentWeapon.GetEffectOvertime(), this.transform);
                temp2.transform.parent = null;
                if (chargeParticle != null)
                {
                    chargeParticle.GetComponent <ParticleSystem>().Stop();
                }
                playerCamera.SetIsChangingCameraDist(false);
                playerCamera.ChangeVirtualCameraStat(4, 1, 1);
                playerCamera.ChangeVirtualCameraStat(4, 1, 2);
                playerCamera.ChangeVirtualCameraStat(playerCamera.GetDefDist(), 1, 3);
                animator.SetFloat("AttackSpeed", 2);
                yield return(new WaitForSeconds(0.1f));

                temp1.transform.parent = null;
                break;
            }

            default: yield break;
            }
            isPowerfullAtkInCooldown = true;
            chargesLeft -= 1;
            StartCoroutine(PowerfullAttackCooldown(currentWeapon.GetPowerfullCooldown()));
            StartAttackFinishCoroutine();
        }