Пример #1
0
 private void OnPrimaryAttackHitCallBack(AttackHitData attackHitData)
 {
     if (_currentHealth <= 0)
     {
         //   return;
     }
     if (attackHitData.raycastHit.collider.gameObject == gameObject)
     {
         _currentHealth -= attackHitData.damage;
         if (attackHitData.bLastProjectile)
         {
             if (_currentHealth <= _dd.overkillHealth)
             {
                 _animator.SetTrigger(_animParamHashOverDie);
                 OnDeath(true);
             }
             else if (_currentHealth <= 0)
             {
                 _animator.SetTrigger(_animParamHashDie);
                 OnDeath(false);
             }
             else
             {
                 _animator.SetTrigger(_animParamHashFlinch);
                 _audioSource.PlayOneShot(_dd.audioClipHit);
             }
         }
     }
 }
Пример #2
0
    /// <summary>
    /// CallBack received the when the player attack hits something
    /// </summary>
    void OnPrimaryAttackHitCallBack(AttackHitData attackHitData)
    {
        GameObject decal = VisualEffectsManager.Instance.GetDecalSprite(attackHitData.raycastHit.collider.gameObject);

        if (decal != null)
        {
            decal.SetActive(true);
            decal.transform.forward  = attackHitData.raycastHit.normal;
            decal.transform.position = attackHitData.raycastHit.point + decal.transform.forward * .01f;
            decal.GetComponent <ParticleSystem>().Play();
        }

        /*  GameObject testSphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
         * testSphere.transform.localScale = Vector3.one * .05f;
         * testSphere.transform.position = bulletRayCastHit.point;*/
    }