コード例 #1
0
        // Attack animation callback
        void Hit()
        {
            bool targetStillAlive = target && target.GetComponent <HealthSystem>().HealthAsPercentage > Mathf.Epsilon;

            if (targetStillAlive)
            {
                audioSource.PlayOneShot(currentWeaponConfig.GetAttackAudioClip());
                target.GetComponent <HealthSystem>().TakeDamage(CalculateDamage());
            }
            else
            {
                audioSource.PlayOneShot(currentWeaponConfig.GetSwingAudioClip());
            }
        }