using Invector.vMelee; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Beyond { public class bHitEffects : vHitEffects { public Transform shieldRecoilTransform; private void Start() { if (!shieldRecoilTransform) { shieldRecoilTransform = transform; } var weaponObject = GetComponent(); if (weaponObject) { weaponObject.onDamageHit.AddListener(PlayHitEffects); weaponObject.onRecoilHit.AddListener(PlayRecoilEffects); weaponObject.onDefense.AddListener(PlayDefenseEffects); } } public new void PlayDefenseEffects() { if (audioSource != null && recoilSounds.Length > 0) { var clip = recoilSounds[UnityEngine.Random.Range(0, recoilSounds.Length)]; var audioObj = Instantiate(audioSource, transform.position, transform.rotation) as GameObject; audioObj.GetComponent().PlayOneShot(clip); } if (recoilParticles.Length > 0) { var particles = recoilParticles[UnityEngine.Random.Range(0, recoilParticles.Length)]; // var hitrotation = Quaternion.LookRotation(new Vector3(transform.position.x, hitInfo.hitPoint.y, transform.position.z) - hitInfo.hitPoint); if (particles != null) Instantiate(particles, shieldRecoilTransform.position, shieldRecoilTransform.rotation); //Instantiate(particles, hitInfo.hitPoint, hitrotation); } } } }