PalacePal/Pal.Client/Marker.cs

65 lines
1.7 KiB
C#
Raw Normal View History

using ECommons.SplatoonAPI;
using Palace;
using System;
using System.Numerics;
using System.Text.Json.Serialization;
namespace Pal.Client
{
internal class Marker
{
2022-10-25 21:31:35 +00:00
public EType Type { get; set; } = EType.Unknown;
public Vector3 Position { get; set; }
public bool Seen { get; set; } = false;
[JsonIgnore]
public bool RemoteSeen { get; set; } = false;
[JsonIgnore]
2022-10-30 10:02:49 +00:00
public Element? SplatoonElement { get; set; }
2022-10-25 21:31:35 +00:00
public Marker(EType type, Vector3 position)
{
Type = type;
Position = position;
}
public override int GetHashCode()
{
return HashCode.Combine(Type, (int)Position.X, (int)Position.Y, (int)Position.Z);
}
2022-10-30 10:02:49 +00:00
public override bool Equals(object? obj)
{
2022-10-25 21:31:35 +00:00
return obj is Marker otherMarker && Type == otherMarker.Type && (int)Position.X == (int)otherMarker.Position.X && (int)Position.Y == (int)otherMarker.Position.Y && (int)Position.Z == (int)otherMarker.Position.Z;
}
2022-10-30 10:02:49 +00:00
public static bool operator ==(Marker? a, object? b)
2022-10-25 21:31:35 +00:00
{
return Equals(a, b);
}
2022-10-30 10:02:49 +00:00
public static bool operator !=(Marker? a, object? b)
2022-10-25 21:31:35 +00:00
{
return !Equals(a, b);
}
public bool IsPermanent() => Type == EType.Trap || Type == EType.Hoard;
public enum EType
{
Unknown = ObjectType.Unknown,
#region Permanent Markers
Trap = ObjectType.Trap,
Hoard = ObjectType.Hoard,
#endregion
# region Markers that only show up if they're currently visible
SilverCoffer = 100,
#endregion
}
}
}