示例#1
0
        public Planet(int id, int seed, GraphicsDeviceManager graphics, PlanetTypes planetType, PlanetSizes planetSize)
        {
            Id           = id;
            PlanetType   = planetType;
            PlanetSize   = planetSize;
            ChunksWidth  = PlanetSizeDImensions[(int)planetSize][0];
            ChunksHeight = PlanetSizeDImensions[(int)planetSize][1];
            CellsWidth   = ChunksWidth * CHUNK_WIDTH;
            CellsHeight  = ChunksHeight * CHUNK_HEIGHT;

            noiseGenerator = new NoiseGenerator(planetType, seed, CellsWidth, CellsHeight);

            Map = new Map.Map(id, seed, ChunksWidth, ChunksHeight, noiseGenerator, graphics, planetType);

            List <Vector2> greens = PoissonSample.GeneratePoints(new Random(seed), 15, new Vector2(CellsWidth, CellsHeight));
            List <Vector2> blues  = PoissonSample.GeneratePoints(new Random(seed), 20, new Vector2(CellsWidth, CellsHeight));
            List <Vector2> reds   = PoissonSample.GeneratePoints(new Random(seed), 25, new Vector2(CellsWidth, CellsHeight));

            for (int i = 0; i < greens.Count; i++)
            {
                Structures.Add(new Ore(GetCellAtPosition(greens[i]), Ore.OreTypes.Green));
            }
            for (int i = 0; i < blues.Count; i++)
            {
                Structures.Add(new Ore(GetCellAtPosition(blues[i]), Ore.OreTypes.Blue));
            }
            for (int i = 0; i < reds.Count; i++)
            {
                Structures.Add(new Ore(GetCellAtPosition(reds[i]), Ore.OreTypes.Red));
            }
        }
示例#2
0
        public SolarSystem(int seed, GraphicsDeviceManager graphics, Vector2 position, SolarSystem[] connections, int numbnerOfPlanets)
        {
            Position    = position;
            Connections = connections;

            Planets = new Planet[numbnerOfPlanets];
            Random random = new Random(seed);

            for (int i = 0; i < numbnerOfPlanets; i++)
            {
                PlanetTypes pt = (PlanetTypes)random.Next(0, 5);
                PlanetSizes ps = (PlanetSizes)random.Next(0, 2);
                Planets[i] = new Planet(i, random.Next(), graphics, pt, ps);
            }
        }
示例#3
0
    void Awake()
    {
        planetName = planetNames[Random.Range(0, planetNames.Length - 1)];
        planetInfo.SetPlanetName(planetName);

        planetSize = PlanetSizes.medium;

        switch (planetSize)
        {
        case PlanetSizes.tiny:
            break;
        case PlanetSizes.small:
            break;
        case PlanetSizes.medium:
            break;
        case PlanetSizes.large:
            break;
        case PlanetSizes.huge:
            break;
        }

        planetWindow = new Window(new Rect(Screen.width / 2 - 400, Screen.height / 2 - 200, 800, 400), 15, planetName);
        planetWindow.AddTab(DrawPlanetWindow, "PLANET");
    }