Ejemplo n.º 1
0
 public override void TakeCollision(CelestialObj obj)
 {
     if (!(obj is MeteorField))
     {
         GalaxyGame.ExplosionLocations.Add(this.position);
         GalaxyGame.CurrentKeyTime.Add(0);
         parentGame.Components.Remove(this);
         return;
     }
 }
Ejemplo n.º 2
0
 public override void TakeCollision(CelestialObj obj)
 {
     if (obj is Planet)
     {
         ((Planet)obj).StopGrowth(1000);
     }
     else if (obj is SpaceShip)
     {
         parentGame.Components.Remove(obj);
     }
     base.TakeCollision(obj);
 }
Ejemplo n.º 3
0
 public override void TakeCollision(CelestialObj obj)
 {
     if (obj is Asteroid || obj is Star)
     {
         Audio.State = AudioState.ShipDeath;
         parentGame.Components.Remove(this);
     }
     else if (obj is Planet && obj == destination)
     {
         Audio.State = AudioState.ShipLanding;
         destination.LandSpaceShip(this);
     }
     base.TakeCollision(obj);
 }
Ejemplo n.º 4
0
        public bool CheckCollision(CelestialObj obj)
        {
            float   dSqaure        = (float)Math.Pow((this.Origin.X + obj.Origin.X), 2f);
            Vector2 p1             = this.position;
            Vector2 p2             = obj.position;
            float   centerDistance = getDistanceSquare(p1, p2);

            if (centerDistance < dSqaure)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
        public override void TakeCollision(CelestialObj obj)
        {
            if (obj is Asteroid)
            {
                if (planetstate == HabitationState.Uninhabitable)
                {
                    Audio.State = AudioState.CometHitUnHabitablePlanet;
                }
                else
                {
                    Audio.State = AudioState.CometHitHabitablePlanet;
                }

                if (population > 0)
                {
                    StopGrowth(300);
                    population = population - Math.Max((long)(population * 0.3), 1000000000L);
                    if (population <= 0)
                    {
                        population = 0;
                        poppct     = 0;
                        inhabitedPlanets--;
                        if (!homeworld)
                        {
                            planetstate = HabitationState.Colonizable;
                        }
                        else
                        {
                            ChangeTexture(TextureName + "Dead");
                            planetstate = HabitationState.Uninhabitable;
                        }
                        if (inhabitedPlanets <= 0)
                        {
                            ((GalaxyGame)parentGame).EndGame(true);
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
 public virtual void TakeCollision(CelestialObj obj)
 {
 }
Ejemplo n.º 7
0
 public override void TakeCollision(CelestialObj obj)
 {
     base.TakeCollision(obj);
 }