Klammersetzung...
This commit is contained in:
@@ -1,45 +1,50 @@
|
|||||||
namespace WorldOfPeacecraft
|
namespace WorldOfPeacecraft
|
||||||
{
|
{
|
||||||
public class Player : Entity, IPlayer
|
public class Player : Entity, IPlayer
|
||||||
{
|
{
|
||||||
private int Score;
|
private int Score;
|
||||||
|
|
||||||
public delegate void LocationChangedEventHandler (int x, int y);
|
public delegate void LocationChangedEventHandler(int x, int y);
|
||||||
public event LocationChangedEventHandler LocationChanged;
|
public event LocationChangedEventHandler LocationChanged;
|
||||||
|
|
||||||
public Player (int id, int posX, int posY, string desc, bool busy, int score) : base(id, posX, posY, desc, busy)
|
public Player(int id, int posX, int posY, string desc, bool busy, int score)
|
||||||
{
|
: base(id, posX, posY, desc, busy)
|
||||||
this.SetScore(score);
|
{
|
||||||
}
|
this.SetScore(score);
|
||||||
|
}
|
||||||
|
|
||||||
public void SetScore(int score)
|
public void SetScore(int score)
|
||||||
{
|
{
|
||||||
this.Score = score;
|
this.Score = score;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetScore ()
|
public int GetScore()
|
||||||
{
|
{
|
||||||
return Score;
|
return Score;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetName ()
|
public string GetName()
|
||||||
{
|
{
|
||||||
return Desc;
|
return Desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetPos (int x, int y)
|
public override void SetPos(int x, int y)
|
||||||
{
|
{
|
||||||
bool positionChanged = false;
|
bool positionChanged = false;
|
||||||
if (x != GetX() || y != GetY ())
|
if (x != GetX() || y != GetY())
|
||||||
positionChanged = true;
|
{
|
||||||
base.SetPos (x, y);
|
positionChanged = true;
|
||||||
if (positionChanged && LocationChanged != null)
|
base.SetPos(x, y);
|
||||||
LocationChanged(x, y);
|
}
|
||||||
}
|
if (positionChanged && LocationChanged != null)
|
||||||
|
{
|
||||||
|
LocationChanged(x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return "Player: " + Id + " " + Coord.X + " " + Coord.Y + " " + Desc + " " + Busy + " " + Score;
|
return "Player: " + Id + " " + Coord.X + " " + Coord.Y + " " + Desc + " " + Busy + " " + Score;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user