rabidus-test/Assets/GabrielAguiarProductions/Scripts/SpawnShieldRipples.cs

24 lines
628 B
C#
Raw Normal View History

2023-07-24 16:38:13 +03:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.VFX;
public class SpawnShieldRipples : MonoBehaviour
{
public GameObject shieldRipples;
private VisualEffect shieldRipplesVFX;
private void OnCollisionEnter(Collision co)
{
if (co.gameObject.tag == "Bullet")
{
var ripples = Instantiate(shieldRipples, transform) as GameObject;
shieldRipplesVFX = ripples.GetComponent<VisualEffect>();
shieldRipplesVFX.SetVector3("SphereCenter", co.contacts[0].point);
Destroy(ripples, 2);
}
}
}