Esempio n. 1
0
        public static Animation GetAnimation(MonsterEntity source, string key)
        {
            switch (source.Type)
            {
            case MonsterType.Farmer:
                return(FarmerTextureManager.GetAnimation(source, key));

            case MonsterType.Guard:
                return(GuardTextureManager.GetAnimation(source, key));

            default:
                throw new NotImplementedException();
            }
        }
Esempio n. 2
0
            public Animation Get(MonsterEntity source, int width, int height)
            {
                bool changeX  = DeltaX != 0;
                bool negative = changeX ? DeltaX < 0 : DeltaY < 0;

                return(Animation.CreateFromPhoto
                       (
                           Atlas, source,
                           changeX, negative,
                           width, height,
                           Count, FrameDuration * Count, Count,
                           Flat
                       ));
            }
Esempio n. 3
0
            public static Animation GetAnimation(MonsterEntity source, string key)
            {
                if (!Initialized)
                {
                    throw new InvalidOperationException(NotInitErrorMsg);
                }

                if (Info.ContainsKey(key))
                {
                    return(Info[key].Get(source, (int)Width, (int)Height));
                }
                else
                {
                    throw new KeyNotFoundException($"Couldn't find key: {key}");
                }
            }
Esempio n. 4
0
        public static Texture2D GetImage(MonsterEntity source, string key = "Main")
        {
            if (!Initialized)
            {
                throw new InvalidOperationException(NotInitErrorMsg);
            }

            switch (source.Type)
            {
            case MonsterType.Farmer:
                return(FarmerTextureManager.MainTexture);

            case MonsterType.Guard:
                return(GuardTextureManager.MainTexture);

            default:
                throw new NotImplementedException();
            }
        }
Esempio n. 5
0
            public static Animation GetAnimation(MonsterEntity source, string key)
            {
                if (!Initialized)
                {
                    throw new InvalidOperationException(NotInitializedErrorMsg);
                }
                if (source == null)
                {
                    throw new ArgumentException("Cannot create animation from null");
                }

                if (Info.ContainsKey(key))
                {
                    return(Info[key].Get(source, (int)Width, (int)Height));
                }
                else
                {
                    throw new ArgumentOutOfRangeException($"No such key {key}");
                }
            }