Beispiel #1
0
        public CustomSpriterAnimator(
            SpriterEntity entity,
            IProviderFactory <ISprite, SoundEffect> providerFactory = null,
            Stack <SpriteDrawInfo> drawInfoPool = null
            ) : base(entity, providerFactory, drawInfoPool)
        {
            _providerFactory = providerFactory;
            _drawInfoPool    = drawInfoPool;

            _hiddenTextures = new List <string>();
            _textureSwapMap = new Dictionary <string, Texture2D>();
            _pointTexture   = new TextureSprite(TextureUtil.CreateCircle(XmasHell.Instance().GraphicsDevice, 1, Color.Cyan));

            if (entity.ObjectInfos != null)
            {
                foreach (SpriterObjectInfo objInfo in entity.ObjectInfos)
                {
                    if (objInfo.ObjectType != SpriterObjectType.Box)
                    {
                        continue;
                    }
                    _boxTextures[objInfo.Name] = new TextureSprite(TextureUtil.CreateRectangle(XmasHell.Instance().GraphicsDevice, (int)objInfo.Width, (int)objInfo.Height, Color.Cyan));
                }
            }
        }
Beispiel #2
0
 public static void PlayRandomSound(List <SoundEffect> sounds)
 {
     sounds[XmasHell.Instance().GameManager.Random.Next(0, sounds.Count - 1)].Play();
 }
Beispiel #3
0
 public void ZIndex(int value, Layer?layer = null)
 {
     _ZIndex = value;
     XmasHell.Instance().SpriteBatchManager.SortSpriterAnimator(layer);
 }