chunk 1: core gameplay scripts scenes runtime assets
This commit is contained in:
44
Assets/Scripts/Character Effects FX/CharacterVFXManager.cs
Normal file
44
Assets/Scripts/Character Effects FX/CharacterVFXManager.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CharacterVFXManager : MonoBehaviour
|
||||
{
|
||||
public GameObject punchHitFXPrefab;
|
||||
public GameObject kickHitFXPrefab;
|
||||
//public ParticleSystem block_FX;
|
||||
public GameObject blockFXPrefab;
|
||||
// Start is called before the first frame update
|
||||
|
||||
|
||||
public void playPunchEffect(GameObject fxLocation)
|
||||
{
|
||||
Vector3 hitFX_Pos = fxLocation.transform.position;
|
||||
GameObject hitFX = Instantiate(punchHitFXPrefab, hitFX_Pos, Quaternion.identity);
|
||||
StartCoroutine(destroyHitFX(hitFX));
|
||||
}
|
||||
|
||||
public void playKickEffect(GameObject fxLocation)
|
||||
{
|
||||
Vector3 hitFX_Pos = fxLocation.transform.position;
|
||||
|
||||
GameObject hitFX = Instantiate(kickHitFXPrefab, hitFX_Pos, Quaternion.identity);
|
||||
StartCoroutine(destroyHitFX(hitFX));
|
||||
}
|
||||
|
||||
public void playBlockEffect(GameObject fxLocation)
|
||||
{
|
||||
Vector3 blockFX_Pos = fxLocation.transform.position;
|
||||
GameObject blockFX = Instantiate(blockFXPrefab, blockFX_Pos, Quaternion.identity);
|
||||
StartCoroutine(destroyHitFX(blockFX));
|
||||
//block effect is destroyed by a script attached to it
|
||||
//block_FX.Play();
|
||||
}
|
||||
|
||||
//destroy instantiated prefab in 10 secs
|
||||
IEnumerator destroyHitFX(GameObject hitFX)
|
||||
{
|
||||
yield return new WaitForSeconds(1f);
|
||||
Destroy(hitFX);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user