コード例 #1
0
        private void refreshCellColor(GeodesicGrid.Cell cell, CelestialBody body, Color32[] colors, KethaneData data)
        {
            var deposit = data.GetCellDeposit(resource.Resource, body, cell);
            var scanned = data.Scans[resource.Resource][body.name][cell];
            var color   = (revealAll ? deposit != null : scanned) ? getDepositColor(resource, deposit) : colorUnknown;

            setCellColor(cell, color, colors);
        }
コード例 #2
0
        private static void setCellColor(GeodesicGrid.Cell cell, Color32 color, Color32[] colors)
        {
            var idx = cell.GetHashCode() * 6;

            for (int i = idx; i < idx + 6; i++)
            {
                colors[i] = color;
            }
        }
コード例 #3
0
        public void RefreshCellColor(GeodesicGrid.Cell cell, CelestialBody body)
        {
            if (body != this.body)
            {
                return;
            }
            var colors = mesh.colors32;

            refreshCellColor(cell, body, colors, KethaneData.Current);
            mesh.colors32 = colors;
        }
コード例 #4
0
ファイル: GeodesicGrid.cs プロジェクト: mspearey/Kethane
 public T this[GeodesicGrid.Cell cell]
 {
     get
     {
         if (!set[cell])
         {
             throw new KeyNotFoundException();
         }
         return(values[cell]);
     }
     set
     {
         set[cell]    = true;
         values[cell] = value;
     }
 }
コード例 #5
0
ファイル: GeodesicGrid.cs プロジェクト: mspearey/Kethane
 public bool this[GeodesicGrid.Cell cell]
 {
     get
     {
         if (cell.grid.Count != set.Length)
         {
             throw new ArgumentException();
         }
         return(set[cell.GetHashCode()]);
     }
     set
     {
         if (cell.grid.Count != set.Length)
         {
             throw new ArgumentException();
         }
         set[cell.GetHashCode()] = value;
     }
 }
コード例 #6
0
        public Deposit GetCellDeposit(string resourceName, CelestialBody body, GeodesicGrid.Cell cell)
        {
            if (resourceName == null || body == null || !PlanetDeposits.ContainsKey(resourceName) || !PlanetDeposits[resourceName].ContainsKey(body.name))
            {
                return(null);
            }

            var pos = cell.Position;
            var lat = (float)(Math.Atan2(pos.y, Math.Sqrt(pos.x * pos.x + pos.z * pos.z)) * 180 / Math.PI);
            var lon = (float)(Math.Atan2(pos.z, pos.x) * 180 / Math.PI);

            var x = lon + 180f;
            var y = 90f - lat;

            foreach (Deposit deposit in PlanetDeposits[resourceName][body.name])
            {
                if (deposit.Shape.PointInPolygon(new Vector2(x, y)))
                {
                    return(deposit);
                }
            }

            return(null);
        }
コード例 #7
0
ファイル: GeodesicGrid.cs プロジェクト: mspearey/Kethane
 public bool ContainsKey(GeodesicGrid.Cell cell)
 {
     return(set[cell]);
 }