コード例 #1
0
 public static void LazyCreateEffect(EffectCode effectCode, Transform SpawnPoint)
 {
     if (effectCode == EffectCode.None) return;
     LSEffect effect = CreateEffect (effectCode);
     effect.CachedTransform.position = SpawnPoint.position;
     effect.Initialize ();
 }
コード例 #2
0
 public static void LazyCreateEffect(EffectCode effectCode, Vector3 position, Quaternion rotation)
 {
     if (effectCode == EffectCode.None) return;
     LSEffect effect = CreateEffect (effectCode);
     effect.CachedTransform.position = position;
     effect.Initialize ();
 }
コード例 #3
0
 public static LSEffect CreateEffect(EffectCode effectCode)
 {
     LSEffect effect = GenEffect (effectCode, -1);
     EffectActive[effect.ID] = true;
     Effects[effect.ID] = effect;
     return effect;
 }
コード例 #4
0
ファイル: Material.cs プロジェクト: CAMongrel/AlkaronEngine
        private void CreateShader()
        {
            GraphicsLibrary graphicsLibrary = AlkaronCoreGame.Core.GraphicsLibrary;
            EffectCode      effectCode      = GetEffectCode(graphicsLibrary, CodeType.XNAEffect);

            if (effectCode == null)
            {
                Log.Error("Could not load Shader for platform: " + graphicsLibrary + " in Material: " + this.Name);
                return;
            }

            Effect = new Effect(AlkaronCoreGame.Core.GraphicsDevice, effectCode.ByteCode);
        }
コード例 #5
0
        public int Min(EffectCode effectCode, EffectInheritance inherit, byte paramOrder)
        {
            int min = Int32.MaxValue;

            foreach (var e in GetEffects(effectCode, inherit))
            {
                if ((int)e.Value[paramOrder] < min)
                {
                    min = (int)e.Value[paramOrder];
                }
            }
            return(min);
        }
コード例 #6
0
        public int Max(EffectCode effectCode, EffectInheritance inherit, byte paramOrder)
        {
            int max = Int32.MinValue;

            foreach (var e in GetEffects(effectCode, inherit))
            {
                if ((int)e.Value[paramOrder] > max)
                {
                    max = (int)e.Value[paramOrder];
                }
            }
            return(max);
        }
コード例 #7
0
        public List <Effect> GetEffects(EffectCode effectCode, EffectInheritance inherit = EffectInheritance.All)
        {
            var list = new List <Effect>();

            foreach (var tech in technologies)
            {
                list.AddRange(tech.GetEffects(effectCode, inherit, OwnerLocation));
            }
            if ((inherit & EffectInheritance.Upward) == EffectInheritance.Upward)
            {
                if (Parent != null)
                {
                    list.AddRange(Parent.GetEffects(effectCode, EffectInheritance.Upward | EffectInheritance.Self));
                }
            }
            return(list);
        }
コード例 #8
0
        /// <summary>
        /// Called when this effect is first created.
        /// </summary>
        /// <param name="myEffectCode">My effect code.</param>
        public void Setup(EffectCode myEffectCode)
        {
            MyEffectCode     = myEffectCode;
            CachedTransform  = base.transform;
            CachedGameObject = base.gameObject;
            CachedShuriken   = base.gameObject.GetComponent <ParticleSystem>();
            if (CachedShuriken)
            {
                CachedShurikenVals[0] = CachedShuriken.startSpeed;
                CachedShurikenVals[1] = CachedShuriken.startSize;
            }
            if (OnSetup.IsNotNull())
            {
                OnSetup();
            }
            GameObject.DontDestroyOnLoad(CachedGameObject);

            defaultScale = CachedTransform.localScale;
        }
コード例 #9
0
        internal List <Effect> GetEffects(EffectCode effectCode, EffectInheritance inherit, EffectLocation targetLocation)
        {
            var  list        = new List <Effect>();
            bool isSelf      = (inherit & EffectInheritance.Self) == EffectInheritance.Self;
            bool isInvisible = (inherit & EffectInheritance.Invisible) == EffectInheritance.Invisible;

            foreach (var effect in TechBase.Effects)
            {
                if (effect.Id != effectCode)
                {
                    continue;
                }
                if (!CheckLocation(OwnerLocation, effect.Location, targetLocation))
                {
                    continue;
                }

                if (isSelf)
                {
                    if (!effect.IsPrivate)
                    {
                        list.Add(effect);
                    }
                }

                if (!isInvisible)
                {
                    continue;
                }

                if (effect.IsPrivate)
                {
                    list.Add(effect);
                }
            }

            return(list);
        }
コード例 #10
0
 public static GameObject EmitEffect(EffectCode code, Vector3 pos)
 {
     return(Instantiate(Instance.effects[(int)code], pos, Quaternion.identity));
 }
コード例 #11
0
 public static GameObject EmitEffect(EffectCode code)
 {
     return(Instantiate(Instance.effects[(int)code]));
 }
コード例 #12
0
        /// <summary>
        /// Called when this effect is first created.
        /// </summary>
        /// <param name="myEffectCode">My effect code.</param>
        public void Setup(EffectCode myEffectCode)
        {
            MyEffectCode = myEffectCode;
            CachedTransform = base.transform;
            CachedGameObject = base.gameObject;
            CachedShuriken = base.gameObject.GetComponent<ParticleSystem>();
            if(CachedShuriken){
                CachedShurikenVals[0] = CachedShuriken.startSpeed;
                CachedShurikenVals[1] = CachedShuriken.startSize;
            }
            if (OnSetup .IsNotNull ())
                OnSetup ();
            GameObject.DontDestroyOnLoad (CachedGameObject);

            defaultScale = CachedTransform.localScale;
        }
コード例 #13
0
        private static LSEffect GenEffect(EffectCode effectCode, int id = -1)
        {
            FastStack<LSEffect> pool = EffectPool[effectCode];
            LSEffect effect = null;
            if (pool.Count > 0)
            {
                effect = pool.Pop ();
            }
            else {
                Debug.Log (effectCode);
                EffectDataItem dataItem = CodeDataMap[effectCode];
                effect = GameObject.Instantiate<GameObject> (dataItem.Prefab).GetComponent<LSEffect> ();
                effect.Setup (effectCode);
            }

            if (id == -1)
                id = GenerateID ();
            if (effect.Create (id))
            {
                return effect;
            }
            else {
                return GenEffect (effectCode, id);
            }
        }