コード例 #1
0
        private bool IsSpawnPoint(HashSet <Location> spawns, Location location, MapSize size)
        {
            if (!IsNearBorder(location, size))
            {
                return(spawns.Contains(location.AboveDiagonal(size)));
            }

            if (location.X >= size.X / 2.0)
            {
                return(spawns.Contains(location));
            }

            return(location.AboveDiagonal(size) == location
                ? false
                : spawns.Contains(location.AboveDiagonal(size)));
        }
コード例 #2
0
ファイル: VoronoiMap.cs プロジェクト: FoKycHuK/CVARC
 public TLabel this[Location location]
 {
     get
     {
         return(labels
                .Argmin(kv => kv.Value.ManhattanDistance(location.AboveDiagonal(size)))
                .Key);
     }
 }
コード例 #3
0
 private bool IsNearBorder(Location location, MapSize size)
 {
     return(location.AboveDiagonal(size).ManhattanDistance(Location.Zero) > size.X - 2);
 }