Exemplo n.º 1
0
        public EffectBase Spawn(EffectsId id, Transform parent)
        {
            var transform = parent.transform;

            return(Spawn(
                       id,
                       parent != null ? transform.position : Vector3.zero,
                       parent != null ? transform.rotation : Quaternion.identity,
                       parent));
        }
Exemplo n.º 2
0
        public EffectBase Spawn(EffectsId id, Vector3 position, Quaternion rotation, Transform parent)
        {
            EffectBase effect = null;

            if (_effectPool == null)
            {
                return(null);
            }

            foreach (var spawnNode in Nodes)
            {
                if (spawnNode.Id != id)
                {
                    continue;
                }

                effect = _effectPool.GetInstance(spawnNode.Prefab);

                if (!effect)
                {
#if UNITY_EDITOR
                    Debug.LogError($"[FactoryFX] null instance: {id}");
#endif
                    continue;
                }

                var transform = effect.transform;

                transform.SetParent(parent, false);
//                transform.parent = parent;

                transform.localScale = Vector3.one;
                transform.position   = position;
                transform.rotation   = rotation;

                effect.Play();

                break;
            }

            return(effect);
        }
Exemplo n.º 3
0
 public T Spawn <T>(EffectsId id, Vector3 position, Transform parent)
 {
     return(Spawn(id, position, Quaternion.identity, parent).GetComponent <T>());
 }
Exemplo n.º 4
0
 public T Spawn <T>(EffectsId id, Vector3 position)
 {
     return(Spawn(id, position, Quaternion.identity, null).GetComponent <T>());
 }
Exemplo n.º 5
0
 public T Spawn <T>(EffectsId id, Transform parent)
 {
     return(Spawn(id, parent).GetComponent <T>());
 }
 public static EffectBase Spawn(this object sender, EffectsId id, Vector3 position, Quaternion rotation)
 {
     return(Factory.Spawn(id, position, rotation, null));
 }
 public static EffectBase Spawn(this object sender, EffectsId id, Transform parent)
 {
     return(Factory.Spawn(id, parent.position, parent.rotation, parent));
 }