-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameEntity.cs
executable file
·134 lines (110 loc) · 3.53 KB
/
GameEntity.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using LunchHourGames.Inventory.Weapons;
using LunchHourGames.Sprite;
using LunchHourGames.Combat.Attacks;
namespace LunchHourGames
{
public abstract class GameEntity : Microsoft.Xna.Framework.DrawableGameComponent
{
public enum EntityType
{
Player, // Human, Zombie, or Animal
Obstacle, // Tree, wall, barrel
Inventory, // Gun, Bullets, Food, Water, MedPack, Gas, Oil, Hammer, Flashlight, Matches, etc...
Vehicle, // Car, Van, Truck, Tank
}
protected EntityType entityType;
protected LunchHourGames lhg;
protected String referenceName;
protected String displayName;
protected Matrix world, view, projection;
public GameEntity(LunchHourGames lhg, EntityType entityType, String referenceName, String displayName)
: base(lhg)
{
this.entityType = entityType;
this.lhg = lhg;
this.referenceName = referenceName;
this.displayName = displayName;
}
public String MyReferenceName
{
get { return this.referenceName; }
}
public String MyDisplayName
{
get { return this.displayName; }
}
public EntityType MyEntityType
{
get { return this.entityType; }
}
public string printType()
{
switch (this.entityType)
{
case EntityType.Player:
return "Player";
case EntityType.Obstacle:
return "Obstacle";
case EntityType.Inventory:
return "Inventory";
case EntityType.Vehicle:
return "Vehicle";
}
return "Unkown";
}
public virtual void setGraphicsMatrices(Matrix view, Matrix projection, Matrix world)
{
this.view = view;
this.projection = projection;
this.world = world;
}
public virtual Matrix MyView
{
set { this.view = value; }
get { return view; }
}
public virtual Matrix MyProjection
{
set { this.projection = value; }
get { return this.projection; }
}
public virtual Matrix MyWorld
{
set { this.world = value; }
get { return this.world; }
}
public virtual Rectangle getExtents()
{
return Rectangle.Empty;
}
public virtual bool canMainPlayerWalkTo()
{
return false;
}
public virtual bool canMainPlayerAttack(Weapon weapon)
{
return false;
}
public virtual void walk(List<Vector3> path, AnimationCallback callback)
{
}
public virtual void attack(AttackType attackType, AnimationCallback callback)
{
}
public virtual void hit(Ammo ammo, AnimationCallback callback)
{
}
public virtual void die(AnimationCallback callback)
{
}
}
}