-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTypes.cs
More file actions
52 lines (51 loc) · 1.29 KB
/
Types.cs
File metadata and controls
52 lines (51 loc) · 1.29 KB
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
using System;
namespace simplegame
{
class Map
{
public readonly int Width;
public readonly int Height;
public readonly Tile[,] Tiles;
public Map(int width = 25, int height = 25)
{
Width = width;
Height = height;
Tiles = new Tile[Width,Height];
for(int x=0; x < Width; x++)
{
for(int y=0; y < Width; y++)
{
Tiles[x,y] = new Tile();
}
}
}
}
class Tile
{
public int DefenseBonus{ get; private set; }
private int[] BonusTable = new int[]{ 10, 25, 50, 100 };
public Tile()
{
DefenseBonus = BonusTable[(new Random()).Next(0,BonusTable.Length)];
}
}
class Player
{
public int X;
public int Y;
public int Attack;
public int Defense;
public readonly string Name;
public IAI AI;
public Player(string name, int x, int y, int attack = 1, int defense = 1, IAI ai = null)
{
Name = name;
X = x;
Y = y;
Attack = attack;
Defense = defense;
if (ai == null) { AI = new SimpleAI(); }
else { AI = ai; }
}
}
}