IEnumerator DelayInstEffect(INST_EFFECT_TYPE type, Vector3 targetPoint, float timeDelay = 0) { yield return(new WaitForSeconds(timeDelay)); switch (type) { case INST_EFFECT_TYPE.CANNON: GameObject cannon = UtilFunction.ResourceLoadOnPosition(CANNON_PREFAB_PATH, _cannonPoint.transform.position, _cannonPoint.transform.rotation); cannon.transform.LookAt(targetPoint); break; case INST_EFFECT_TYPE.BLAST_WAVE: GameObject blastWave = UtilFunction.ResourceLoadOnPosition(BLAST_WAVE_PREFAB_PATH, _cannonPoint.transform.position, _cannonPoint.transform.rotation); blastWave.transform.LookAt(targetPoint); break; } }
IEnumerator DelayInstEffect(INST_EFFECT_TYPE type, Vector3 targetPoint, float timeDelay = 0) { yield return(new WaitForSeconds(timeDelay)); switch (type) { case INST_EFFECT_TYPE.SHOOT: GameObject cannon = UtilFunction.ResourceLoadOnPosition(SHOOT_PREFAB_PATH, _shootPoint.transform.position, _shootPoint.transform.rotation); cannon.transform.LookAt(targetPoint); yield return(new WaitForSeconds(0.2f)); GameObject cannon1 = UtilFunction.ResourceLoadOnPosition(SHOOT_PREFAB_PATH, _shootPoint.transform.position, _shootPoint.transform.rotation); cannon1.transform.LookAt(targetPoint); yield return(new WaitForSeconds(0.2f)); GameObject cannon2 = UtilFunction.ResourceLoadOnPosition(SHOOT_PREFAB_PATH, _shootPoint.transform.position, _shootPoint.transform.rotation); cannon2.transform.LookAt(targetPoint); yield return(new WaitForSeconds(0.2f)); GameObject cannon3 = UtilFunction.ResourceLoadOnPosition(SHOOT_PREFAB_PATH, _shootPoint.transform.position, _shootPoint.transform.rotation); cannon3.transform.LookAt(targetPoint); break; } }
public void PlayEffect(INST_EFFECT_TYPE type, Vector3 targetPoint, float timeDelay = 0) { StartCoroutine(DelayInstEffect(type, targetPoint, timeDelay)); }