Multiple players visible in cell
This commit is contained in:
parent
5434766207
commit
4619844607
2 changed files with 182 additions and 15 deletions
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace Sledgemapper.Shared.Entities
|
||||
{
|
||||
|
@ -22,6 +23,64 @@ namespace Sledgemapper.Shared.Entities
|
|||
|
||||
public class Tile : BaseMapEntity
|
||||
{
|
||||
|
||||
public bool Equals(Tile other)
|
||||
{
|
||||
if (other == null) return false;
|
||||
return (X == other.X && Y == other.Y);
|
||||
}
|
||||
|
||||
public static bool operator ==(Tile a, Tile b)
|
||||
{
|
||||
// If both are null, or both are same instance, return true.
|
||||
if (System.Object.ReferenceEquals(a, b))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// If one is null, but not both, return false.
|
||||
if (((object)a == null) || ((object)b == null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return true if the fields match:
|
||||
return a.X == b.X && a.Y == b.Y;
|
||||
}
|
||||
|
||||
public static bool operator !=(Tile a, Tile b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
//
|
||||
// See the full list of guidelines at
|
||||
// http://go.microsoft.com/fwlink/?LinkID=85237
|
||||
// and also the guidance for operator== at
|
||||
// http://go.microsoft.com/fwlink/?LinkId=85238
|
||||
//
|
||||
|
||||
if (obj == null || GetType() != obj.GetType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Equals(obj as Tile);
|
||||
}
|
||||
|
||||
// override object.GetHashCode
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
int hash = 13;
|
||||
hash = (hash * 7) + X + Y;
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Line : BaseMapEntity
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue