This repository has been archived by the owner on Sep 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEntities.cs
59 lines (51 loc) · 1.48 KB
/
Entities.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
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _3DTest
{
public class EntityType
{
public enum EntityClass { DOOR, DOOR90, BLOCK, SPRITE }
public EntityClass Type;
public bool Transparent;
public List<string> Texture;
public EntityType(EntityClass type, bool transparent, List<string> texture)
{
Type = type;
Transparent = transparent;
Texture = texture;
}
}
public class Entity
{
public string EntityType;
public Vector2 Position;
public Dictionary<string, object> data = new Dictionary<string, object>();
public Entity(string type, Vector2 position)
{
EntityType = type;
Position = position;
}
}
public static class Entities
{
private static Dictionary<string, EntityType> entities = new Dictionary<string, EntityType>();
public static void AddEntity(string ID, EntityType type)
{
if (entities.ContainsKey(ID))
entities[ID] = type;
else entities.Add(ID, type);
}
public static EntityType GetEntity(string ID)
{
return entities[ID];
}
public static Bitmap GetTexture(string ID, int index)
{
return Textures.GetTexture(entities[ID].Texture[index]);
}
}
}