public override int GetHashCode() { unchecked { return((XCoord.GetHashCode() * 397) ^ YCoord.GetHashCode()); } }
public override int GetHashCode() { var hashCode = 269724561; hashCode = hashCode * -1521134295 + XCoord.GetHashCode(); hashCode = hashCode * -1521134295 + YCoord.GetHashCode(); return(hashCode); }
// If Equals() returns true for a pair of objects // then GetHashCode() must return the same value for these objects. public override int GetHashCode() { //Get hash code for the Name field if it is not null. int hashXVal = XCoord.GetHashCode(); int hashYVal = YCoord.GetHashCode(); //Calculate the hash code for the Point return(hashXVal ^ hashYVal); }
public void SendExhibitSpace() { string[] parameters = new string[3]; parameters[0] = XCoord.ToString(); parameters[1] = YCoord.ToString(); parameters[2] = floorid.ToString(); Speaker.Send(Bridge.GetCorrectComandStrings((int)Commands.AddNewExhibitSpace, parameters)); // true/false }
public bool Equals(Node other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(XCoord.Equals(other.XCoord) && YCoord.Equals(other.YCoord)); }
///<summary>Returns a string listing the rovers coordinates and heading /// </summary> public string ReportCoordsAndHeading() { return(XCoord.ToString() + " " + YCoord.ToString() + " " + Enum.GetName(typeof(Heading), this.Heading)); }
public Vec2(XCoord x, YCoord y) { X = x; Y = y; }
public async Task Move(string[] ToXYZ) { dynamic request; var toLocation = Storage.Current.Locations.Find($"{ToXYZ[0]},{ToXYZ[1]},{ToXYZ[2]}"); if (toLocation == null) { toLocation = Location.CreateTempLocation(ToXYZ); var area = toLocation.ConvertToArea(true); request = new { Category = "Events", Type = "AreaCreated", Area = area }; foreach (var player in toLocation.GetNearbyPlayers()) { player.SendString(JSON.Encode(request)); } } // TODO: Check if blocked. var soul = ConvertToSoul(); var currentLocation = GetCurrentLocation(); if (currentLocation == null) { currentLocation = Location.CreateTempLocation(new string[] { XCoord.ToString(), YCoord.ToString(), ZCoord }); var area = currentLocation.ConvertToArea(true); request = new { Category = "Events", Type = "AreaCreated", Area = area }; foreach (var player in currentLocation.GetNearbyPlayers()) { await player.SendString(JSON.Encode(request)); } } MovementState = MovementStates.Moving; var distance = currentLocation.GetDistanceFrom(toLocation); var travelTime = distance * 1000; var nearbyPlayers = currentLocation.GetNearbyPlayers(); foreach (var player in toLocation.GetNearbyPlayers()) { if (!nearbyPlayers.Contains(player)) { nearbyPlayers.Add(player); } } await currentLocation.CharacterLeaves(this); FutureXYZ = toLocation.StorageID; request = JSON.Encode(new { Category = "Events", Type = "PlayerMove", Soul = soul, From = currentLocation.StorageID, To = toLocation.StorageID, TravelTime = travelTime }); foreach (var player in nearbyPlayers) { await player.SendString(request); } await Task.Run(async() => { Thread.Sleep((int)(Math.Round(travelTime))); CurrentXYZ = toLocation.StorageID; FutureXYZ = null; await toLocation.CharacterArrives(this); MovementState = MovementStates.Ready; }); }