public List <GameEffect> InstantiateEffect(GameEffect[] effects)
        {
            if (effects == null || effects.Length == 0)
            {
                return(new List <GameEffect>());
            }
            List <GameEffect> tempAddingEffects = new List <GameEffect>();

            foreach (GameEffect effect in effects)
            {
                if (effect == null)
                {
                    continue;
                }
                if (string.IsNullOrEmpty(effect.effectSocket))
                {
                    continue;
                }
                EffectContainer container;
                if (!CacheEffectContainers.TryGetValue(effect.effectSocket, out container))
                {
                    continue;
                }
                tempGameEffect = effect.InstantiateTo(null);
                tempGameEffect.followingTarget         = container.transform;
                tempGameEffect.CacheTransform.position = tempGameEffect.followingTarget.position;
                tempGameEffect.CacheTransform.rotation = tempGameEffect.followingTarget.rotation;
                tempGameEffect.gameObject.SetActive(true);
                tempGameEffect.gameObject.SetLayerRecursively(gameInstance.characterLayer.LayerIndex, true);
                AddingNewEffect(tempGameEffect);
                tempAddingEffects.Add(tempGameEffect);
            }
            return(tempAddingEffects);
        }
Esempio n. 2
0
        public GameEffect InstantiateTo(Transform parent)
        {
            GameEffect newEffect = Instantiate(this, parent);

            newEffect.transform.localPosition    = Vector3.zero;
            newEffect.transform.localEulerAngles = Vector3.zero;
            newEffect.transform.localScale       = Vector3.one;
            return(newEffect);
        }
 public virtual void AddingNewEffect(GameEffect newEffect)
 {
 }