Пример #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Enemy")
        {
            Vector3 directionToTarget = this.transform.position - other.transform.position;
            float   desiredAngle      = Mathf.Atan2(directionToTarget.x, directionToTarget.z) * Mathf.Rad2Deg;

            if (hammerBehaviour.GetIsThrowing())
            {
                other.gameObject.GetComponent <EnemyStats>().SetDamage(hammerBehaviour.ThrowHammerDamage(), true, Quaternion.Euler(new Vector3(0, desiredAngle, 0)));
                playerAudioPlayer.PlaySFX(Random.Range(2, 4), 0.5f, Random.Range(0.96f, 1.04f), gameObject);   //Hammer Impact sound

                cameraBehaviour.CameraMoveTowards(0.25f, transform.position, other.transform.position);
            }
        }
    }
Пример #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);
        }
    }