Ejemplo n.º 1
0
        public void AddShotType(ShotType shot_type)
        {
            if (ContainsShotName(shot_type.Name))
            {
                throw new ArgumentException("Shot to be added has a duplicate name.");
            }

            ShotTypes.Add(shot_type);
        }
Ejemplo n.º 2
0
        public void RemoveAnimationData(string shot_name, int index)
        {
            ShotType shot_type = GetShotTypeByName(shot_name);

            if (shot_type == null)
            {
                throw new ArgumentException("Shot not found.");
            }

            if (shot_type is AnimationShotType a_shot)
            {
                a_shot.Animation.RemoveAnimationFrame(index);
            }
            else
            {
                throw new ArgumentException("Specified shot is not an animation.");
            }
        }
Ejemplo n.º 3
0
        public void SetAnimationFrameDelay(string shot_name, int animation_index, int delay)
        {
            ShotType shot_type = GetShotTypeByName(shot_name);

            if (shot_type == null)
            {
                throw new ArgumentException("Shot Type not found.");
            }

            if (shot_type is AnimationShotType anim_shot)
            {
                anim_shot.Animation.AnimationFrames[animation_index].Delay = delay;
            }
            else
            {
                throw new ArgumentException("Specified Shot Type is not an animation.");
            }
        }
Ejemplo n.º 4
0
        public void RenameShotType(string from, string to)
        {
            ShotType shot_type = GetShotTypeByName(from);

            if (shot_type == null)
            {
                throw new ArgumentException("Shot type name not found.");
            }

            foreach (ShotType st in ShotTypes)
            {
                if (st.Name.Equals(to))
                {
                    throw new ArgumentException("Cannot change name to " + to + ", as a duplicate was found.");
                }
            }

            shot_type.Name = to;
        }
Ejemplo n.º 5
0
        public void RemoveSprite(string name)
        {
            Sprite sprite = GetSpriteByName(name);

            if (sprite == null)
            {
                throw new ArgumentException("Sprite not found.");
            }

            for (int i = 0; i < ShotTypes.Count; i++)
            {
                ShotType shot_type = ShotTypes[i];

                if (shot_type is StillShotType still)
                {
                    if (still.Sprite == sprite)
                    {
                        RemoveShotType(still.Name);
                        i--;
                    }
                }
                else if (shot_type is AnimationShotType anim)
                {
                    anim.RemoveSprite(sprite);
                    if (anim.Animation.Length == 0)
                    {
                        RemoveShotType(anim.Name);
                        i--;
                    }
                }
            }

            Sprites.Remove(sprite);

            if (DelaySprite == sprite)
            {
                DelaySprite = null;
            }
        }
Ejemplo n.º 6
0
        public void AddAnimationFrame(string shot_name, int delay, string sprite_name)
        {
            ShotType shot_type = GetShotTypeByName(shot_name);

            if (shot_type == null)
            {
                throw new ArgumentException("Shot Type not found.");
            }

            if (shot_type is AnimationShotType anim_shot)
            {
                if (anim_shot.Animation.Length == 0)
                {
                    int index = GetShotTypeIndexByName(shot_name);
                }

                anim_shot.Animation.AddAnimationFrame(delay, GetSpriteByName(sprite_name));
            }
            else
            {
                throw new ArgumentException("Specified Shot Type is not an animation.");
            }
        }