Ejemplo n.º 1
0
        /// <summary>
        /// Remove animation from database
        /// </summary>
        /// <param name="animation">Animation to remove</param>
        /// <returns>Whether or not the animation was removed</returns>
        public static bool RemoveAnimation(Animation animation)
        {
            // If not contained, do not remove
            if (!animations.ContainsKey(animation.AnimationName))
            {
                return false;
            }

            animations.Remove(animation.AnimationName);

            return true;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Basic Constructor
        /// </summary>
        /// <param name="startingAnimation">Animation to start with</param>
        /// <param name="color">Tint of the sprite</param>
        /// <param name="center">Center of the image</param>
        /// <param name="scale">Scale of the image</param>
        /// <param name="depth">Depth of the image</param>
        public DrawingComponent(Animation startingAnimation, Color color, Vector2 scale, float depth)
        {
            // Specified
            animation = startingAnimation;
            this.color = color;
            this.scale = scale;
            this.depth = depth;

            // Not specified
            isPaused = false;
            currentFrame = 0;
            frameTime = 0;
            frameTimer = 0;
            isAnimationComplete = false;
            spriteEffects = SpriteEffects.None;
            alpha = 1;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds an animation to the database
        /// </summary>
        /// <param name="animation">Animation to add</param>
        /// <returns>Whether or not addition was successful</returns>
        public static bool AddAnimation(Animation animation)
        {
            // If contained already, do not add
            if (animations.ContainsKey(animation.AnimationName))
            {
                return false;
            }

            animations.Add(animation.AnimationName, animation);

            return true;
        }