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); }
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."); } }
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."); } }
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; }
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; } }
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."); } }