]> Dogcows Code - chaz/carfire/blob - CarFire/CarFire/CarFire/Melee.cs
git-svn-id: https://bd85.net/svn/cs3505_group@141 92bb83a3-7c8f-8a45-bc97-515c4e399668
[chaz/carfire] / CarFire / CarFire / CarFire / Melee.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using Microsoft.Xna.Framework;
6 using Microsoft.Xna.Framework.Content;
7 using Microsoft.Xna.Framework.Graphics;
8 using Microsoft.Xna.Framework.Input;
9
10 namespace CarFire
11 {
12 public class Melee : Player
13 {
14 #region Member Variables
15 const int hitCoolDown = 18;
16 const int baseHealth = 200;
17 const int baseDamage = 30;
18 int coolDown;
19 Texture2D charModel;
20 Texture2D projectileModel;
21 #endregion
22
23 #region Public Methods
24 public Melee(Game theGame, String Name, Point position, int playerIndex)
25 : base(theGame, Name, position, playerIndex, baseHealth, baseDamage)
26 {
27 coolDown = hitCoolDown;
28 }
29 #endregion
30
31 #region Overridden Methods From Player
32 public override void LoadContent(ContentManager contentManager)
33 {
34 charModel = contentManager.Load<Texture2D>("cs"); //change to charModel when designed
35 projectileModel = contentManager.Load<Texture2D>("projectile"); //change to a projectile model later
36
37 }
38 /// <summary>
39 /// This method will draw a character to the screen.
40 /// </summary>
41 /// <param name="spriteBatch"></param>
42 public override void Draw(SpriteBatch spriteBatch)
43 {
44 Rectangle position = Game.State.Map.GetRectangleFromCoordinates(Motion.Position);
45 spriteBatch.Draw(charModel, position, Color.White);
46 }
47
48 public override void Attack(List<Keys> keysPressed)
49 {
50 if (coolDown > 0)
51 coolDown--;
52 else if (coolDown == 0)
53 {
54 if (keysPressed.Contains<Keys>(Keys.Space))
55 {
56 int startX = Coordinates.X;
57 int startY = Coordinates.Y;
58 if (Motion.Direction == Direction.Down || Motion.Direction == Direction.LowerLeft || Motion.Direction == Direction.LowerRight)
59 {
60 velocityY = 1;
61 startY = Coordinates.Y + 1;
62 }
63 else if (Motion.Direction == Direction.Up || Motion.Direction == Direction.UpperLeft || Motion.Direction == Direction.UpperRight)
64 {
65 velocityY = -1;
66 startY = Coordinates.Y - 1;
67 }
68 if (Motion.Direction == Direction.Right || Motion.Direction == Direction.LowerRight || Motion.Direction == Direction.UpperRight)
69 {
70 velocityX = 1;
71 startX = Coordinates.X + 1;
72 }
73 else if (Motion.Direction == Direction.Left || Motion.Direction == Direction.LowerLeft || Motion.Direction == Direction.UpperLeft)
74 {
75 velocityX = -1;
76 startX = Coordinates.X - 1;
77 }
78 //Attack a monster
79 if (!Game.IsCellOpen(new Point(startX, startY)))
80 {
81 foreach (IEntity entity in Game.State.Entities)
82 {
83 //See if it is a monster
84
85 //Damage the monster
86
87 }
88 }
89 }
90 }
91
92
93 }
94 public override void PlayAttackSound()
95 {
96
97 }
98 public override void PlayDieSound()
99 {
100
101 }
102 #endregion
103 }
104 }
This page took 0.034321 seconds and 5 git commands to generate.