From ced3d03bdb3ce866d832e03fb212865140905a9a Mon Sep 17 00:00:00 2001 From: Thomas Leyh Date: Sun, 24 Jul 2016 08:14:18 +0200 Subject: Add project files. --- V3/Objects/ICreature.cs | 120 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 V3/Objects/ICreature.cs (limited to 'V3/Objects/ICreature.cs') diff --git a/V3/Objects/ICreature.cs b/V3/Objects/ICreature.cs new file mode 100644 index 0000000..891ada7 --- /dev/null +++ b/V3/Objects/ICreature.cs @@ -0,0 +1,120 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using V3.Camera; +using V3.Data; +using V3.Objects.Sprite; + +namespace V3.Objects +{ + /// + /// A moving game object. + /// + public interface ICreature : IGameObject + { + string Name { get; } + Vector2 InitialPosition { set; } + int Life { get; } + int MaxLife { get; } + int Speed { get; } + int Attack { get; } + int AttackRadius { get; } + int SightRadius { get; } + TimeSpan TotalRecovery { get; } + TimeSpan Recovery { get; set; } + /// + /// Area where the creature is standing. Used for collisions. + /// + /// + /// Where you can click to select the creature. + /// + Rectangle SelectionRectangle { get; } + bool IsSelected { get; set; } + ICreature IsAttacking { get; set; } + IBuilding IsAttackingBuilding { get; set; } + MovementDirection MovementDirection { get; set; } + MovementState MovementState { get; set; } + Faction Faction { get; } + bool IsDead { get; } + bool IsUpgraded { get; set; } + + /// + /// Creature takes specific amount of damage. Substracted from Life. + /// + /// TakeDamage taken. + void TakeDamage(int damage); + + /// + /// Give command to move to desired destination. Not instant movement. + /// + /// Destination in pixels. + void Move (Vector2 destination); + + //void ImportentMove(IGameObject creature); + + /// + /// Draws a static non-animated sprite (for HUD) at specified position. + /// + /// Sprite batch used for drawing. + /// Position where to draw the sprite. + void DrawStatic(SpriteBatch spriteBatch, Point position); + + /// + /// Update the creature behaviour and animation. + /// + void Update(GameTime gameTime, ICreature playerCharacter, + bool rightButtonPressed, Vector2 rightButtonPosition, Quadtree quadtree, ICamera camera); + + /// + /// Change the equipment/sprite of the creature to something other. + /// If in debug mode the function throws an exception if the creature does not have the specified equipment slots. + /// + /// Which part of the equipment should be changed. + /// Which sprite to use instead. + void ChangeEquipment(EquipmentType equipmentType, ISpriteCreature sprite); + + /// + /// Sets back the position of the creature to its state when created. + /// + void ResetPosition(); + + /// + /// Plays the specified animation fully, but only once. + /// + /// For which movement state the animation should be played. + /// How long (or how slow) should the animation be? + void PlayAnimationOnce(MovementState animation, TimeSpan duration); + + /// + /// Heals the creature. Can not go over MaxLife. + /// + /// How much HP the creature gains. + void Heal(int amount); + + /// + /// Creature gets more life and maxlife. Used for testing in Techdemo. + /// + /// Multiplyier for Life. + void Empower(int modifier); + + /// + /// Save this creature’s data to a CreatureData object. + /// + /// the CreatureData object with the status of this creature + CreatureData SaveData(); + + /// + /// Restore the creature's state from the given data. + /// + /// the state of the creature to restore + void LoadData(CreatureData data); + + /// + /// Restore the creature's references to other creatures from the given data. + /// + /// the state of the creature to restore + /// the list of all creatures by ID + void LoadReferences(CreatureData data, Dictionary creatures); + } +} -- cgit v1.2.1