private void Awake()
        {
            Instance = this;

            InitializeSpellType(SpellType.LIGHTNING, ResourceRegistry.LightningEffectPrefab);
            InitializeSpellType(SpellType.RAIN, ResourceRegistry.RainEffectPrefab);
        }
        private IEnumerator DeactiveSelfDelayed(GameObject visual, SpellType spellType, float duration)
        {
            yield return(new WaitForSeconds(duration));

            visual.SetActive(false);
            SpellsVisualizerPool.ReturnSpellObject(spellType, visual);
        }
Esempio n. 3
0
 private void OnComponentUpdated(Spells.Update update)
 {
     for (var i = 0; i < update.spellAnimationEvent.Count; i++)
     {
         SpellsVisualizerPool.ShowSpellEffect(update.spellAnimationEvent[i].position.ToVector3(), update.spellAnimationEvent[i].spellType);
     }
 }
        private void PlaySpellEffect(SpellType spellType, Vector3 position)
        {
            var visual = SpellsVisualizerPool.GetSpellObject(spellType);

            visual.transform.position = position;

            if (spellType.Equals(SpellType.RAIN))
            {
                visual.transform.position = position + Vector3.up * SimulationSettings.RainCloudSpawnHeight;
            }

            visual.SetActive(true);
            StartCoroutine(DeactiveSelfDelayed(visual, spellType, SimulationSettings.SpellEffectDuration));
        }