Beispiel #1
0
        public ISprite CreateSprite(string code)
        {
            ISprite sprite;

            terrianDictionary.TryGetValue(code, out Type spriteType);
            if (spriteType != null)
            {
                ConstructorInfo[] constr = new ConstructorInfo[1];
                constr = spriteType.GetConstructors();
                sprite = (ISprite)constr[0].Invoke(new object[] { terrainSpriteSheet });
            }
            else
            {
                sprite = new GoombaLeftSprite(terrainSpriteSheet);
            }


            return(sprite);
        }
        public ISprite CreateSprite(IBlockState state, string id)
        {
            string  stateCode = state.StateCode;
            string  code      = id + stateCode;
            ISprite sprite;

            terrianDictionary.TryGetValue(code, out Type spriteType);
            if (spriteType != null)
            {
                ConstructorInfo[] constr = new ConstructorInfo[1];
                constr = spriteType.GetConstructors();
                sprite = (ISprite)constr[0].Invoke(new object[] { letterSpriteSheet });
            }
            else
            {
                sprite = new GoombaLeftSprite(letterSpriteSheet);
            }


            return(sprite);
        }