-
Notifications
You must be signed in to change notification settings - Fork 27
/
In Game Object Design.txt
49 lines (38 loc) · 1.19 KB
/
In Game Object Design.txt
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
This document describes a basic design for how to handle objects such as:
structures, creatures, items, floors, roof, resources
Tile data layout:
[0] [1] [2] [3]
[PathBlockingResources] [Roof]
[structureFloor][Structures]
[items] [Living]
abstract class IGameObject
{
abstract bool IsUnwalkable();
//If true the objects should be able to share the same tile space.
abstract bool IsCompatible(IGameObject other);
}
Tile
{
Floor floor;//Floor could be grass, or natural stone
Item item;
Resource resource;//Cannot have a resource and a structure part in the same tile...
StructurePart structurePart;//A structure could have a natural stone floor, or grass for a floor too....
Roof roof;
}
//Structures must have all of their parts interconnected. There must be a part adjacent (left, right, up, down) from each part.
class Structure
{
string name;
Guid ownerID;//Could be playerID, it could be empty if it is unclaimed, or it could be claimed by an AI faction.
Structure(string name, string ownerID, List<StructurePart> parts);
List<StructurePart> Parts;
}
//A part of a structure.
class StructurePart
{
Structure parent;
Guid partID;
int durability;
Point2D location;
bool walkable;
}