Esempio n. 1
0
        public virtual Projectile SpawnProjectile(Vector2f pos, float direction, float offset, Vector2f?targetPos = null)
        {
            Projectile proj = new Projectile(Game, GetProjectileModel(), this);

            // Position and Velocity
            proj.SetPosition(pos);
            proj.Rotate(direction);

            float angle = offset == 0 ? (float)Utils.ToRadians(direction) : (float)Utils.ToRadians(direction + offset);

            proj.Velocity = new Vector2f((float)Math.Cos(angle) * ProjectileSpeed, (float)Math.Sin(angle) * ProjectileSpeed);

            // Stats
            proj.Damage = Damage;
            proj.SetLifeSpan(ProjectileLifeSpan);
            if (targetPos.HasValue)
            {
                proj.SetTargetPosition(targetPos.Value);
            }
            if (ProjectileRotateSpeed != 0)
            {
                proj.RotateSpeed = ProjectileRotateSpeed * (Utils.RandomInt() == 1 ? 1 : -1);
                proj.Rotate(Utils.RandomInt(0, 359));
            }

            Game.Layer_Other.AddChild(proj);

            return(proj);
        }
Esempio n. 2
0
        protected override void Tick(object source = null, System.Timers.ElapsedEventArgs e = null)
        {
            if (!ReachedBeach && Waypoint.Equals(new Vector2f(-1, -1)))
            {
                // Generate path to Beach
                int      pointCount       = Utils.RandomInt(3, 8);
                float    originalAngle    = (float)Utils.GetAngle(Game.Island.Position, Obj.Position);
                Vector2f destination      = Utils.GetPointInDirection(Game.Island.Position, originalAngle, Game.Island.Radius);
                float    originalDistance = Utils.Distance(Obj.Position, destination);

                Vector2f pos;
                for (int i = 0; i < pointCount; i++)
                {
                    pos = Utils.GetPointInDirection(Obj.Position, (float)(Utils.GetAngle(Obj.Position, destination)), (originalDistance / pointCount) * (i + 1));
                    if (i != pointCount - 1 && (i + 1) % 2 == 0)
                    {
                        pos += Utils.GetPointInDirection(new Vector2f(), originalAngle + (Utils.RandomInt() == 1 ? 90 : -90), Utils.RandomInt(4, 20));
                    }
                    AddWaypointToPath(pos);
                }

                //Debug_ShowWaypoints();
            }

            base.Tick(source, e);
        }
Esempio n. 3
0
        public Ship(Game game)
            : base(game)
        {
            if (Game.GraphicsMode == Game.GRAPHICSMODE_NORMAL)
            {
                Model = Graphics.GetAnimatedSprite(game, "assets/sprites/ship.xml");
            }
            else
            {
                Model        = Graphics.GetSprite("assets/sprites/blueprint/ship.png");
                Model.Scale  = new Vector2f(0.5f, 0.5f);
                Model.Origin = new Vector2f(265, 244);
            }
            AddChild(Model);

            Collision          = new RectangleShape(new Vector2f(265, 105));
            Collision.Position = new Vector2f(-132.5f, -52.5f);

            SpeedMax = 50.0f + Math.Min(0.5f * Game.AIManager.Difficulty, 25.0f);
            Acc      = 200.0f;

            AmountOfInfantry = Utils.RandomInt(12, 18);

            SetAI(new ShipAI(Game));
        }
Esempio n. 4
0
        protected override void OnDeath(dynamic sourceObject = null)
        {
            // Explosions
            Explosion explosion = new Explosion(Game, 100);

            explosion.Position = Position;
            Game.Layer_OtherAbove.AddChild(explosion);

            explosion          = new Explosion(Game, 60);
            explosion.Position = Utils.GetPointInDirection(Position, Rotation, 40);
            Game.Layer_OtherAbove.AddChild(explosion);

            explosion          = new Explosion(Game, 60);
            explosion.Position = Utils.GetPointInDirection(Position, Rotation, -40);
            Game.Layer_OtherAbove.AddChild(explosion);

            // Deploy Rowboats
            if (AmountOfInfantry <= 6 || (AI != null && ((ShipAI)AI).ReachedBeach))
            {
                base.OnDeath((object)sourceObject);
                return;
            }

            int amountOfRowboats = Utils.RandomInt(0, 2);

            for (int i = 0; i < amountOfRowboats; i++)
            {
                Rowboat rowboat = (Rowboat)Game.AIManager.SpawnEnemy(AIManager.TYPE_ROWBOAT, Utils.GetPointInDirection(Position, i == 0 ? 90 : -90, 100));
                rowboat.Rotation = Rotation;
            }

            base.OnDeath((object)sourceObject);
        }
Esempio n. 5
0
        protected override void Tick(object source = null, System.Timers.ElapsedEventArgs e = null)
        {
            // Calculate random path to Hill
            if (Waypoint.Equals(new Vector2f(-1, -1)))
            {
                int      pointCount       = Utils.RandomInt(10, 20);
                float    originalAngle    = (float)Utils.GetAngle(Game.Hill.Position, Obj.Position);
                Vector2f destination      = Utils.GetPointInDirection(Game.Hill.Position, originalAngle, Game.Hill.Radius - 2);
                float    originalDistance = Utils.Distance(Obj.Position, destination);

                Vector2f pos;
                for (int i = 0; i < pointCount; i++)
                {
                    pos = Utils.GetPointInDirection(Obj.Position, (float)(Utils.GetAngle(Obj.Position, destination)), (originalDistance / pointCount) * (i + 1));
                    if (i != pointCount - 1 && (i + 1) % 2 == 0)
                    {
                        pos += Utils.GetPointInDirection(new Vector2f(), originalAngle + (Utils.RandomInt() == 1 ? 90 : -90), Utils.RandomInt(10, 60));
                    }
                    AddWaypointToPath(pos);
                }

                PossibleLandmineAtWaypoint = Utils.RandomInt(0, WaypointPath.Count - 1);

                //Debug_ShowWaypoints();
            }

            base.Tick(source, e);
        }
Esempio n. 6
0
        public WaterRipplePoint(float x, float y)
        {
            Position      = new Vector2f(x, y);
            Origin        = new Vector2f(x, y);
            MoveDirection = new Vector2f(Utils.RandomInt() == 1 ? 1 : -1, Utils.RandomInt() == 1 ? 1 : -1);

            Speed = WaterRipples.MOVE_SPEED;
        }
Esempio n. 7
0
 public void Displace()
 {
     for (int py = 1; py < Points.Count; py++)
     {
         for (int px = 1; px < Points[py].Count; px++)
         {
             Points[py][px].X += Utils.RandomInt(-DISPLACEMENT_MAX, DISPLACEMENT_MAX);
             Points[py][px].Y += Utils.RandomInt(-DISPLACEMENT_MAX, DISPLACEMENT_MAX);
         }
     }
 }
Esempio n. 8
0
        public void EnemyRemoved(object enemy, bool death)
        {
            if (EnemyCount > 0)
            {
                EnemyCount--;
            }
            if (Game.Player == null)
            {
                return;
            }

            if (death)
            {
                int powerupDropChance = 3;

                // Increase Score
                if (enemy is Ship)
                {
                    Game.Player.IncreaseScore(((Ship)enemy).AmountOfInfantry == 0 ? POINTS_SHIP_EMPTY : POINTS_SHIP);
                    powerupDropChance = 2;
                }
                else if (enemy is Infantryman)
                {
                    Game.Player.IncreaseScore(POINTS_INFANTRYMAN);
                    powerupDropChance = 20;
                }
                else if (enemy is Rowboat)
                {
                    Game.Player.IncreaseScore(((Rowboat)enemy).AmountOfInfantry == 0 ? POINTS_ROWBOAT_EMPTY : POINTS_ROWBOAT);
                    powerupDropChance = 3;
                }

                // Powerup drops
                if (Utils.RandomInt(1, powerupDropChance) == 1)
                {
                    PowerupPickup powerup = new PowerupPickup(Game, Utils.RandomInt(1, Powerup.MAX));
                    powerup.Position = ((DisplayObject)enemy).Position;
                    Game.Layer_Objects.AddChild(powerup);
                }
            }

            // Wave Finished
            if (EnemyCount == 0 && !SpawningOverTime)
            {
                Game.Player.StopPowerups();

                Game.UpgradeMenu = new UpgradeMenu(Game);
                Game.Layer_GUI.AddChild(Game.UpgradeMenu);
                Game.UpgradeMenu.Removed += OnUpgradeMenuClosed;
            }
        }
Esempio n. 9
0
        public override void Fire(Vector2f pos, float direction, Vector2f?targetPos = null)
        {
            base.Fire(pos, direction, targetPos);

            // Sound
            if (Utils.RandomInt() == 0)
            {
                ShootSound1.Play();
            }
            else
            {
                ShootSound2.Play();
            }
        }
Esempio n. 10
0
        /// <param name="spawnDelay">In ms. Used to easily allow infantry to gradually move out of a ship.</param>
        /// <param name="ship">The ship this infantry is/will be spawned from (used only if spawnDelay is not 0).</param>
        public Infantryman(Game game, int spawnDelay = 0, Ship ship = null)
            : base(game, null)
        {
            Model = new CircleShape(4, 12);
            if (Game.GraphicsMode == Game.GRAPHICSMODE_NORMAL)
            {
                Model.FillColor        = new Color((byte)Utils.RandomInt(0, 255), (byte)Utils.RandomInt(0, 255), (byte)Utils.RandomInt(0, 255));
                Model.OutlineColor     = new Color(0, 0, 0);
                Model.OutlineThickness = 3;
            }
            else if (Game.GraphicsMode == Game.GRAPHICSMODE_BLUEPRINT)
            {
                Model.FillColor        = new Color(0, 0, 0, 0);
                Model.OutlineColor     = new Color(255, 255, 255);
                Model.OutlineThickness = 2;
            }
            AddChild(Model);
            Origin = new Vector2f(Model.Radius, Model.Radius);

            Collision = Model;

            HealthMax = 4000;
            Health    = HealthMax;

            //SpeedMax = 100.0f;
            //Acc = 400.0f;
            SpeedMax = 10.0f + Math.Min(0.1f * Game.AIManager.Difficulty, 10.0f);
            Acc      = 80.0f;
            Friction = 1000.0f;

            if (spawnDelay == 0)
            {
                SetAI(new InfantrymanAI(Game));
            }
            else
            {
                CanTakeDamage = false;
                Visible       = false;
                if (ship == null)
                {
                    return;
                }
                Ship                      = ship;
                SpawnDelayTimer           = new Timer(spawnDelay);
                SpawnDelayTimer.AutoReset = false;
                SpawnDelayTimer.Elapsed  += OnSpawn;
                SpawnDelayTimer.Start();
            }
        }
Esempio n. 11
0
        private void SpawnOverTimeTimerHandler(Object source = null, ElapsedEventArgs e = null)
        {
            if (Game.Player == null)
            {
                StopSpawnEnemiesOverTime();
                return;
            }
            if (Game.Player.HasPowerup(Powerup.FREEZE_TIME))
            {
                return;
            }

            // Spawn enemy
            Character enemy;

            switch (SpawnOverTimeType)
            {
            case TYPE_SHIP:
            {
                enemy = new Ship(Game);
                int      angle          = Utils.RandomInt(0, 359);
                Vector2f intersectPoint = Utils.RaycastAgainstBounds(Game.Bounds, Game.Center, Utils.GetPointInDirection(Game.Center, angle, Game.Size.X));
                enemy.SetPosition(Utils.GetPointInDirection(intersectPoint, angle, 200));
                break;
            }

            default:
            {
                enemy = new Infantryman(Game);
                enemy.SetPosition(Utils.GetPointInDirection(Game.Island.Position, Utils.RandomInt(0, 359), Game.Island.Radius - 5));
                break;
            }
            }

            enemy.Death += OnEnemyDeath;
            EnemyCount++;
            Game.Layer_Objects.AddChild(enemy);

            SpawnOverTimeCount++;

            if (SpawnOverTimeCount >= SpawnOverTimeAmount)
            {
                // Finish spawning enemies over time
                StopSpawnEnemiesOverTime();
            }
        }
Esempio n. 12
0
        public void OnShipReachedBeach(Ship ship)
        {
            const float gapX = 4;

            for (int i = 0; i < ship.AmountOfInfantry; i++)
            {
                Infantryman enemy = new Infantryman(Game, Utils.RandomInt(0, 5000), ship);
                enemy.SetPosition(Utils.GetPointInDirection(
                                      Game.Island.Position,
                                      (float)Utils.GetAngle(Game.Island.Position, ship.Position) - ((ship.AmountOfInfantry / 2) * gapX) + (i * gapX),
                                      Game.Island.Radius - 5)
                                  );

                enemy.Death += OnEnemyDeath;
                EnemyCount++;
                Game.Layer_Objects.AddChild(enemy);
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Dynamic animation of fading circle waves. Used for having waves approach a circle island and fade out on the shore.
        /// </summary>
        /// <param name="Game"></param>
        /// <param name="Radius">End Radius (ie: the radius of an Island that waves are going into).</param>
        /// <param name="ScaleOverlap">How much waves overlap into the Radius. Between 0-1.</param>
        /// <param name="ScaleMax">The starting scale of incoming waves.</param>
        /// <param name="Thickness"></param>
        /// <param name="PointCount"></param>
        public CircleWaves(Game Game, float Radius, float ScaleOverlap, float ScaleMax, uint Thickness = 4, uint PointCount = 50)
            : base(Game, null)
        {
            this.Radius       = Radius;
            this.ScaleOverlap = ScaleOverlap;
            this.ScaleMax     = ScaleMax;
            this.PointCount   = PointCount;
            this.Thickness    = Thickness;

            Colour = new Color(255, 255, 255);

            Waves              = new List <CircleShape>();
            Reverse            = new List <bool>();
            WaveTimer          = new Timer(Utils.RandomInt(WAVE_FREQUENCY_MIN, WAVE_FREQUENCY_MAX));
            WaveTimer.Elapsed += WaveTimerHandler;
            WaveTimer.Start();

            AddWave();
        }
Esempio n. 14
0
        protected override void OnWaypointReached()
        {
            base.OnWaypointReached();

            // Chance to step on landmine
            PossibleLandmineCount++;
            if (AlreadyAvoidedLandmine || PossibleLandmineCount < PossibleLandmineAtWaypoint)
            {
                return;
            }

            if (Game.Player != null && Game.Player.LandmineExplosionChance != 0 && Utils.RandomInt(1, 100) <= Game.Player.LandmineExplosionChance)
            {
                Explosion explosion = new Explosion(Game, 8);
                explosion.Position = Obj.Position;
                Game.Layer_Other.AddChild(explosion);
                Obj.Damage(Obj.Health, 0, Game.Player);
            }
            AlreadyAvoidedLandmine = true;
        }
Esempio n. 15
0
        public WaterRipples(Game Game, Vector2f Size, int Gap = 90, int LineThickness = 8, Color Colour = default(Color))
        {
            this.Game = Game;
            //Colour = new Color(94, 190, 255, 255);

            // Generate Points
            int GAP_HALF = Gap / 2;
            int yc       = 0;

            for (int py = -GAP_HALF; py < Size.Y + Gap; py += Gap)
            {
                Points.Add(new List <WaterRipplePoint>());
                for (int px = -GAP_HALF; px < Size.X + Gap; px += Gap)
                {
                    WaterRipplePoint p = new WaterRipplePoint(px, py);
                    if (Points[yc].Count != 0)
                    {
                        p.PointLeft = Points[yc][Points[yc].Count - 1];
                    }
                    if (yc != 0)
                    {
                        p.PointAbove = Points[yc - 1][Points[yc].Count];
                    }

                    Points[yc].Add(p);
                }
                yc++;
            }

            // add random additional points
            int yCount = Points.Count;

            for (int py = 1; py < yCount; py++)
            {
                int xCount = Points[py].Count;
                int px;
                for (px = 1; px < xCount; px++)
                {
                    // add random additional points along the y axis (just add them at the end of the current x List)
                    if (Utils.RandomInt(0, 3) == 0)
                    {
                        continue;
                    }

                    WaterRipplePoint pointY = new WaterRipplePoint(Points[py][px].X + (Utils.RandomInt((int)(Gap * 0.1), (int)(Gap * 0.4)) * (Utils.RandomInt() == 1 ? 1 : -1)),
                                                                   Points[py][px].Y + GAP_HALF);
                    pointY.PointAbove = Points[py][px];
                    Points[py].Add(pointY);
                    if (py < Points.Count - 1)
                    {
                        Points[py + 1][px].PointAbove = pointY;
                    }
                }
                for (px = 1; px < xCount; px++)
                {
                    // add random additional points along the x axis
                    if (Utils.RandomInt(0, 3) == 0)
                    {
                        continue;
                    }

                    WaterRipplePoint pointX = new WaterRipplePoint(Points[py][px - 1].X + GAP_HALF,
                                                                   Points[py][px].Y + (Utils.RandomInt((int)(Gap * 0.1), (int)(Gap * 0.4)) * (Utils.RandomInt() == 1 ? 1 : -1)));
                    pointX.PointLeft       = Points[py][px - 1];
                    pointX.MoveDirection.X = Utils.RandomInt() == 1 || px == Points[py].Count - 1 ? Points[py][px - 1].MoveDirection.X : Points[py][px + 1].MoveDirection.X;
                    Points[py].Insert(px, pointX);
                    Points[py][px + 1].PointLeft = Points[py][px];
                    px++;
                    xCount++;
                }
            }

            Displace();

            // Draw
            for (int py = 1; py < Points.Count; py++)
            {
                for (int px = 1; px < Points[py].Count; px++)
                {
                    RectangleShape l;

                    if (Points[py][px].PointLeft != null)
                    {
                        l           = new RectangleShape(new Vector2f(Utils.Distance(Points[py][px].PointLeft.Position, Points[py][px].Position), LineThickness));
                        l.FillColor = Colour;
                        l.Origin    = new Vector2f(0, LineThickness / 2);
                        l.Position  = Points[py][px].Position;
                        l.Rotation  = (float)Utils.GetAngle(Points[py][px].Position, Points[py][px].PointLeft.Position);
                        AddChild(l);
                        Lines.Add(l);
                    }
                    if (Points[py][px].PointAbove != null)
                    {
                        l           = new RectangleShape(new Vector2f(Utils.Distance(Points[py][px].PointAbove.Position, Points[py][px].Position), LineThickness));
                        l.FillColor = Colour;
                        l.Origin    = new Vector2f(0, LineThickness / 2);
                        l.Position  = Points[py][px].Position;
                        l.Rotation  = (float)Utils.GetAngle(Points[py][px].Position, Points[py][px].PointAbove.Position);
                        AddChild(l);
                        Lines.Add(l);
                    }

                    CircleShape corner = new CircleShape(LineThickness / 2);
                    corner.FillColor = Colour;
                    corner.Origin    = new Vector2f(corner.Radius, corner.Radius);
                    corner.Position  = Points[py][px].Position;
                    AddChild(corner);
                    Corners.Add(corner);
                }
            }
        }
Esempio n. 16
0
        private void WaveTimerHandler(Object source, ElapsedEventArgs e)
        {
            WaveTimer.Interval = Utils.RandomInt(WAVE_FREQUENCY_MIN, WAVE_FREQUENCY_MAX);

            AddWave();
        }
Esempio n. 17
0
        protected override void Tick(object source = null, System.Timers.ElapsedEventArgs e = null)
        {
            if (!Waypoint.Equals(new Vector2f(-1, -1)))
            {
                base.Tick(source, e);
                return;
            }

            if (!ReachedBeach)
            {
                // Generate path to Beach
                int      pointCount       = Utils.RandomInt(10, 20);
                float    originalAngle    = (float)Utils.GetAngle(Game.Island.Position, Obj.Position);
                Vector2f destination      = Utils.GetPointInDirection(Game.Island.Position, originalAngle, Game.Island.Radius + 132.5f);
                float    originalDistance = Utils.Distance(Obj.Position, destination);


                Vector2f pos;
                for (int i = 0; i < pointCount; i++)
                {
                    pos = Utils.GetPointInDirection(Obj.Position, (float)(Utils.GetAngle(Obj.Position, destination)), (originalDistance / pointCount) * (i + 1));
                    if (i != pointCount - 1 && (i + 1) % 2 == 0)
                    {
                        pos += Utils.GetPointInDirection(new Vector2f(), originalAngle + (Utils.RandomInt() == 1 ? 90 : -90), Utils.RandomInt(10, 40));
                    }
                    AddWaypointToPath(pos);
                }

                //Debug_ShowWaypoints();
            }
            else if (((Ship)Obj).AmountOfInfantry <= 0)
            {
                // Generate path off screen
                LeavingArea = true;
                Obj.CanMove = false; // Can't move until Ship rotates to first waypoint in path
                if (Obj.Model is AnimatedSprite)
                {
                    Obj.Model.Sprite.Color = new Color(255, 255, 255, 100);
                    if (Obj.FlashOnDamageBright)
                    {
                        Obj.FlashOnDamageOriginalColor = Obj.Model.Color; // just in case the Ship's Colour has already been changed temporarily
                    }
                    Obj.Model.Play();
                }
                else
                {
                    Obj.Model.Color = new Color(255, 255, 255, 100);
                    if (Obj.FlashOnDamageBright)
                    {
                        Obj.FlashOnDamageOriginalColor = Obj.Model.Color; // just in case the Ship's Colour has already been changed temporarily
                    }
                }

                int   pointCount    = Utils.RandomInt(4, 15);
                float originalAngle = (float)Utils.GetAngle(Game.Island.Position, Obj.Position) + (Utils.RandomInt(50, 80) * (Utils.RandomInt() == 1 ? 1 : -1));

                Vector2f intersectPoint   = Utils.RaycastAgainstBounds(Game.Bounds, Game.Center, Utils.GetPointInDirection(Game.Center, originalAngle, Game.Size.X));
                Vector2f destination      = Utils.GetPointInDirection(intersectPoint, originalAngle, 200);
                float    originalDistance = Utils.Distance(Obj.Position, destination);

                Vector2f pos;
                for (int i = 0; i < pointCount; i++)
                {
                    pos = Utils.GetPointInDirection(Obj.Position, (float)(Utils.GetAngle(Obj.Position, destination)), (originalDistance / pointCount) * (i + 1));
                    if (i != pointCount - 1 && (i + 1) % 2 == 0)
                    {
                        pos += Utils.GetPointInDirection(new Vector2f(), originalAngle + (Utils.RandomInt() == 1 ? 90 : -90), Utils.RandomInt(10, 40));
                    }
                    AddWaypointToPath(pos);
                }
            }

            base.Tick(source, e);
        }
Esempio n. 18
0
        /// <param name="radius">If left at -1, will use ExplosionRadius.</param>
        /// <param name="directCall">If true, will not credit kill or activate pick-ups.</param>
        public override void Explode(Vector2f pos, float radius = -1, bool directCall = false)
        {
            if (radius == -1)
            {
                radius = ExplosionRadius;
            }
            // Collision
            bool hitSomething = false;
            int  numChildren  = Game.Layer_Objects.NumChildren;

            for (int i = 0; i < numChildren; i++)
            {
                dynamic obj = Game.Layer_Objects.GetChildAt(i);

                if (obj is PhysicalEntity && !obj.CanTakeDamage)
                {
                    continue;
                }
                if ((!(obj is CollisionEntity) || obj.Collision == null) && !Utils.InCircle(pos, radius, obj.Position)) // Collide with Position if obj is not a CollisionEntity or has no Collision
                {
                    continue;
                }
                if (obj.Collision is CircleShape && !Utils.CircleCircleCollision(pos, radius, obj.Position, obj.Collision.Radius))
                {
                    continue;
                }
                if (obj.Collision is RectangleShape && !Utils.CircleRectangleCollision(pos, radius, obj.Collision, obj.Rotation, obj.Position))
                {
                    continue;
                }

                if (obj is PhysicalEntity)
                {
                    // Damage
                    obj.Damage(Damage, 0, !directCall ? SourceObject : null);
                }
                else if (!directCall && obj is Pickup)
                {
                    // Pickup
                    obj.Activate(SourceObject);
                }

                // Removed?
                if (obj.Parent != Game.Layer_Objects && i <= numChildren - 1)
                {
                    i--;
                    numChildren--;
                }

                hitSomething = true;
            }

            if (hitSomething || Utils.InCircle(Game.Island, pos))
            {
                // Explosion
                Explosion explosion = new Explosion(Game, radius);
                explosion.Position = pos;
                Game.Layer_OtherAbove.AddChild(explosion);

                // Sound
                if (Utils.RandomInt() == 0)
                {
                    ExplosionSound1.Play();
                }
                else
                {
                    ExplosionSound2.Play();
                }
            }
            else
            {
                // Splash
                Explosion explosion = new Explosion(Game, 15);
                explosion.Position = pos;
                Game.Layer_OtherAbove.AddChild(explosion);

                // Sound
                if (Utils.RandomInt() == 0)
                {
                    SplashSound1.Play();
                }
                else
                {
                    SplashSound2.Play();
                }
            }


            if (directCall || Game.Player == null)
            {
                return;
            }
            if (hitSomething)
            {
                Game.Player.IncreaseScoreMultiplier();
            }
            else if (!Game.Player.HasPowerup(Powerup.TRIPLE_CANNON) && !Game.Player.HasPowerup(Powerup.OCTUPLE_CANNON))
            {
                Game.Player.ResetScoreMultiplier();
            }
        }
Esempio n. 19
0
 public int Random()
 {
     return(Utils.RandomInt(Min, Max));
 }