From 2cac9a9203ddbff1cf653c9be266ef8d9007afc3 Mon Sep 17 00:00:00 2001 From: Daniel Herrmann Date: Thu, 3 Apr 2014 10:17:40 +0200 Subject: [PATCH] Main in separater Klasse. Neue Klassen: Map, Tile, Player, Dragon --- Dragon.cs | 89 +++++++++++++++++++++++++++++++++++++++++++ Map.cs | 28 ++++++++++++++ Player.cs | 89 +++++++++++++++++++++++++++++++++++++++++++ Start.cs | 14 +++++++ Tile.cs | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 331 insertions(+) create mode 100644 Dragon.cs create mode 100644 Map.cs create mode 100644 Player.cs create mode 100644 Start.cs create mode 100644 Tile.cs diff --git a/Dragon.cs b/Dragon.cs new file mode 100644 index 0000000..7316de7 --- /dev/null +++ b/Dragon.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + + public class Dragon + { + public int id; + public int posX; + public int posY; + public int points; + public string type; + public bool busy; + + public Dragon(int id, int posX, int posY, int points, string type, bool busy) + { + this.setId(id); + this.setPosX(posX); + this.setPosY(posY); + this.setPoints(points); + this.setType(type); + this.setBusy(busy); + } + + + public void setId(int id) + { + this.id = id; + } + + public int getId() + { + return id; + } + + public void setPosX(int x) + { + this.posX = x; + } + + public int getPosX() + { + return posX; + } + + public void setPosY(int y) + { + this.posY = y; + } + + public int getPosY() + { + return posY; + } + + public void setPoints(int points) + { + this.points = points; + } + + public int getPoints() + { + return points; + } + + public void setType(string type) + { + this.type = type; + } + + public string getType() + { + return type; + } + + public void setBusy(bool busy) + { + this.busy = busy; + } + + public bool getBusy() + { + return busy; + } + + } + diff --git a/Map.cs b/Map.cs new file mode 100644 index 0000000..9149742 --- /dev/null +++ b/Map.cs @@ -0,0 +1,28 @@ +using System; + + + + public class Map + { + public Tile[,] map; + + public Map(int height, int width) + { + map = new Tile[height, width]; + } + + public void setTile(Tile t) + { + int x= t.getX(); + int y= t.getY(); + map.SetValue(t, x, y); + } + + public Tile getTile(int x, int y) + { + + return map.GetValue(x,y); + } + + } + diff --git a/Player.cs b/Player.cs new file mode 100644 index 0000000..aa80a0e --- /dev/null +++ b/Player.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + + public class Player + { + public int id; + public int posX; + public int posY; + public int points; + public string type; + public bool busy; + + public Player(int id, int posX, int posY, int points, string type, bool busy) + { + this.setId(id); + this.setPosX(posX); + this.setPosY(posY); + this.setPoints(points); + this.setType(type); + this.setBusy(busy); + } + + + public void setId(int id) + { + this.id = id; + } + + public int getId() + { + return id; + } + + public void setPosX(int x) + { + this.posX = x; + } + + public int getPosX() + { + return posX; + } + + public void setPosY(int y) + { + this.posY = y; + } + + public int getPosY() + { + return posY; + } + + public void setPoints(int points) + { + this.points = points; + } + + public int getPoints() + { + return points; + } + + public void setType(string type) + { + this.type = type; + } + + public string getType() + { + return type; + } + + public void setBusy(bool busy) + { + this.busy = busy; + } + + public bool getBusy() + { + return busy; + } + + } + diff --git a/Start.cs b/Start.cs new file mode 100644 index 0000000..773e5c6 --- /dev/null +++ b/Start.cs @@ -0,0 +1,14 @@ +using System; +using System.Threading; +using System.Net.Sockets; + +public class Start +{ + public static void Main() + { + TcpClient client = new TcpClient("localhost", 9999); + Program program = new Program(client); + program.StartThreads(); + } + +} \ No newline at end of file diff --git a/Tile.cs b/Tile.cs new file mode 100644 index 0000000..d0a4934 --- /dev/null +++ b/Tile.cs @@ -0,0 +1,111 @@ +using System; + + + + class Tile + { + public int x; + public int y; + public Dragon drag; + public Player playr; + public bool isWalkable; + public bool isForest; + public bool isHuntable; + public bool isWater; + + public Tile(int posX, int posY, bool walkable, bool forest, bool huntable, bool water) + { + this.setX(posX); + this.setY(posY); + this.setWalkable(walkable); + this.setForest(forest); + this.setHuntable(huntable); + this.setWater(water); + } + + public void setX(int x) + { + this.x = x; + } + + public int getX() + { + return x; + } + + public void setY(int y) + { + this.y = y; + } + + public int getY() + { + return y; + } + + public void setDragon(Dragon drag) + { + this.drag = drag; + } + + public Dragon getDragon() + { + return drag; + } + + public void setPlayer(Player playr) + { + this.playr = playr; + } + + public Player getPlayer() + { + return playr; + } + + public void setWalkable(bool walkable) + { + this.isWalkable = walkable; + } + + public bool getWalkable() + { + return isWalkable; + } + + public void setForest(bool forest) + { + this.isForest = forest; + } + + public bool getForest() + { + return isForest; + } + + public void setHuntable(bool huntable) + { + this.isHuntable = huntable; + } + + public bool getHuntable() + { + return isHuntable; + } + + public void setWater(bool water) + { + this.isWater = water; + } + + public bool getWater() + { + return isWater; + } + + + + + + } +