Exemplo n.º 1
0
        //TODO: ENUM!!!!!!!! (albo XML)
        /// <summary>
        /// Deprecated
        /// </summary>
        /// <param name="gameObject"></param>
        /// <param name="name"></param>
        private void AddEffectToAnObject(GameObject gameObject, string name)
        {
            IObjectEffect gameEffect;
            if (name == "water")
                gameEffect = new WaterEffect(gameObject,MainGame);
            else if(name=="fire")
            {
                gameEffect = new FireEffect(gameObject, MainGame);
                AddEffectToAnObject(gameObject,"smoke");
                gameEffect.IsActive = true;

            }
            else
            {
                 gameEffect = new FireSmokeEffect(gameObject, MainGame);
                 gameEffect.IsActive = true;
            }

            gameObject.EffectList.Add(gameEffect);
        }
Exemplo n.º 2
0
        //TODO: ENUM/plik
        public static IObjectEffect GetEffectByName(string name)
        {
            if(MainGame == null)
            {
                throw new NullReferenceException("EffectFactory was not initialized");
            }

            IObjectEffect gameEffect;
            if (name == "water")
                gameEffect = new WaterEffect(MainGame);
            else if (name == "fire")
            {
                gameEffect = new FireEffect(MainGame);
                gameEffect.IsActive = true;
            }
            else
            {
                gameEffect = new FireSmokeEffect(MainGame);
                gameEffect.IsActive = true;
            }

            return gameEffect;
        }