Esempio n. 1
0
 public Galaxy(string name, GalaxyType type, int numberOfStars)
 {
     Name          = name;
     Type          = type;
     NumberOfStars = numberOfStars;
     StarsDict     = new Dictionary <string, Star>();
 }
        private void buttonGalaxyTypeRight_Click(object sender, EventArgs e)
        {
            switch (galaxytype)
            {
            case GalaxyType.Irregular:
                pictureBoxGalaxyType.Image = Properties.Resources.icon_newgame_spiral;
                labelGalaxyType.Text       = "Spiral";
                galaxytype = GalaxyType.Spiral;
                break;

            case GalaxyType.Spiral:
                pictureBoxGalaxyType.Image = Properties.Resources.icon_newgame_sphere;
                labelGalaxyType.Text       = "Elliptical";
                galaxytype = GalaxyType.Eliptical;
                break;

            case GalaxyType.Eliptical:
                pictureBoxGalaxyType.Image = Properties.Resources.icon_newgame_sphere;
                labelGalaxyType.Text       = "Sphere";
                galaxytype = GalaxyType.Sphere;
                break;

            case GalaxyType.Sphere:
                pictureBoxGalaxyType.Image = Properties.Resources.icon_newgame_irregular;
                labelGalaxyType.Text       = "Irregular";
                galaxytype = GalaxyType.Irregular;
                break;
            }
        }
Esempio n. 3
0
        private void onButtonGalaxyTypeRightClick(Base control, EventArgs args)
        {
            switch (galaxytype)
            {
            case GalaxyType.Irregular:
                imageGalaxyType.Image = Properties.Resources.icon_newgame_spiral;
                label.Text            = "Spiral";
                galaxytype            = GalaxyType.Spiral;
                break;

            case GalaxyType.Spiral:
                imageGalaxyType.Image = Properties.Resources.icon_newgame_sphere;
                label.Text            = "Elliptical";
                galaxytype            = GalaxyType.Eliptical;
                break;

            case GalaxyType.Eliptical:
                imageGalaxyType.Image = Properties.Resources.icon_newgame_sphere;
                label.Text            = "Sphere";
                galaxytype            = GalaxyType.Sphere;
                break;

            case GalaxyType.Sphere:
                imageGalaxyType.Image = Properties.Resources.icon_newgame_irregular;
                label.Text            = "Irregular";
                galaxytype            = GalaxyType.Irregular;
                break;
            }
        }
Esempio n. 4
0
 public GalaxyAdded(UniverseId id, GalaxyId galaxyId, string name, GalaxyType type, DateTime dateUtc)
 {
     Id       = id;
     GalaxyId = galaxyId;
     Name     = name;
     Type     = type;
     DateUtc  = dateUtc;
 }
Esempio n. 5
0
        public Galaxy(GalaxyType type, GalaxySize size)
        {
            Type = type;
            Size = size;

            GenerateStarSystems();

            TimeController.Instance.OnTick += OnTick;
        }
Esempio n. 6
0
 public Galaxy(Galaxy g)
 {
     name       = g.name;
     type       = g.type;
     discovered = g.discovered;
     rad        = g.rad;
     thic       = g.thic;
     PhotoFile  = g.photoFile;
 }
Esempio n. 7
0
 public Galaxy(string n, GalaxyType t, DateTime d, double r, double thic, double l)
 {
     Name       = n;
     Type       = t;
     Discovered = d;
     Rad        = r;
     Thic       = thic;
     Luminosity = l;
     PhotoFile  = DefPic;
 }
Esempio n. 8
0
 public Galaxy(string n, GalaxyType t, DateTime d)
 {
     Name       = n;
     Type       = t;
     Discovered = d;
     Rad        = minRad;
     Thic       = minThic;
     Luminosity = minLuminosity;
     PhotoFile  = DefPic;
 }
Esempio n. 9
0
 public Galaxy(object o)
 {
     try
     {
         Galaxy g = o as Galaxy;
         name       = g.name;
         type       = g.type;
         discovered = g.discovered;
         rad        = g.rad;
         thic       = g.thic;
         PhotoFile  = g.photoFile;
     }
     catch { }
 }
        public static GalaxyExample Create(GalaxyType type)
        {
            switch (type)
            {
            case GalaxyType.Smooth:
                return(new SmoothGalaxy());

            case GalaxyType.Features:
                return(new FeaturesGalaxy());

            case GalaxyType.NotAGalaxy:
                return(new NotAGalaxy());

            default:
                throw new Exception("Example model not found.");
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Генерирует новую галактику
        /// </summary>
        /// <param name="galaxyname">Название галактики</param>
        /// <param name="playerName">Имя игрока</param>
        /// <param name="type">Тип галактики</param>
        /// <param name="size">Размер галактики</param>
        /// <param name="starCount">Количество звездных систем</param>
        /// <param name="generateRandomEvent">Возможность появления идеальной планеты</param>
        public void GenerateNew(string galaxyname, GalaxyType type, int size, int starCount, bool generateRandomEvent)
        {
            Time       = 3000.0;//Начальное время 3000 лет нашей эры
            name       = galaxyname;
            galaxyType = type;

            switch (type)
            {
            case GalaxyType.Spiral:    //Генерируем 4 "ветки" спирали
                generate_spiral_galaxy(0.0, size, starCount);
                generate_spiral_galaxy(Math.PI * 10, size, starCount);
                generate_spiral_galaxy(Math.PI * 20, size, starCount);
                generate_spiral_galaxy(Math.PI * 30, size, starCount);
                break;

            case GalaxyType.Eliptical:
                generate_elliptical_galaxy(size, starCount);
                break;

            case GalaxyType.Irregular:
                generate_irregular_galaxy(0, size, starCount);
                generate_irregular_galaxy(Math.PI * 20, size, starCount);
                break;

            case GalaxyType.Sphere:
                generate_sphere_galaxy(size, starCount);
                break;
            }
            //Задаем начальные координаты всех объектов в галактике путем пересчета координат методов Move с начальным временем
            Move(Time);

            //Генерация случайных событий...
            Random rand = new Random((int)DateTime.Now.Ticks);

            if (generateRandomEvent)
            {
                generate_random_events();
            }

            PathFinding.PathFinder.FillDistancesFrom(stars);    //заносим дистанции в массив для дальнейшего поиска пути
        }
        // Called before Added but after Constructor: for saving/loading purposes
        public void Initialise(GalaxyType galaxy)
        {
            GalaxyInfo = galaxy;

            // Parse from loaded JSON
            int systemid = 0;

            foreach (StarSystemType system in galaxy.StarSystems)
            {
                StarPositions.Add(system.Position);
                foreach (int neighbour in system.Neighbours)
                {
                    StarConnections.Add(new Vector2(systemid, neighbour));
                }
                StarOwners.Add(system.Owner);

                systemid++;
            }

            // Run normal initialisation function to create Otter objects
            Initialise();
        }
Esempio n. 13
0
 public AddGalaxy(UniverseId id, string name, GalaxyType type)
 {
     Id   = id;
     Name = name;
     Type = type;
 }
Esempio n. 14
0
    public void GenerateGalaxy(GameData gameData)
    {
        //string _seedS = .ToString ();
        //inputField.text = _seedS;
        //	ssg.GenereateSystemFromStringSeed (_seedS);

        //Random.InitState (Random.Range (0, 1000));
        seed       = gameData.seed;
        galaxyType = gameData.galaxyType;

        Random.InitState(seed);
        //Random.InitState (17);
        //Random.InitState (677);

        //int numberOfSystems = 250;

        //starSystem = new StarSystem[numberOfSystems];
        //systemSeed = new int[numberOfSystems];
        systemPoint = new SystemPointNode[gameData.numberOfSystems];

        for (int i = 0; i < gameData.numberOfSystems; i++)
        {
            //starSystem [i] = new StarSystem ( Random.Range (0, 99999));
            //starSystem [i].seed = Random.Range (0, 99999);
            systemPoint[i] = new SystemPointNode();
            systemPoint [i].numberOfJumpsAway = 0;
        }

        GalaxyGeneration.CreateGalaxy(out starSystem, gameData.numberOfSystems).transform.parent = transform;

        if (gameData.savedGame)
        {
            for (int i = 0; i < gameData.numberOfSystems; i++)
            {
                for (int j = 0; j < starSystem [i].anomaliEventCompleted.Length; j++)
                {
                    starSystem [i].anomaliEventCompleted [j] = gameData.anomaliCompleted [i, j];
                }
            }
        }

        float diskRadius = 250;
        float holeRadius = 150;

        if (gameData.numberOfSystems == 50)
        {
            diskRadius = 100;
            holeRadius = 25;
        }
        else if (gameData.numberOfSystems == 125)
        {
            diskRadius = 200;
            holeRadius = 75;
        }
        else if (gameData.numberOfSystems == 250)
        {
            diskRadius = 250;
            holeRadius = 150;
        }
        else if (gameData.numberOfSystems == 500)
        {
            diskRadius = 400;
            holeRadius = 200;
        }



        foreach (Transform child in transform.GetChild(0).transform)
        {
            switch (galaxyType)
            {
            case GalaxyType.Elliptical:
                child.position = SetSystemPointPosition(diskRadius);
                break;

            case GalaxyType.ring:
                child.position = SetDonutSystemPointPosition(Vector3.zero, diskRadius, holeRadius);
                break;

            case GalaxyType.spiral:

                break;
//
//			default:
//				child.position = SetDonutSystemPointPosition (Vector3.zero, 250, 150);
//				break;
            }
        }



        for (int s = 0; s < systemPoint.Length; s++)
        {
            systemPoint [s].SetPosition(transform.GetChild(0).GetChild(s).position);
        }

        systemPoint [0].SetConectedToZero(true);

        //		for (int s = 0; s < systemPoint.Length; s++) {
        //
        //			FindConnections (s);
        //
        //		}
        for (int s = 0; s < systemPoint.Length; s++)
        {
            //if (systemPoint [s].conectedToZero) {
            FindSecondaryConnections();
            //}
        }

        //		for (int s = 0; s < systemPoint.Length; s++) {
        //			//if (systemPoint [s].conectedToZero) {
        //			FindThirdConnections (s);
        //			//}
        //		}
        for (int s = 0; s < systemPoint.Length; s++)
        {
            ConnectSystems(s).transform.parent = transform.GetChild(0).GetChild(s);
        }



        GenerateSystem(starSystem [gameData.startingSystem], true);
        currentSystem = gameData.startingSystem;

        transform.GetChild(0).gameObject.SetActive(false);
        //currentSystemObject.transform.parent = transform.GetChild (0);
        //currentSystemObject.transform.position = systemPoint [gameData.startingSystem].position;
    }