Main in separater Klasse.
Neue Klassen: Map, Tile, Player, Dragon
This commit is contained in:
89
Dragon.cs
Normal file
89
Dragon.cs
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
28
Map.cs
Normal file
28
Map.cs
Normal file
@@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
89
Player.cs
Normal file
89
Player.cs
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
14
Start.cs
Normal file
14
Start.cs
Normal file
@@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
111
Tile.cs
Normal file
111
Tile.cs
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user