void BasicAttackUpdateS()
    {
        if (!alreadyAttacked)
        {
            if (enemyAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime % 1 >= 0.25f && enemyAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime % 1 <= 0.40f)
            {
                if (basicAttackTrigger.TargetIsInRange(targetTransform.name))
                {
                    Vector3 directionToTarget = transform.position - targetTransform.position;
                    float   desiredAngle      = Mathf.Atan2(directionToTarget.x, directionToTarget.z) * Mathf.Rad2Deg;

                    bool playPlayerHurtSound = (Random.Range(0.0f, 1.0f) >= 0.3f) ? true : false;
                    targetBehaviour.SetDamage(9, playPlayerHurtSound, Quaternion.Euler(0, desiredAngle, 0));

                    alreadyAttacked = true;
                }
            }
        }
        else
        {
            if (enemyAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime % 1 <= 0.1f)
            {
                if (alreadyAttacked)
                {
                    SetPlayerAttack();
                    alreadyAttacked = false;
                }
            }
        }
    }
Пример #2
0
    void DealBasicAttackDamage()
    {
        if (!alreadyAttacked && basicAttackTrigger.TargetIsInRange(enemyTargetStats.name))
        {
            Vector3 directionToTarget = playerTransform.position - enemyTargetTransform.position;
            float   desiredAngle      = Mathf.Atan2(directionToTarget.x, directionToTarget.z) * Mathf.Rad2Deg;

            enemyTargetStats.SetDamage(basicAttackDamage, true, Quaternion.Euler(0, desiredAngle, 0));
            ChargePassive(passivePerChargePercentage);

            alreadyAttacked = true;

            audioPlayer.PlaySFX(Random.Range(2, 4), 0.5f, Random.Range(0.96f, 1.04f));  //Thor Hammer Impact sound

            cameraBehaviour.CameraMoveTowards(0.25f, playerTransform.position, enemyTargetTransform.position);
            timeManager.SetTimeScaleAndDuration(0.05f, 0.075f, TimeManager.ScaleTimeTypes.Flat);
        }
    }