ManiaMap.Unity
Procedural generation of metroidvania style maps for Unity.
MapTileKey.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4
6{
10 public struct MapTileKey : IEquatable<MapTileKey>
11 {
15 public long Flags { get; }
16
20 public Color32 Color { get; }
21
27 public MapTileKey(long flags, Color32 color)
28 {
29 Flags = flags;
30 Color = color;
31 }
32
33 public override bool Equals(object obj)
34 {
35 return obj is MapTileKey hash && Equals(hash);
36 }
37
38 public bool Equals(MapTileKey other)
39 {
40 return Flags == other.Flags &&
41 EqualityComparer<Color32>.Default.Equals(Color, other.Color);
42 }
43
44 public override int GetHashCode()
45 {
46 return HashCode.Combine(Flags, Color);
47 }
48
49 public static bool operator ==(MapTileKey left, MapTileKey right)
50 {
51 return left.Equals(right);
52 }
53
54 public static bool operator !=(MapTileKey left, MapTileKey right)
55 {
56 return !(left == right);
57 }
58 }
59}
A structure containing map tile type flags and an associated color.
Definition: MapTileKey.cs:11
MapTileKey(long flags, Color32 color)
Initializes a new object.
Definition: MapTileKey.cs:27