Ejemplo n.º 1
0
        /// <summary>
        /// Changes the type of star randomly
        /// </summary>
        public void ChangeType()
        {
            CelesObjType newType = (CelesObjType)GM.instance.rnd.Next(0, 10);

            _type = newType;

            SwitchType(newType);
        }
Ejemplo n.º 2
0
 public CelestialObject(CelesObjType type, float mass, float size) : base(new Vector2(1500, 1500))
 {
     _mass      = mass;
     _gravConst = _mass / 40;
     _size      = size;
     SwitchType(type);
     _aMomentum = 0.01f;
     _centrePt  = new Vector2(_tex.Width / 2, _tex.Height / 2);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Changes type of star
        /// </summary>
        /// <param name="type">Type to change to</param>
        public void SwitchType(CelesObjType type)
        {
            switch (type)
            {
            case CelesObjType.OStar:
                _tex = Resources.OStar;
                break;

            case CelesObjType.BStar:
                _tex = Resources.BStar;
                break;

            case CelesObjType.AStar:
                _tex = Resources.AStar;
                break;

            case CelesObjType.FStar:
                _tex = Resources.FStar;
                break;

            case CelesObjType.GStar:
                _tex = Resources.GStar;
                break;

            case CelesObjType.KStar:
                _tex = Resources.KStar;
                break;

            case CelesObjType.MStar:
                _tex = Resources.MStar;
                break;

            case CelesObjType.BlackHole:
                _tex = Resources.BlackHole;
                break;

            case CelesObjType.WhiteDwarf:
                _tex = Resources.WhiteDwarf;
                break;

            case CelesObjType.Alien:
                _tex = Resources.Alien;
                break;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates and adds a star to protosystem
        /// </summary>
        /// <param name="type">Type of star to create</param>
        public ProtoSystem AddStar(CelesObjType type)
        {
            float size = 1.5f, mass = 1f;

            // Create star
            switch (type)
            {
            case CelesObjType.OStar:
                size = (float)GM.instance.rnd.Next(20, 25) / 10;
                mass = (float)GM.instance.rnd.Next(10, 15) / 10;
                break;

            case CelesObjType.BStar:
                size = (float)GM.instance.rnd.Next(13, 17) / 10;
                mass = (float)GM.instance.rnd.Next(8, 13) / 10;
                break;

            case CelesObjType.AStar:
                size = (float)GM.instance.rnd.Next(12, 15) / 10;
                mass = (float)GM.instance.rnd.Next(7, 12) / 10;
                break;

            case CelesObjType.FStar:
                size = (float)GM.instance.rnd.Next(10, 17) / 10;
                mass = (float)GM.instance.rnd.Next(10, 15) / 10;
                break;

            case CelesObjType.GStar:
                size = (float)GM.instance.rnd.Next(10, 15) / 10;
                mass = (float)GM.instance.rnd.Next(10, 15) / 10;
                break;

            case CelesObjType.KStar:
                size = (float)GM.instance.rnd.Next(10, 15) / 10;
                mass = (float)GM.instance.rnd.Next(10, 15) / 10;
                break;

            case CelesObjType.MStar:
                size = (float)GM.instance.rnd.Next(10, 25) / 10;
                mass = (float)GM.instance.rnd.Next(10, 15) / 10;
                break;

            case CelesObjType.BlackHole:
                size = 0.3f;
                mass = (float)GM.instance.rnd.Next(15, 20) / 10;
                break;

            case CelesObjType.WhiteDwarf:
                size = (float)GM.instance.rnd.Next(3, 7) / 10;
                mass = (float)GM.instance.rnd.Next(5, 15) / 10;
                break;

            case CelesObjType.Alien:
                size = 1.2f;
                mass = 0.01f;
                break;
            }

            // Add to system
            _system.Star = _system.CreateGameObject(
                GameObjType.celestialObj,       // Create Star
                type,                           // Type of star
                mass,                           // Mass
                size                            // Size
                ) as CelestialObject;
            return(this);
        }