Inheritance: MonoBehaviour
 public override void Activate()
 {
     int count = 0;
     while (count < 6)
     {
         int x = 800 * (manager.Map.CurrentRoom.XPos) + rand.Next(800 - ((Tile.WIDTH * 2) - Bomb.WIDTH) + Tile.WIDTH);
         int y = 480 * (manager.Map.CurrentRoom.YPos) + rand.Next(480 - ((Tile.HEIGHT * 2) - Bomb.HEIGHT) + Tile.HEIGHT);
         Rectangle testRect = new Rectangle(x, y, Bomb.WIDTH, Bomb.HEIGHT);
         bool colliding = false;
         foreach (Tile tile in manager.Map.CurrentRoom.SolidTiles)
         {
             if (tile.Rect.Intersects(testRect))
             {
                 colliding = true;
                 break;
             }
         }
         if (!colliding)
         {
             Bomb bomb = new Bomb(new Vector2(x, y),
                 manager, player);
             bomb.CurrentRoom = manager.Map.CurrentRoom;
             manager.AddBomb(bomb);
             count++;
         }
     }
 }
示例#2
0
 void ExlposionApplied(GridCell cell, Bomb bomb, float fatality)
 {
     int f = (int)fatality;
     Text.text = "-" + f;
     transform.position = Camera.main.WorldToScreenPoint(cell.transform.position);
     mAnimator.SetTrigger ("Indicate");
 }
        public void ConstructorSetsCorrectBombProperties()
        {
            var bomb = new Bomb();

            Assert.AreEqual(ContentType.Bomb, bomb.ContentType);
            Assert.AreEqual(-1, bomb.Value);
        }
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            _Bomb = (Bomb)reader.ReadItem();
        }
示例#5
0
 public void Fire(Vector2 position, float angle, Vector2 origin, float scale)
 {
     Bomb b = new Bomb(Entity.StateRef, "Bomb", _xp);
     b.Collision.Partners = Entity.GetComponent<Targets>().List;
     b.Body.Position = position + origin * scale - b.ImageRender.Origin * b.ImageRender.Scale.X;
     b.Body.Angle = angle - angle*_correctionangle;
     b.Physics.Thrust(Thrust);
     Entity.AddEntity(b);
 }
示例#6
0
    public void OnEvent(Bomb.BombTimeUpdatedEvent e)
    {
        // TODO : format string in 00:00:00

        string timeStr =  string.Format("{0:D2}:{1:D2}:{2:D2}",
            (int)(e.bombTime / 60),
            (int)(e.bombTime % 60),
            (int)(e.bombTime * 100 % 100));

        text.text = timeStr;
    }
示例#7
0
 public FireBlock(Bomb b, Point gridPosition)
     : base(gridPosition)
 {
     bomb = b;
     Color = Color.Yellow;
     _texture = YnGraphics.CreateTexture(Color, Rectangle.Width, Rectangle.Height);
     IsPassable = true;
     CanCatchFire = true;
     CanPlaceBomb = false;
     CanFireSpread = true;
     IsDestroyable = false;
 }
示例#8
0
    private void FireWorks_Load(object sender, EventArgs e)
    {
        this.Text = "XML11 - FireWorks";
            this.Width = WINDOW_WIDTH;
            this.Height = WINDOW_HEIGHT;
            this.BackColor = Color.Black;

            bombs = new Bomb[BOMB_COUNT];
            for (int i = 0; i < bombs.Length; ++i)
            {
                bombs[i] = new Bomb(this);
            }

            Timer timer = new Timer();
            timer.Tick += new EventHandler(actionPerformed);
            timer.Interval = 60;
            timer.Enabled = true;
    }
示例#9
0
 //-----------------------------------------------------------------------------
 // Virtual
 //-----------------------------------------------------------------------------
 public override void OnButtonPress()
 {
     if (bombTracker.IsEmpty) {
         if (HasAmmo()) {
             // Conjure a new bomb.
             UseAmmo();
             Bomb bomb = new Bomb();
             bombTracker.TrackEntity(bomb);
             Player.CarryState.SetCarryObject(bomb);
             Player.BeginState(Player.CarryState);
         }
     }
     else {
         // Pickup a bomb from the ground.
         Bomb bomb = bombTracker.GetEntity();
         if (bomb != null && Player.Physics.IsSoftMeetingEntity(bomb)) {
             Player.BeginState(new PlayerCarryState(bomb));
             bomb.RemoveFromRoom();
         }
     }
 }
示例#10
0
	public Transport GetTransportForBomb(Bomb bomb) {
		var maxChance = bomb.Type.ChanceModifier;
		Transport bestForChance = null;
		var maxSpeed = bomb.Type.SpeedModifier;
		Transport bestForSpeed = null;
		foreach (var t in mTransports) {
			if(maxChance * t.ChanceModifier > maxChance) {
				maxChance = maxChance * t.ChanceModifier;
				bestForChance = t;
			}
			if(maxSpeed * t.SpeedModifier > maxSpeed) {
				maxSpeed = maxSpeed * t.SpeedModifier;
				bestForSpeed = t;
			}
		}
		if (!bestForChance)
			bestForChance = DefaultTransport;
		if (!bestForSpeed)
			bestForSpeed = DefaultTransport;
		return bomb.Type.PreferSpeed ? bestForSpeed : bestForChance;
	}
示例#11
0
 private static void testBombsProblem()
 {
     int count = 100;
     BombCenter center = new BombCenter();
     Thread centerFireThread = new Thread(() =>
     {
         Thread.Sleep(100);
         for (int i = 0; i < count; i++)
         {
             center.callBombs();
         }
     });
     centerFireThread.Start();
     List<Bomb> bombs = new List<Bomb>();
     for (int i = 0; i < count; i++)
     {
         Bomb bomb = new Bomb(center);
         bombs.Add(bomb);
         Thread thread = new Thread(() =>
         {
             Thread.Sleep(100);
             bomb.Fire();
         });
         thread.Start();
     }
     while (true)
     {
         Thread.Sleep(100);
         foreach (var bomb in bombs)
         {
             if (!bomb.IsFired)
             {
                 continue;
             }
         }
         break;
     }
 }
示例#12
0
	public void ApplyExplosion(GridCell cell, Bomb bomb) {
		var chance = bomb.ChanceOfSuccess;
		var dice = Random.value;
		if (dice > chance) {
			OnExplosionFailed(cell, bomb);
			return;
		}

		var affections = Game.MapGrid.GetAffections (cell, bomb.Type.Range);

		float totalFatality = 0;
		foreach (var kv in affections) {
			var perc = kv.Key;
			var cells = kv.Value;
			foreach(var curCell in cells) {
				var fatality = bomb.Type.Fatality * perc;
				var population = curCell.Population;
				var actualFatality = Mathf.Lerp (fatality / 2, fatality, (float)population / 10000f);
				totalFatality += actualFatality;
				curCell.Population = Mathf.Clamp (curCell.Population - (int)actualFatality, 0, int.MaxValue);
				var reward = curCell.GetValuePerPerson () * actualFatality;
				Game.PlayerStats.Money += (int)reward;
				
				var heating = new HeatingArea ();
				heating.Position = curCell.Position;
				heating.Range = bomb.Type.Range;
				heating.HeatRate = actualFatality;
				mHeatingAreas.Add (heating);
			}
		}
		
		Instantiate (bomb.Type.ExplosionPrefab, cell.transform.position, Quaternion.identity);
		AudioSource.PlayClipAtPoint (bomb.Type.ExplosionSound, Vector3.zero);

		OnExplosionApplied (cell, bomb, totalFatality);
	}
示例#13
0
 public void PlaceBomb()
 {
     Bomb b = new Bomb (gridPosition);
     b.Player = this;
     if ((bombNumber < bombNumberMax) && engine.BlockManager.PlaceBomb (b)) {
         ++bombNumber;
     }
 }
 public Invertable(Bomb bomb)
     : base(bomb)
 {
 }
示例#15
0
    // Use this for initialization
    void Start()
    {
        motor = GetComponent<CharacterMotor>();

        cameraScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraScript>();

        //Add Sword
        this.gameObject.AddComponent<Sword>();
        swordClass = GetComponent<Sword>();
        //Add Bomb
        this.gameObject.AddComponent<Bomb>();
        bombClass = GetComponent<Bomb>();
        //Add Acid
        this.gameObject.AddComponent<Acid>();
        acidClass = GetComponent<Acid>();
    }
示例#16
0
    // Update is called once per frame
    void Update()
    {
        //if (isGrounded()) time = 0.0f;

        if (time > 0)
        {
            time -= 0.0f * Time.deltaTime;
        }
        else //Explosion creation code happens here!
        {
            //No natural explosion if scatter bombs
            if (attributes.scatter > 0)
            {
                //Scatter bombs
                for (int i = 0; i < attributes.scatter + 1; i++)
                {
                    GameObject miniBomb = Instantiate(gameObject, transform.position, transform.rotation);

                    //Offset newer bombs a little (randomly)
                    miniBomb.transform.position += new Vector3(Random.Range(-5.0f, 5.0f), 0.0f, Random.Range(-5.0f, 5.0f));

                    //Make the mini bomes actually mini
                    miniBomb.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);


                    //Make newer bomb components equal to this bomb
                    Bomb miniBombClass = miniBomb.GetComponent <Bomb>();
                    miniBombClass = miniBomb.GetComponent <Bomb>();

                    miniBombClass.attributes = attributes;

                    miniBombClass.time = 2.0f;
                    miniBombClass.attributes.explosionScaleLimit /= 1.5f;

                    //Make scatter bombs half as strong as normal
                    miniBombClass.attributes.damage /= 2.0f;

                    //Prevent them from inifnitely creating more
                    miniBombClass.attributes.scatter = 0;
                }

                Destroy(gameObject);
                return;
            }


            //Explode! Create an explosion object and destroy self
            GameObject bombExplosion = Instantiate(newExplosion, transform.position, transform.rotation);


            //Modify that explosion based on explosion variables
            ExplosionScale newExplosionClass = bombExplosion.GetComponent <ExplosionScale>();

            newExplosionClass.explosionAttributes = attributes;

            if (First)
            {
                ThrowingPlayer.transform.position            = gameObject.transform.position;
                newExplosionClass.explosionAttributes.damage = 0.0f;
                Renderer rend = bombExplosion.GetComponent <Renderer>();
                rend.material.SetColor("_Color", new Color(1.0f, 1.0f, 1.0f, 0.5f));
                newExplosionClass.firstBomb = true;

                Player p = ThrowingPlayer.GetComponent <Player>();
                p.firstThrow = false;
            }



            Destroy(gameObject);
        }
    }
示例#17
0
 public DiffSpud(Spud <double> values, int lag) : base(values.manager)
 {
     this.lag    = lag;
     this.values = dependsOn(values);
     Bomb.unless(lag >= 1, () => "lag should be >= 1");
 }
    //    private Bomb CreateNewBomb(BombType bombType)
    //    {
    //        GameObject prefab = Resources.Load(BOMB_PREFAB, typeof(GameObject)) as GameObject;
    //        if (prefab != null)
    //        {
    //            GameObject obj = Instantiate(prefab);
    //            obj.transform.parent = BombMgr.Instance.transform;
    //    
    //            mBombSync.CreateNewBomb(obj);
    //
    //            Bomb bomb = obj.GetComponent<Bomb>();
    //            if (bomb != null)
    //            {
    //                mBombList.Add(bomb);
    //                return bomb;
    //            }
    //        }
    //
    //        return null;
    //    }
    public void RemoveBomb(Bomb bomb)
    {
        if (Instance == null)
            CreateInstance();

        if (Instance != null)
        {
            MessageBomb msg = new MessageBomb();
            msg.netId = GetNetId(bomb.gameObject).Value;
            NetworkManager.singleton.client.Send(MessageType.RemoveBomb, msg);
        }
    }
        public void SetInitialPosition(Bomb bomb)
        {
            var position = StartPosition;

            if (bomb.HasPort("rj"))
            {
                while (position.Start != 4)
                {
                    position = position.Next;
                }
                if (position.End == 5)
                {
                    while (StartPosition.Start != 4)
                    {
                        StartPosition = StartPosition.Next;
                    }
                    return;
                }
            }

            position = StartPosition;
            while (position.Start != bomb.GetBatteries() && position.End != 1)
            {
                position = position.Next;
            }
            if (position.End != 1)
            {
                while (StartPosition.Start != bomb.GetBatteries())
                {
                    StartPosition = StartPosition.Next;
                }
                return;
            }

            position = StartPosition;
            var bombNumber = bomb.GetSerialFirstNumberDigit();

            while (position.Start != bombNumber && position.End != 1)
            {
                position = position.Next;
            }
            if (position.End != 1)
            {
                while (StartPosition.Start != bomb.GetBatteries())
                {
                    StartPosition = StartPosition.Next;
                }
                return;
            }

            if (bomb.HasLitIndicator("clr"))
            {
                StartPosition = null;
                return;
            }

            while (StartPosition.Previous.Start < StartPosition.Start)
            {
                StartPosition = StartPosition.Previous;
            }
            ReversedOrder = true;
        }
示例#20
0
        static void Main(string[] args)
        {
            int size = int.Parse(Console.ReadLine());

            int[,] field = new int[size, size];
            for (int i = 0; i < size; i++)
            {
                int[] input = Console.ReadLine()
                              .Split()
                              .Select(int.Parse)
                              .ToArray();
                for (int j = 0; j < size; j++)
                {
                    field[i, j] = input[j];
                }
            }

            int[] BombsPlaces = Console.ReadLine()
                                .Replace(",", " ")
                                .Split()
                                .Select(int.Parse)
                                .ToArray();

            Queue <Bomb> Bombs = new Queue <Bomb>();

            for (int i = 0; i < BombsPlaces.Length - 1; i += 2)
            {
                Bomb currBomb = new Bomb();
                currBomb.row = BombsPlaces[i];
                currBomb.col = BombsPlaces[i + 1];
                Bombs.Enqueue(currBomb);
            }

            while (Bombs.Count > 0)
            {
                Bomb CurrBomb = Bombs.Dequeue();
                if (field[CurrBomb.row, CurrBomb.col] > 0)
                {
                    field = Exploding(field, CurrBomb);
                }
            }

            int aliveCells = 0;
            int sum        = 0;

            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    if (field[i, j] > 0)
                    {
                        aliveCells += 1;
                        sum        += field[i, j];
                    }
                }
            }

            Console.WriteLine("Alive cells: " + aliveCells);
            Console.WriteLine("Sum: " + sum);
            Print(field);
        }
示例#21
0
    //Performs interaction with gameObject based on its tag
    //Executed when player is near interactables and presses "E"
    void Interact(GameObject interactable)
    {
        if (interactable != null)
        {
            //If interactable is a torch, check that we have enough light to activate it and that it is not already lit
            //If all conditions are met, light the torch, reduce lightAmt by cost
            if (interactable.CompareTag("Torch"))
            {
                TorchScript tScript = interactable.GetComponent <TorchScript>();
                if (tScript != null)
                {
                    if (lightAmt > torchCost && !tScript.lit)
                    {
                        tScript.LightTorch();
                        lightAmt -= torchCost;
                    }
                }
            }

            else if (interactable.CompareTag("Campfire"))
            {
                CampfireScript cScript = interactable.GetComponent <CampfireScript>();
                if (cScript != null)
                {
                    if (lightAmt > torchCost && cScript.isLit == false)
                    {
                        cScript.LightCampfire();
                        lightAmt -= torchCost;
                    }
                    else if (lightAmt > torchCost && cScript.isLit == true)
                    {
                        lightAmt             = (lightAmt + cScript.campLightAmt) / 2;
                        cScript.campLightAmt = (lightAmt + cScript.campLightAmt) / 2;
                    }
                }
            }

            //If interactable is a source, give player light from the source and destroy it
            else if (interactable.CompareTag("Source"))
            {
                SourceScript sScript = interactable.GetComponent <SourceScript>();
                if (sScript != null)
                {
                    lightAmt += sScript.lightStored;
                    Destroy(interactable);
                }
            }


            else if (interactable.CompareTag("Bomb"))
            {
                Bomb bomb = interactable.GetComponent <Bomb>();
                if (bomb != null)
                {
                    bomb.Ignite();
                }
            }

            else if (interactable.CompareTag("Zipline"))
            {
                Zipline zScript = interactable.GetComponentInParent <Zipline>();
                if (zScript != null)
                {
                    if (lightAmt > ziplineCost && !zScript.isActive)
                    {
                        zScript.Activate();
                        lightAmt -= ziplineCost;
                    }
                    else
                    {
                        if (zScript.isActive)
                        {
                            Vector3 startAnchor = interactable.transform.position;
                            Vector3 endAnchor;
                            if (interactable.transform == zScript.AnchorA)
                            {
                                endAnchor = zScript.AnchorB.position;
                            }
                            else
                            {
                                endAnchor = zScript.AnchorA.position;
                            }
                            StartCoroutine(UseZipline(startAnchor, endAnchor));
                        }
                    }
                }
            }
        }
    }
示例#22
0
 void ExlposionFailed(GridCell cell, Bomb bomb)
 {
     Text.text = "FAILED";
     transform.position = Camera.main.WorldToScreenPoint(cell.transform.position);
     mAnimator.SetTrigger ("Indicate");
 }
示例#23
0
	public void DestroyBomb(Bomb bomb) {
		DestroyImmediate (bomb.gameObject);
		OnBombDestroyed ();
	}
            public static void readInput(KeyboardState keystate)
            {
                //Read keyboard input
                dir = Vector2.Zero;
                if (firedelay1 >= 0) firedelay1 -= (float)dt;
                if (firedelay2 >= 0) firedelay2 -= (float)dt;
                if (keystate.IsKeyDown(Keys.Left)) dir.X -= moveSpeed;
                if (keystate.IsKeyDown(Keys.Right)) dir.X += moveSpeed;
                if (keystate.IsKeyDown(Keys.Up)) dir.Y -= moveSpeed;
                if (keystate.IsKeyDown(Keys.Down)) dir.Y += moveSpeed;
                if (keystate.IsKeyDown(Keys.LeftShift)) { focused = true; dir /= 2; }
                else focused = false;
                if (status != PlayerStatus.Dead && conversation == null && bomb == null)
                {
                    if (keystate.IsKeyDown(Keys.Z) && firedelay1 < 0)
                    {
                        //Shoot regular bullets at fixed rate based on power when Z is pressed
                        switch (fireamount1)
                        {
                            case 1:
                                pBullets.Add(new Bullet(textures["bullet1"], pos,
                                0.0f, 750.0f, Color.Red, drawType.Directional));
                                break;
                            case 2:
                                pBullets.Add(new Bullet(textures["bullet1"], new Vector2(pos.X - 5, pos.Y),
                                0.0f, 750.0f, Color.Red, drawType.Directional));
                                pBullets.Add(new Bullet(textures["bullet1"], new Vector2(pos.X + 5, pos.Y),
                                0.0f, 750.0f, Color.Red, drawType.Directional));
                                break;
                            case 3:
                                pBullets.Add(new Bullet(textures["bullet1"], pos,
                                -10.0f, 750.0f, Color.Red, drawType.Directional));
                                pBullets.Add(new Bullet(textures["bullet1"], pos,
                                0.0f, 750.0f, Color.Red, drawType.Directional));
                                pBullets.Add(new Bullet(textures["bullet1"], pos,
                                10.0f, 750.0f, Color.Red, drawType.Directional));
                                break;
                            case 4:
                                pBullets.Add(new Bullet(textures["bullet1"], new Vector2(pos.X - 5, pos.Y),
                                0.0f, 750.0f, Color.Red, drawType.Directional));
                                pBullets.Add(new Bullet(textures["bullet1"], new Vector2(pos.X + 5, pos.Y),
                                0.0f, 750.0f, Color.Red, drawType.Directional));
                                pBullets.Add(new Bullet(textures["bullet1"], pos,
                                -10.0f, 750.0f, Color.Red, drawType.Directional));
                                pBullets.Add(new Bullet(textures["bullet1"], pos,
                                10.0f, 750.0f, Color.Red, drawType.Directional));
                                break;
                        }

                        sounds["playershoot"].play();
                        firedelay1 += firerate1;
                    }
                    if (keystate.IsKeyDown(Keys.Z) && firedelay2 < 0)
                    {
                        //Shoot homing bullets at fixed rate based on power when Z is pressed
                        if (fireamount2 >= 1)
                        {
                            pBullets.Add(new Bullet(textures["bullet2"], pos,
                            -30.0f, 750.0f, Color.Blue, drawType.Homing));
                            pBullets.Add(new Bullet(textures["bullet2"], pos,
                            30.0f, 750.0f, Color.Blue, drawType.Homing));
                        }
                        if (fireamount2 >= 2)
                        {
                            pBullets.Add(new Bullet(textures["bullet2"], pos,
                            -50.0f, 750.0f, Color.Blue, drawType.Homing));
                            pBullets.Add(new Bullet(textures["bullet2"], pos,
                            50.0f, 750.0f, Color.Blue, drawType.Homing));
                        }
                        if (fireamount2 >= 3)
                        {
                            pBullets.Add(new Bullet(textures["bullet2"], pos,
                            -70.0f, 750.0f, Color.Blue, drawType.Homing));
                            pBullets.Add(new Bullet(textures["bullet2"], pos,
                            70.0f, 750.0f, Color.Blue, drawType.Homing));
                        }
                        if (fireamount2 >= 4)
                        {
                            pBullets.Add(new Bullet(textures["bullet2"], pos,
                            -90.0f, 750.0f, Color.Blue, drawType.Homing));
                            pBullets.Add(new Bullet(textures["bullet2"], pos,
                            90.0f, 750.0f, Color.Blue, drawType.Homing));
                        }
                        firedelay2 += firerate2;
                    }
                    if (keystate.IsKeyDown(Keys.X) && bombs > 0)
                    {
                        bomb = new Bomb("Spirit Sign", "Fantasy Orb", "reimu", 9.0, 0); bombs--;
                    }
                }
            }
 protected BombDecorator(Bomb bomb)
 {
     this.bomb = bomb;
 }
示例#26
0
 public void Fire(float angle)
 {
     Bomb b = new Bomb(Entity.StateRef, Entity.Body.Position + Entity.Render.Origin * Entity.Render.Scale, angle, Thrust);
     b.Collision.NewPartners = Entity.Collision.Partners;
     Entity.AddEntity(b);
 }
示例#27
0
		public BombCandle( Bomb bomb ) : base( 0x1430, bomb.Name )
		{
			Hue = 1;
			
			_Bomb = bomb;
			
		}
示例#28
0
 public override string Solve(Bomb bomb)
 {
     return("Press " + ColorsToPress(bomb) + ".");
 }
示例#29
0
		public BaddaBoom( Bomb bomb ) : base( 0x1858, "If you can read this, you are probably going to die..." )
		{
			Hue = 1161;
			_Bomb = bomb;
			
		}
示例#30
0
    void UpdateBombs()
    {
        //Enable bomb colliders if player moved from the dropped place
        {
            List <Bomb> enabledBombs = new List <Bomb>();
            for (int i = 0; i < newlyAddedBombs.Count; i++)
            {
                Bomb bomb      = newlyAddedBombs[i];
                bool addToList = (bomb.CurrentState == Bomb.State.Exploded);

                bool enableCollider = true;
                for (int n = 0; n < Players.Length; n++)
                {
                    Player player      = Players[n];
                    int    playerIndex = GetIndex(player.Row, player.Column);
                    float  distance    = Vector3.Distance(player.PlayerT.position, bomb.transform.position);
                    if (bomb.Index == playerIndex || distance < 1.1f)
                    {
                        enableCollider = false;
                        break;
                    }
                }

                if (enableCollider == true)
                {
                    Collider collider = bomb.transform.GetComponent <Collider>();
                    collider.enabled = true;
                    addToList        = true;
                }

                if (addToList == true)
                {
                    enabledBombs.Add(bomb);
                }
            }

            foreach (Bomb bomb in enabledBombs)
            {
                newlyAddedBombs.Remove(bomb);
            }
        }

        List <Bomb> destroyedBombs = new List <Bomb>();

        for (int i = 0; i < activeBombs.Count; i++)
        {
            Bomb bomb = activeBombs[i];
            switch (bomb.CurrentState)
            {
            case Bomb.State.Dropped:
            {
                //PingPong scaling
                float   size  = 1.0f - ((1.0f + Mathf.Sin(bomb.Timer * BombAnimSpeed) / 2.0f) * 0.125f);
                Vector3 scale = Vector3.one * size;
                bomb.transform.localScale = scale;
                bomb.Timer += Time.deltaTime;
                if (bomb.Timer >= BombExplodeTime)
                {
                    CurrentLevelData.LevelMap[bomb.Index] = 0;
                    int[] indexsToCheck = new int[] { 0, -1, 1, -column, column };
                    //parse through all four sides
                    for (int n = 0; n < indexsToCheck.Length; n++)
                    {
                        int incrementer = indexsToCheck[n];
                        int index       = bomb.Index;

                        for (int j = 0; j < bomb.Strength; j++)
                        {
                            index += incrementer;
                            //check index bounds
                            if (index < 0 || index >= CurrentLevelData.LevelMap.Length)
                            {
                                break;
                            }

                            if (CurrentLevelData.LevelMap[index] != 0)
                            {
                                switch ((LevelData.ElementType)CurrentLevelData.LevelMap[index])
                                {
                                case LevelData.ElementType.Brick:
                                {
                                    CurrentLevelData.RemoveMapObjectAt(index);
                                    if (Random.Range(0, 100) <= PickupRevealPct)
                                    {
                                        PickupManager.SpawnRandomPickup(index, GetSpawnPos(index));
                                        CurrentLevelData.LevelMap[index] = (int)LevelData.ElementType.Pickups;
                                    }
                                } break;

                                case LevelData.ElementType.Bomb:
                                {
                                    //Trigger this bomb as well
                                    Bomb triggerBomb = GetBombAt(index);
                                    if (triggerBomb != null)
                                    {
                                        triggerBomb.Timer = BombExplodeTime + 1.0f;
                                    }
                                } break;
                                }
                                break;
                            }

                            bomb.AffectedIndexes.Add(index);
                            SpawnExplosion(bomb, index);
                        }
                    }
                    bomb.CurrentState = Bomb.State.Exploded;
                    bomb.Timer        = 0.0f;
                }
            } break;

            case Bomb.State.Exploded:
            {
                for (int n = 0; n < bomb.AffectedIndexes.Count; n++)
                {
                    int index = bomb.AffectedIndexes[n];
                    for (int p = 0; p < Players.Length; p++)
                    {
                        int playerIndex = GetIndex(Players[p].Row, Players[p].Column);
                        if (index == playerIndex)
                        {
                            AddDeadPlayer(p, bomb.PlayerID);
                        }
                    }
                }

                bomb.Timer += Time.deltaTime;
                if (bomb.Timer >= BombCleanupTime)
                {
                    bomb.CurrentState = Bomb.State.Destroyed;
                    UpdateBombCounter(Players[bomb.PlayerID], 1);
                    CurrentLevelData.RemoveMapObjectAt(bomb.Index);
                    destroyedBombs.Add(bomb);
                }
            } break;
            }
        }

        for (int i = 0; i < destroyedBombs.Count; i++)
        {
            activeBombs.Remove(destroyedBombs[i]);
        }
    }
示例#31
0
        public override void Update(GameTime gametime)
        {
            gt = gametime;
            //time
            time += (float)gametime.ElapsedGameTime.TotalSeconds;

            star.Update(gametime);
            foreach (Enemy enemy in enemies)
            {
                enemy.Update(gametime, hero);
            }

            Enemy removedEnemy = null;
            Coin  removedCoin  = null;

            //gravity
            hero.hasJumped = true;
            foreach (Platform platform in platforms)
            {
                if (hero.rectangle.isOnTopOf(platform.rectangle))
                {
                    hero.velocity.Y = 0f;
                    hero.hasJumped  = false;
                }
            }
            //colisions
            foreach (Enemy enemy in enemies)
            {
                if (hero.rectangle.isOnTopOf(enemy.rectangle))
                {
                    enemy.isPlayerDead = true;
                    hero.velocity.Y    = -5;
                    removedEnemy       = enemy;
                }
                else if (hero.rectangle.Intersects(enemy.rectangle))
                {
                    hero.isPlayerDead = true;
                }
                else if (enemy.isShooting == true)
                {
                    Vector2 heroMidPixPos  = new Vector2((hero.rectangle.Left + hero.rectangle.Right) / 2, (hero.rectangle.Top + hero.rectangle.Bottom) / 2);
                    Vector2 enemyMidPixPos = new Vector2((enemy.rectangle.Left + enemy.rectangle.Right) / 2, (enemy.rectangle.Top + enemy.rectangle.Bottom) / 2);
                    int     distancePow    = (int)((heroMidPixPos.X - enemyMidPixPos.X) * (heroMidPixPos.X - enemyMidPixPos.X) + (heroMidPixPos.Y - enemyMidPixPos.Y) * (heroMidPixPos.Y - enemyMidPixPos.Y));
                    if (enemy.rangeOfSight * enemy.rangeOfSight > distancePow)
                    {
                        if (enemy.timer > 0.75f)
                        {
                            enemy.timer %= 0.75f;
                            Random rand = new Random();
                            int    num  = rand.Next(0, 20);
                            num %= 14;
                            if (num == 0)
                            {
                                bombsList.Add(new Bomb(true, this._content.Load <Texture2D>("Bomb/rock"), this._content.Load <Texture2D>("Bomb/rock"), new Vector2((enemy.rectangle.Left + enemy.rectangle.Right) / 2, (enemy.rectangle.Top + enemy.rectangle.Bottom) / 2), true)
                                {
                                    isTaken = 1
                                });
                            }
                            else if (num < 2)
                            {
                                bombsList.Add(new Bomb(true, this._content.Load <Texture2D>("Bomb/pinkBalloon"), this._content.Load <Texture2D>("Bomb/fire"), new Vector2((enemy.rectangle.Left + enemy.rectangle.Right) / 2, (enemy.rectangle.Top + enemy.rectangle.Bottom) / 2), true)
                                {
                                    isTaken = 1
                                });
                            }
                            else if (num < 3)
                            {
                                bombsList.Add(new Bomb(true, this._content.Load <Texture2D>("Bomb/redBaloon"), this._content.Load <Texture2D>("Bomb/fire"), new Vector2((enemy.rectangle.Left + enemy.rectangle.Right) / 2, (enemy.rectangle.Top + enemy.rectangle.Bottom) / 2), true)
                                {
                                    isTaken = 1
                                });
                            }
                            else if (num < 4)
                            {
                                bombsList.Add(new Bomb(true, this._content.Load <Texture2D>("Bomb/yellowBaloon"), this._content.Load <Texture2D>("Bomb/fire"), new Vector2((enemy.rectangle.Left + enemy.rectangle.Right) / 2, (enemy.rectangle.Top + enemy.rectangle.Bottom) / 2), true)
                                {
                                    isTaken = 1
                                });
                            }
                            else if (num < 7)
                            {
                                bombsList.Add(new Bomb(true, this._content.Load <Texture2D>("Bomb/dynamite"), this._content.Load <Texture2D>("Bomb/exploadedBomb"), new Vector2((enemy.rectangle.Left + enemy.rectangle.Right) / 2, (enemy.rectangle.Top + enemy.rectangle.Bottom) / 2), true)
                                {
                                    isTaken = 1
                                });
                            }
                            else if (num < 10)
                            {
                                bombsList.Add(new Bomb(true, this._content.Load <Texture2D>("Bomb/bomb"), this._content.Load <Texture2D>("Bomb/exploadedBomb"), new Vector2((enemy.rectangle.Left + enemy.rectangle.Right) / 2, (enemy.rectangle.Top + enemy.rectangle.Bottom) / 2), true)
                                {
                                    isTaken = 1
                                });
                            }
                            else
                            {
                                bombsList.Add(new Bomb(true, this._content.Load <Texture2D>("Bomb/molotov"), this._content.Load <Texture2D>("Bomb/fire"), new Vector2((enemy.rectangle.Left + enemy.rectangle.Right) / 2, (enemy.rectangle.Top + enemy.rectangle.Bottom) / 2), true)
                                {
                                    isTaken = 1
                                });
                            }
                        }
                    }
                }
            }

            if (removedEnemy != null)
            {
                enemies.Remove(removedEnemy);
            }

            foreach (Coin coin in coins)
            {
                coin.Update(gametime);
                if (hero.rectangle.Intersects(coin.rectangle))
                {
                    coin.isTaken = true;
                    removedCoin  = coin;
                    if (coin.type == "Gold")
                    {
                        coinsAndHeartsManager.curr.goldCoins += 1;
                    }
                    else if (coin.type == "Silver")
                    {
                        coinsAndHeartsManager.curr.silverCoins += 1;
                    }
                    else if (coin.type == "Bronze")
                    {
                        coinsAndHeartsManager.curr.bronzeCoins += 1;
                    }
                }
            }
            if (removedCoin != null)
            {
                coins.Remove(removedCoin);
            }

            //is touch bombs
            Bomb del = new Bomb(false, null, null, new Vector2(-100, -100));

            foreach (Bomb bomb in bombsList)
            {
                bomb.Update(gametime, hero);
                if (hero.rectangle.Intersects(bomb.rectangle))
                {
                    hero.isPlayerDead = true;
                }
                if (bomb.isDead == true)
                {
                    del = bomb;
                }
            }
            //del bombs
            if (del._position.X != -100 && del._position.Y != -100)
            {
                bombsList.Remove(del);
            }
            bombsList.Remove(del);


            if (hero.rectangle.Intersects(star.rectangle))
            {
                winAction();
            }

            hero.Update(gametime);


            try
            {
                camera.Follow(hero);
                if (hero.isPlayerDead == true)//player.is deed
                {
                    heroDiedAction();
                }
            }
            catch
            { }
        }
示例#32
0
 public void ShowRules(Bomb bomb)
 {
     Console.WriteLine("Regras: \n");
     Console.WriteLine(bomb.ToString());
 }
        public override string Solve(Bomb bomb)
        {
            SetInitialPosition(bomb);

            if (StartPosition == null)
            {
                return("Cut all the wires on descending numeral order.");
            }

            var result = "Cut wires ";
            var letter = bomb.GetSerialCharacters()[0];

            while (!StartPosition.Resolved)
            {
                if (!StartPosition.Previous.Resolved || (ReversedOrder && !StartPosition.Next.Resolved))
                {
                    result += StartPosition.Start + "-" + StartPosition.End + ", ";
                    StartPosition.Resolved    = true;
                    StartPosition.ShouldBeCut = true;
                    if (ReversedOrder)
                    {
                        StartPosition = StartPosition.Previous;
                    }
                    else
                    {
                        StartPosition = StartPosition.Next;
                    }
                    continue;
                }

                switch (letter.ToUpper())
                {
                case "A":
                case "N":
                {
                    if (StartPosition.Previous.Color != "yellow" && StartPosition.Previous.Color != "blue" && StartPosition.Previous.Color != "green")
                    {
                        StartPosition.ShouldBeCut = true;
                        result += StartPosition.Start + "-" + StartPosition.End + ", ";
                    }
                    if (ReversedOrder)
                    {
                        StartPosition = StartPosition.Previous;
                        var number = InternalFunctions.GetNumberFromLetter(letter) - 1;
                        if (number == -1)
                        {
                            number = 26;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    else
                    {
                        StartPosition = StartPosition.Next;
                        var number = InternalFunctions.GetNumberFromLetter(letter) + 1;
                        if (number == 27)
                        {
                            number = 1;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    break;
                }

                case "B":
                case "O":
                {
                    if (StartPosition.Start % 2 == 0)
                    {
                        result += StartPosition.Start + "-" + StartPosition.End + ", ";
                        StartPosition.ShouldBeCut = true;
                    }
                    if (ReversedOrder)
                    {
                        StartPosition = StartPosition.Previous;
                        var number = InternalFunctions.GetNumberFromLetter(letter) - 1;
                        if (number == -1)
                        {
                            number = 26;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    else
                    {
                        StartPosition = StartPosition.Next;
                        var number = InternalFunctions.GetNumberFromLetter(letter) + 1;
                        if (number == 27)
                        {
                            number = 1;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    break;
                }

                case "C":
                case "P":
                {
                    if (StartPosition.Previous.ShouldBeCut)
                    {
                        result += StartPosition.Start + "-" + StartPosition.End + ", ";
                        StartPosition.ShouldBeCut = true;
                    }
                    if (ReversedOrder)
                    {
                        StartPosition = StartPosition.Previous;
                        var number = InternalFunctions.GetNumberFromLetter(letter) - 1;
                        if (number == -1)
                        {
                            number = 26;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    else
                    {
                        StartPosition = StartPosition.Next;
                        var number = InternalFunctions.GetNumberFromLetter(letter) + 1;
                        if (number == 27)
                        {
                            number = 1;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    break;
                }

                case "D":
                case "Q":
                {
                    if (StartPosition.Previous.Color == "red" || StartPosition.Previous.Color == "blue" || StartPosition.Previous.Color == "black")
                    {
                        result += StartPosition.Start + "-" + StartPosition.End + ", ";
                        StartPosition.ShouldBeCut = true;
                    }
                    if (ReversedOrder)
                    {
                        StartPosition = StartPosition.Previous;
                        var number = InternalFunctions.GetNumberFromLetter(letter) - 1;
                        if (number == -1)
                        {
                            number = 26;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    else
                    {
                        StartPosition = StartPosition.Next;
                        var number = InternalFunctions.GetNumberFromLetter(letter) + 1;
                        if (number == 27)
                        {
                            number = 1;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    break;
                }

                case "E":
                case "R":
                {
                    var list = new List <string>();
                    if (!list.Exists(x => x == StartPosition.Previous.Previous.Previous.Color))
                    {
                        list.Add(StartPosition.Previous.Previous.Previous.Color);
                    }
                    if (!list.Exists(x => x == StartPosition.Previous.Previous.Color))
                    {
                        list.Add(StartPosition.Previous.Previous.Color);
                    }
                    if (!list.Exists(x => x == StartPosition.Previous.Color))
                    {
                        list.Add(StartPosition.Previous.Color);
                    }
                    if (list.Count == 2)
                    {
                        result += StartPosition.Start + "-" + StartPosition.End + ", ";
                        StartPosition.ShouldBeCut = true;
                    }
                    if (ReversedOrder)
                    {
                        StartPosition = StartPosition.Previous;
                        var number = InternalFunctions.GetNumberFromLetter(letter) - 1;
                        if (number == -1)
                        {
                            number = 26;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    else
                    {
                        StartPosition = StartPosition.Next;
                        var number = InternalFunctions.GetNumberFromLetter(letter) + 1;
                        if (number == 27)
                        {
                            number = 1;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    break;
                }

                case "F":
                case "S":
                {
                    if ((StartPosition.Previous.Previous.Color == StartPosition.Color && StartPosition.Previous.Color != StartPosition.Color) || (StartPosition.Previous.Color == StartPosition.Color && StartPosition.Previous.Previous.Color != StartPosition.Color))
                    {
                        result += StartPosition.Start + "-" + StartPosition.End + ", ";
                        StartPosition.ShouldBeCut = true;
                    }
                    if (ReversedOrder)
                    {
                        StartPosition = StartPosition.Previous;
                        var number = InternalFunctions.GetNumberFromLetter(letter) - 1;
                        if (number == -1)
                        {
                            number = 26;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    else
                    {
                        StartPosition = StartPosition.Next;
                        var number = InternalFunctions.GetNumberFromLetter(letter) + 1;
                        if (number == 27)
                        {
                            number = 1;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    break;
                }

                case "G":
                case "T":
                {
                    if (StartPosition.Previous.Color == "yellow" || StartPosition.Previous.Color == "white" || StartPosition.Previous.Color == "green")
                    {
                        result += StartPosition.Start + "-" + StartPosition.End + ", ";
                        StartPosition.ShouldBeCut = true;
                    }
                    if (ReversedOrder)
                    {
                        StartPosition = StartPosition.Previous;
                        var number = InternalFunctions.GetNumberFromLetter(letter) - 1;
                        if (number == -1)
                        {
                            number = 26;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    else
                    {
                        StartPosition = StartPosition.Next;
                        var number = InternalFunctions.GetNumberFromLetter(letter) + 1;
                        if (number == 27)
                        {
                            number = 1;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    break;
                }

                case "H":
                case "U":
                {
                    if (!StartPosition.Previous.ShouldBeCut)
                    {
                        result += StartPosition.Start + "-" + StartPosition.End + ", ";
                        StartPosition.ShouldBeCut = true;
                    }
                    if (ReversedOrder)
                    {
                        StartPosition = StartPosition.Previous;
                        var number = InternalFunctions.GetNumberFromLetter(letter) - 1;
                        if (number == -1)
                        {
                            number = 26;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    else
                    {
                        StartPosition = StartPosition.Next;
                        var number = InternalFunctions.GetNumberFromLetter(letter) + 1;
                        if (number == 27)
                        {
                            number = 1;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    break;
                }

                case "I":
                case "V":
                {
                    if (StartPosition.Previous.Start + 1 != StartPosition.Start)
                    {
                        result += StartPosition.Start + "-" + StartPosition.End + ", ";
                        StartPosition.ShouldBeCut = true;
                    }
                    if (ReversedOrder)
                    {
                        StartPosition = StartPosition.Previous;
                        var number = InternalFunctions.GetNumberFromLetter(letter) - 1;
                        if (number == -1)
                        {
                            number = 26;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    else
                    {
                        StartPosition = StartPosition.Next;
                        var number = InternalFunctions.GetNumberFromLetter(letter) + 1;
                        if (number == 27)
                        {
                            number = 1;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    break;
                }

                case "J":
                case "W":
                {
                    if (StartPosition.Previous.Color != "white" || StartPosition.Previous.Color != "black" || StartPosition.Previous.Color != "red")
                    {
                        result += StartPosition.Start + "-" + StartPosition.End + ", ";
                        StartPosition.ShouldBeCut = true;
                    }
                    if (ReversedOrder)
                    {
                        StartPosition = StartPosition.Previous;
                        var number = InternalFunctions.GetNumberFromLetter(letter) - 1;
                        if (number == -1)
                        {
                            number = 26;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    else
                    {
                        StartPosition = StartPosition.Next;
                        var number = InternalFunctions.GetNumberFromLetter(letter) + 1;
                        if (number == 27)
                        {
                            number = 1;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    break;
                }

                case "K":
                case "X":
                {
                    if (StartPosition.Previous.Previous.Color != StartPosition.Previous.Color)
                    {
                        result += StartPosition.Start + "-" + StartPosition.End + ", ";
                        StartPosition.ShouldBeCut = true;
                    }
                    if (ReversedOrder)
                    {
                        StartPosition = StartPosition.Previous;
                        var number = InternalFunctions.GetNumberFromLetter(letter) - 1;
                        if (number == -1)
                        {
                            number = 26;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    else
                    {
                        StartPosition = StartPosition.Next;
                        var number = InternalFunctions.GetNumberFromLetter(letter) + 1;
                        if (number == 27)
                        {
                            number = 1;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    break;
                }

                case "L":
                case "Y":
                {
                    if (!(StartPosition.Previous.End <= 6))
                    {
                        result += StartPosition.Start + "-" + StartPosition.End + ", ";
                        StartPosition.ShouldBeCut = true;
                    }
                    if (ReversedOrder)
                    {
                        StartPosition = StartPosition.Previous;
                        var number = InternalFunctions.GetNumberFromLetter(letter) - 1;
                        if (number == -1)
                        {
                            number = 26;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    else
                    {
                        StartPosition = StartPosition.Next;
                        var number = InternalFunctions.GetNumberFromLetter(letter) + 1;
                        if (number == 27)
                        {
                            number = 1;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    break;
                }

                case "M":
                case "Z":
                {
                    var list = new List <string> {
                        "white", "black"
                    };
                    if (!list.Contains(StartPosition.Previous.Previous.Color) || !list.Contains(StartPosition.Previous.Color))
                    {
                        result += StartPosition.Start + "-" + StartPosition.End + ", ";
                        StartPosition.ShouldBeCut = true;
                    }
                    if (ReversedOrder)
                    {
                        StartPosition = StartPosition.Previous;
                        var number = InternalFunctions.GetNumberFromLetter(letter) - 1;
                        if (number == -1)
                        {
                            number = 26;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    else
                    {
                        StartPosition = StartPosition.Next;
                        var number = InternalFunctions.GetNumberFromLetter(letter) + 1;
                        if (number == 27)
                        {
                            number = 1;
                        }
                        letter = InternalFunctions.GetLetterFromNumber(number);
                    }
                    break;
                }
                }

                StartPosition.Previous.Resolved = true;
            }
            Solved = true;
            return(result.Substring(0, result.Length - 2) + ".");
        }
示例#34
0
 void Bomb()
 {
     Bomb bomb = Instantiate(BombObj,
                             playerInfo.transform.position + playerInfo.currentPointerDir * PowerCreationOffset,
                             Quaternion.identity).GetComponentInChildren <Bomb>();
 }
示例#35
0
        public void requireNoListeners()
        {
            var listeners = numDelegates(valueChanged) - 1;

            Bomb.unless(listeners == 0, () => "requireNoListeners called when there are " + listeners + " listeners on " + this);
        }
示例#36
0
    private IEnumerable <object> ProcessPerspectivePegs(KMBombModule module)
    {
        var comp          = GetComponent(module, "PerspectivePegsModule");
        var fldIsComplete = GetField <bool>(comp, "isComplete");

        while (!fldIsComplete.Get())
        {
            yield return(new WaitForSeconds(.1f));
        }
        _modulesSolved.IncSafe(_PerspectivePegs);

        var serialNumber = JObject.Parse(Bomb.QueryWidgets(KMBombInfo.QUERYKEY_GET_SERIAL_NUMBER, null).First())["serial"].ToString();

        int    keyNumber = 0;
        string keyColour;
        char   prevChar = '\0';

        foreach (var letter in serialNumber)
        {
            if (!char.IsLetter(letter))
            {
                continue;
            }
            if (prevChar == 0)
            {
                prevChar = letter;
            }
            else
            {
                keyNumber += Math.Abs(letter - prevChar);
                prevChar   = '\0';
            }
        }
        var colorNames = new[] { "red", "yellow", "green", "blue", "purple" };

        switch (keyNumber % 10)
        {
        case 0:
        case 3: keyColour = "ColourRed"; break;

        case 4:
        case 9: keyColour = "ColourYellow"; break;

        case 1:
        case 7: keyColour = "ColourGreen"; break;

        case 5:
        case 8: keyColour = "ColourBlue"; break;

        case 2:
        case 6: keyColour = "ColourPurple"; break;

        default: throw new AbandonModuleException("Invalid keyNumber % 10.");
        }

        var colourMeshes = GetField <MeshRenderer[, ]>(comp, "ColourMeshes").Get();
        var pegIndex     = Enumerable.Range(0, 5).IndexOf(px => Enumerable.Range(0, 5).Count(i => colourMeshes[px, i].sharedMaterial.name.StartsWith(keyColour)) >= 3);

        if (pegIndex == -1)
        {
            throw new AbandonModuleException("The key peg couldn't be found (the key colour was {0}).", keyColour);
        }

        addQuestions(module, Enumerable.Range(0, 5)
                     .Select(i => (pegIndex + i) % 5)
                     .Select(n => colorNames.First(cn => colourMeshes[n, n].sharedMaterial.name.Substring(6).StartsWith(cn, StringComparison.InvariantCultureIgnoreCase)))
                     .Select((col, ix) => makeQuestion(Question.PerspectivePegsColorSequence, _PerspectivePegs, formatArgs: new[] { ordinal(ix + 1) }, correctAnswers: new[] { col })));
    }
示例#37
0
 protected abstract Point GetLocation(Bomb bomb);
        protected override void Draw(GameTime gameTime)
        {
            //Window data
            int width = graphics.GraphicsDevice.Viewport.Width;
            int height = graphics.GraphicsDevice.Viewport.Height;
            // Begin drawing sprites
            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
            //Draw bg
            if (spellcard != null)
                for (int i = 0; i < spellcard.backgrounds.Count; i++) spellcard.backgrounds[i].draw();
            else
                for (int i = 0; i < level.backgrounds.Length; i++) level.backgrounds[i].draw();
            //Move and draw player bullets
            for (int i = 0; i < pBullets.Count; i++)
            {
                Bullet b = pBullets[i];
                if (!b.update()) { pBullets.RemoveAt(i); i--; continue; }
                b.draw(0.4f);
            }
            //Move and draw the player
            Player.update();
            Player.draw(0.5f);

            //Move and draw enemies
            for (int i = 0; i < enemies.Count; i++)
            {
                Enemy e = enemies[i];
                if (!e.update() || e.collide()) { enemies.RemoveAt(i); i--; continue; }
                e.draw(0.3f);
            }
            //Draw boss
            if (boss != null)
            {
                boss.collide(); boss.draw(0.3f);
            }
            //Switch blend state for color blending
            spriteBatch.End();
            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.NonPremultiplied);
            //Move and draw enemy bullets
            for (int i = 0; i < eBullets.Count; i++)
            {
                Bullet b = eBullets[i];
                if (!b.update() || b.collide()) { eBullets.RemoveAt(i); i--; continue; }
                b.draw(0.2f);
            }
            //Switch back
            spriteBatch.End();
            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
            //Move and draw items
            for (int i = 0; i < items.Count; i++)
            {
                Item x = items[i];
                if (!x.update()) { items.RemoveAt(i); i--; continue; }
                x.draw(0.1f);
            }
            //Move and draw score texts
            for (int i = 0; i < scoreTexts.Count; i++)
            {
                ScoreText t = scoreTexts[i];
                if (!t.update()) { scoreTexts.RemoveAt(i); i--; continue; }
                spriteBatch.DrawString(font, t.amount.ToString(), t.pos, t.color);
            }
            if (powerText != null)
            {
                spriteBatch.Draw(powerText.text, powerText.pos, powerText.text.Bounds, Color.White, 0.0f,
                       Vector2.Zero, 1.0f, SpriteEffects.None, 0.1f);
                if (!powerText.update()) powerText = null;
            }
            //Update and draw orbs
            for (int i = 0; i < orbs.Count; i++)
            {
                Orb b = orbs[i];
                if (!b.update()) { orbs.RemoveAt(i); i--;
                explosions.Add(new Explosion("explode", b.pos, 5.0f, 1.0f, 1.0f, Color.White));
                    sounds["enemyshoot1"].play(); continue;
                }
                b.draw(0.1f);
            }
            //Switch blend state for color blending
            spriteBatch.End();
            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.NonPremultiplied);
            //Update and draw explosions
            for (int i = 0; i < explosions.Count; i++)
            {
                Explosion e = explosions[i];
                if (!e.update()) { explosions.RemoveAt(i); i--; continue; }
                e.draw(0.05f);
            }
            //Switch back
            spriteBatch.End();
            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);

            //Update spellcards
            if (spellcard != null && !spellcard.update()) spellcard = null;
            if (bomb != null && !bomb.update()) bomb = null;

            //Draw conversation
            if (conversation != null) if (!conversation.show()) conversation = null;

            //Draw foreground
            drawForeground();

            //Draw other text
            spriteBatch.DrawString(fontfps, fps.ToString(), new Vector2(0,450), Color.White);
            if (fullPowerTime >= 0)
            {
                fullPowerTime += dt;
                spriteBatch.DrawString(fontfps, "Max Power Mode!!",
                    new Vector2(MathHelper.Clamp((float)fullPowerTime * 500 - 400, -1000, 100), 100.0f),
                    Color.Red);
                if (fullPowerTime >= 3) fullPowerTime = -1;
            }

            //End drawing sprites
            spriteBatch.End();
            //base.Draw(gameTime);
        }
示例#39
0
        private static int[,] Exploding(int[,] field, Bomb currBomb)
        {
            int power = field[currBomb.row, currBomb.col];

            field[currBomb.row, currBomb.col] = 0;

            bool boardLeft  = false;
            bool boardRight = false;
            bool boardUp    = false;
            bool boardDown  = false;

            if (currBomb.row > 0)
            {
                if (field[currBomb.row - 1, currBomb.col] > 0)
                {
                    field[currBomb.row - 1, currBomb.col] -= power;
                }
            }

            else
            {
                boardLeft = true;
            }

            if ((currBomb.row + 1) < field.GetLength(0))
            {
                if (field[currBomb.row + 1, currBomb.col] > 0)
                {
                    field[currBomb.row + 1, currBomb.col] -= power;
                }
            }

            else
            {
                boardRight = true;
            }

            if (currBomb.col > 0)
            {
                if (field[currBomb.row, currBomb.col - 1] > 0)
                {
                    field[currBomb.row, currBomb.col - 1] -= power;
                }
            }

            else
            {
                boardUp = true;
            }

            if ((currBomb.col + 1) < field.GetLength(1))
            {
                if (field[currBomb.row, currBomb.col + 1] > 0)
                {
                    field[currBomb.row, currBomb.col + 1] -= power;
                }
            }

            else
            {
                boardDown = true;
            }

            if (!boardLeft && !boardRight && !boardUp && !boardDown)
            {
                if (field[currBomb.row + 1, currBomb.col - 1] > 0)
                {
                    field[currBomb.row + 1, currBomb.col - 1] -= power;
                }

                if (field[currBomb.row + 1, currBomb.col + 1] > 0)
                {
                    field[currBomb.row + 1, currBomb.col + 1] -= power;
                }

                if (field[currBomb.row - 1, currBomb.col - 1] > 0)
                {
                    field[currBomb.row - 1, currBomb.col - 1] -= power;
                }

                if (field[currBomb.row - 1, currBomb.col + 1] > 0)
                {
                    field[currBomb.row - 1, currBomb.col + 1] -= power;
                }

                return(field);
            }

            if (currBomb.row - 1 >= 0 && currBomb.col - 1 >= 0)
            {
                if (field[currBomb.row - 1, currBomb.col - 1] > 0)
                {
                    field[currBomb.row - 1, currBomb.col - 1] -= power;
                }
            }

            if (currBomb.row + 1 < field.GetLength(0) && currBomb.col - 1 >= 0)
            {
                if (field[currBomb.row + 1, currBomb.col - 1] > 0)
                {
                    field[currBomb.row + 1, currBomb.col - 1] -= power;
                }
            }

            if (currBomb.row + 1 < field.GetLength(0) && currBomb.col + 1 < field.GetLength(1))
            {
                if (field[currBomb.row + 1, currBomb.col + 1] > 0)
                {
                    field[currBomb.row + 1, currBomb.col + 1] -= power;
                }
            }

            if ((currBomb.row - 1 >= 0 && currBomb.col + 1 < field.GetLength(1)))
            {
                if (field[currBomb.row - 1, currBomb.col + 1] > 0)
                {
                    field[currBomb.row - 1, currBomb.col + 1] -= power;
                }
            }

            return(field);
        }
示例#40
0
		public override void OnDoubleClick( Mobile from )
		{
			if( Owner == null )
			{
				from.SendMessage( "You are now the owner of this bomb bag!" );
				Owner = from;
			}
			
			//make sure the person using the bomb bag is the owner, and that it's in their backpack
			if( from != Owner || !IsChildOf( from.Backpack ) || !Active )
			{
				from.SendMessage( "You cannot use that" );
				return;
			}
			
			if( from.Followers > 0 )
			{
				from.SendMessage( "You can't use this with pets!" );
				return;
			}
			
			//check if there's a bomb at feet already
			if( BombAtFeet( from ) )
			{
				from.SendMessage( "There is a bomb at your feet already!" );
				return;
			}
			
			
			if( Bombs.Count < MaxBombs )
			{
				Bomb newbomb = new Bomb( this );
				
				Owner.PlaySound( 0x42 );
				
				newbomb.MoveToWorld( new Point3D( Owner.X, Owner.Y, Owner.Z ), Owner.Map );
				
				Bombs.Add( newbomb );
				
				from.SendMessage( "Planting bomb!" );
			}
			else
			{
				from.SendMessage( "You have too many bombs on the field." );
			}
			
		}
示例#41
0
 public void AddMissedEquation(Bomb bomb)
 {
     missedEquations.Add(bomb.Equation);
 }
示例#42
0
        public string GetButton(Bomb bomb, string color, int index)
        {
            switch (color)
            {
            case "red":
            case "yellow":
            case "green":
            {
                if (index < 3)
                {
                    if (index % 3 == bomb.GetBatteriesHolders() - 1)
                    {
                        return("fourth. ");
                    }
                    if (Buttons[0] == "alpha" || Buttons[2] == "alpha")
                    {
                        return("charlie. ");
                    }
                    if (bomb.HasPort("clr") || bomb.HasPort("frk") || bomb.HasPort("trn"))
                    {
                        return("third. ");
                    }
                    if (Colors[0] == "blue" || Colors[1] == "blue" || Colors[2] == "blue")
                    {
                        return("first. ");
                    }
                    return("bravo. ");
                }
                else
                {
                    if (index % 3 == bomb.GetPortsQuantity() - 1)
                    {
                        return("second. ");
                    }
                    if (index % 3 == bomb.GetBatteries() - 1)
                    {
                        return("delta. ");
                    }
                    if (Colors[(index + 3) % 3] != "white")
                    {
                        return("alpha. ");
                    }
                    if ((Colors[3] != "magenta" && index != 3) || (Colors[4] != "magenta" && index != 4) || (Colors[5] != "magenta" && index != 5))
                    {
                        return("charlie. ");
                    }
                    return("first. ");
                }
            }

            case "blue":
            case "magenta":
            case "white":
            {
                if (index < 3)
                {
                    if (index % 3 == bomb.GetPortTypesQuantity() - 1)
                    {
                        return("delta. ");
                    }
                    if (Buttons[1] == "charle" || Buttons[3] == "charle")
                    {
                        return("bravo. ");
                    }
                    if (bomb.HasPort("car") || bomb.HasPort("frq") || bomb.HasPort("snd"))
                    {
                        return("fourth. ");
                    }
                    if (Colors[0] == "red" || Colors[1] == "red" || Colors[2] == "red")
                    {
                        return("second. ");
                    }
                    return("alpha. ");
                }
                else
                {
                    if (index % 3 == bomb.GetPortPlatesQuantity() - 1)
                    {
                        return("second. ");
                    }
                    if (index % 3 == bomb.GetBatteries() - 1)
                    {
                        return("delta. ");
                    }
                    if (Colors[(index + 3) % 3] != "white")
                    {
                        return("alpha. ");
                    }
                    if ((Colors[3] != "magenta" && index != 3) || (Colors[4] != "magenta" && index != 4) || (Colors[5] != "magenta" && index != 5))
                    {
                        return("charlie. ");
                    }
                    return("first. ");
                }
            }
            }
            return("");
        }
示例#43
0
        public string WhichColor(Bomb bomb, string color)
        {
            if (bomb.HasSerialVowel())
            {
                switch (bomb.Strikes)
                {
                case 0:
                    switch (color)
                    {
                    case "red": return("blue");

                    case "blue": return("red");

                    case "green": return("yellow");

                    case "yellow": return("green");

                    default: return("");
                    }

                case 1:
                    switch (color)
                    {
                    case "red": return("yellow");

                    case "blue": return("green");

                    case "green": return("blue");

                    case "yellow": return("red");

                    default: return("");
                    }

                case 2:
                    switch (color)
                    {
                    case "red": return("green");

                    case "blue": return("red");

                    case "green": return("yellow");

                    case "yellow": return("blue");

                    default: return("");
                    }

                default: return("");
                }
            }
            else
            {
                switch (bomb.Strikes)
                {
                case 0:
                    switch (color)
                    {
                    case "red": return("blue");

                    case "blue": return("yellow");

                    case "green": return("green");

                    case "yellow": return("red");

                    default: return("");
                    }

                case 1:
                    switch (color)
                    {
                    case "red": return("red");

                    case "blue": return("blue");

                    case "green": return("yellow");

                    case "yellow": return("green");

                    default: return("");
                    }

                case 2:
                    switch (color)
                    {
                    case "red": return("yellow");

                    case "blue": return("green");

                    case "green": return("blue");

                    case "yellow": return("red");

                    default: return("");
                    }

                default: return("");
                }
            }
        }
示例#44
0
        public override string Solve(Bomb bomb)
        {
            var firstStageHole  = bomb.GetBatteries() + bomb.GetUnlitIndicators() - 1;
            var secondStageHole = bomb.GetSerialLastNumberDigit() + bomb.GetLitIndicators() - 1;
            var thirdStageHole  = bomb.GetPortsQuantity() + bomb.GetBatteriesHolders() - 1;

            if (firstStageHole > 6)
            {
                firstStageHole = firstStageHole % 6;
            }
            if (firstStageHole == -1)
            {
                firstStageHole = 0;
            }

            if (secondStageHole > 6)
            {
                secondStageHole = secondStageHole % 6;
            }
            if (secondStageHole == -1)
            {
                secondStageHole = 0;
            }
            if (secondStageHole == firstStageHole)
            {
                secondStageHole++;
            }
            if (secondStageHole > 6)
            {
                secondStageHole = secondStageHole % 6;
            }
            if (secondStageHole == -1)
            {
                secondStageHole = 0;
            }

            if (thirdStageHole > 6)
            {
                thirdStageHole = thirdStageHole % 6;
            }
            if (thirdStageHole == -1)
            {
                thirdStageHole = 0;
            }
            if (thirdStageHole == secondStageHole)
            {
                thirdStageHole++;
            }
            if (thirdStageHole > 6)
            {
                thirdStageHole = thirdStageHole % 6;
            }
            if (thirdStageHole == -1)
            {
                thirdStageHole = 0;
            }

            var colorFirstStage  = Colors[firstStageHole];
            var colorSecondStage = Colors[secondStageHole];
            var colorThirdStage  = Colors[thirdStageHole];

            var result = "First color " + colorFirstStage + ", press " + GetButton(bomb, colorFirstStage, firstStageHole);

            result += "Second color " + colorSecondStage + ", press " + GetButton(bomb, colorSecondStage, secondStageHole);
            result += "Third color " + colorThirdStage + ", press " + GetButton(bomb, colorThirdStage, thirdStageHole);

            Solved = true;

            return(result.Trim());
        }
示例#45
0
        public void StartGame(IStage stage)
        {
            this.CurrentCount = 0;
            this.enemies.Clear();

            if (this.StartedGame != null)
            {
                this.StartedGame(this, EventArgs.Empty);
            }

            const double interval   = 0.1;
            const double totalCount = 20 / interval;
            var          timer      = new DispatcherTimer(DispatcherPriority.Normal, App.Current.Dispatcher);

            timer.Interval = TimeSpan.FromSeconds(interval);

            EventHandler gameOverHandler = null;

            gameOverHandler = (_, __) =>
            {
                timer.Stop();
                foreach (var e in this.enemies)
                {
                    e.Stop();
                }
                this.Castle.GameOver -= gameOverHandler;
                MessageBox.Show("城が白旗上げた。", "ゲームオーバー");
                if (this.EndedGame != null)
                {
                    this.EndedGame(this, EventArgs.Empty);
                }
                this.Initialize();
            };
            this.Castle.GameOver += gameOverHandler;

            timer.Tick += (_, __) =>
            {
                if (this.CurrentCount++ >= totalCount)
                {
                    timer.Stop();
                    this.Castle.GameOver -= gameOverHandler;
                    this.Cleared          = Math.Max(this.Cleared, stage.Number);
                    this.Money           += stage.Reward;
                    if (this.EndedGame != null)
                    {
                        this.EndedGame(this, EventArgs.Empty);
                    }
                    return;
                }

                if (this.CurrentCount < totalCount * 0.85 && stage.NewEnemy())
                {
                    var e = new Bomb(this);
                    this.enemies.Add(e);
                    if (this.CreatedEnemy != null)
                    {
                        this.CreatedEnemy(this, GenericEventArgs.Create <Enemy>(e));
                    }
                }
            };
            timer.Start();
        }
示例#46
0
    public Bomb Get()
    {
        Bomb instance = Instantiate(Bomb1);

        return(instance);
    }
示例#47
0
 public IBomb BombModelSetter(Bomb b)
 {
     _bomb = b;
     return(this);
 }
 internal static Bomb GetCopy(Bomb src)
 {
     return(new Bomb {
         Dst = src.Dst, DstInCommand = src.DstInCommand, Side = src.Side, Src = src.Src, Remaining = src.Remaining
     });
 }
示例#49
0
 private void Start()
 {
     bomb = GameObject.FindObjectOfType <Bomb>();
 }
示例#50
0
 public BombCommander(Bomb bomb)
 {
     ReuseBombCommander(bomb);
 }
        /// <summary>
        /// Factory method for spawning a projectile
        /// </summary>
        /// <param name="projectileType">The type of projectile to create</param>
        /// <param name="position">The position of the projectile in the game world</param>
        /// <returns>The game object id of the projectile</returns>
        public Projectile CreateProjectile(ProjectileType projectileType, Vector2 position, Vector2 velocity)
        {
            Projectile projectile = null;
            uint id = NextID();

            switch (projectileType)
            {
                case ProjectileType.Bullet:
                    projectile = new Bullet(id, content, position);
                    break;

                case ProjectileType.Fireball:
                    projectile = new Fireball(id, content, position);
                    break;

                case ProjectileType.BubbleBullet:
                    projectile = new BubbleBullet(id, content, position);
                    break;

                case ProjectileType.Bomb:
                    projectile = new Bomb(id, content, position, true);
                    break;

                case ProjectileType.Blades:
                    projectile = new Blades(id, content);
                    break;

                case ProjectileType.DroneLaser:
                    projectile = new DroneLaser(id, content, position);
                    break;

                case ProjectileType.ToPlayerBullet:
                    projectile = new ToPlayerBullet(id, content, position);
                    break;

                case ProjectileType.ArrowProjectile:
                    projectile = new ArrowProjectile(id, content, position);
                    break;

                case ProjectileType.BirdCrap:
                    projectile = new BirdCrap(id, content, position);
                    break;
                case ProjectileType.EBullet:
                    projectile = new EBullet(id, content, position);
                    break;

                case ProjectileType.Frostball:
                    projectile = new Frostball(id, content, position);
                    break;

                case ProjectileType.BlueBeam:
                    projectile = new blueBeam(id, content, position);
                    break;

                //This method doesn't fit the trishield very well, so this code is a bit poor in quality.
                case ProjectileType.TrishieldBall:
                    for (int i = 0; i < 2; i++)
                    {
                        projectile = new TriShieldBall(id, content, 2 * MathHelper.Pi / 3 * i);
                        QueueGameObjectForCreation(projectile);
                        id = NextID();
                    }
                    projectile = new TriShieldBall(id, content, 4 * MathHelper.Pi / 3);
                    break;

                case ProjectileType.GenericEnemyBullet:
                    projectile = new GenericEnemyBullet(id, content, position);
                    break;

                case ProjectileType.DroneWave:
                    // waveIndex helps draw the wave to the left and right of the ship, while waveSpacing holds the vector difference of space between each drone.
                    // Drone count is managed by 2*i.
                    Vector2 waveIndex = new Vector2(-1, 1);
                    Vector2 waveSpacing = new Vector2(40,30);
                    for (int i = 0; i < 5; i++)
                    {
                        projectile = new DroneWave(id, content, position + waveSpacing * waveIndex * i);
                        QueueGameObjectForCreation(projectile);
                        id = NextID();
                        projectile = new DroneWave(id, content, position + waveSpacing * i);
                        QueueGameObjectForCreation(projectile);
                        id = NextID();
                    }
                    break;

                case ProjectileType.TurretFireball:
                    projectile = new TurretFireball(id, content, position);
                    break;

                case ProjectileType.JetMinionBullet:
                    projectile = new JetMinionBullet(id, content, position);
                    break;

                case ProjectileType.EnergyBlast:
                    projectile = new EnergyBlast(id, content, position, ScrollingShooterGame.Game.Player.energyBlastLevel);
                    break;

                case ProjectileType.EnemyBullet:

                    // Bullet velocity
                    float bulletVel = 200f;

                    //ScrollingShooterGame.Game.projectiles.Add(new EnemyBullet(ScrollingShooterGame.Game.Content, this.position + offset, bulletVel * toPlayer));

                    Vector2 toPlayer = (new Vector2(ScrollingShooterGame.Game.Player.Bounds.Center.X,
                        ScrollingShooterGame.Game.Player.Bounds.Center.Y) - position);

                    toPlayer.Normalize();

                    projectile = new EnemyBullet(id, content, position, bulletVel * toPlayer);
                    break;
                case ProjectileType.EnemyBomb:
                    projectile = new Bomb(id, content, position, false);
                    break;

                case ProjectileType.ShotgunBullet:
                    projectile = new ShotgunBullet(id, content, position, BulletDirection.Straight);
                    QueueGameObjectForCreation(new ShotgunBullet(NextID(), content, position, BulletDirection.Left));
                    QueueGameObjectForCreation(new ShotgunBullet(NextID(), content, position, BulletDirection.Right));
                    QueueGameObjectForCreation(new ShotgunBullet(NextID(), content, position, BulletDirection.HardLeft));
                    QueueGameObjectForCreation(new ShotgunBullet(NextID(), content, position, BulletDirection.HardRight));
                    break;

                case ProjectileType.BlimpShotgun:
                    projectile = new BlimpShotgun(id, content, position, BulletDirection.Straight);
                    QueueGameObjectForCreation(new BlimpShotgun(NextID(), content, position, BulletDirection.Left));
                    QueueGameObjectForCreation(new BlimpShotgun(NextID(), content, position, BulletDirection.Right));
                    QueueGameObjectForCreation(new BlimpShotgun(NextID(), content, position, BulletDirection.HardLeft));
                    QueueGameObjectForCreation(new BlimpShotgun(NextID(), content, position, BulletDirection.HardRight));
                    break;

                case ProjectileType.Meteor:
                    projectile = new Meteor(id, content, position);
                    break;

                case ProjectileType.BigMeteor:
                    projectile = new BigMeteor(id, content, position);
                    break;

                case ProjectileType.EnemyFlameball:
                    projectile = new EnemyFlameball(id, content, position);
                    break;

                case ProjectileType.RGSabot:
                    projectile = new RGSabot(id, content, position);
                    break;

                case ProjectileType.BlimpBullet:
                    projectile = new BlimpBullet(id, content, position);
                    break;

                case ProjectileType.BirdWrath:
                    projectile = new BirdWrath(id, content, position);
                    break;

                case ProjectileType.FreezewaveProjectile:
                    projectile = new FreezewaveProjectile(id, content, position);
                    break;

                case ProjectileType.Photon:
                    projectile = new Photon(id, content, position);
                    break;

                case ProjectileType.Pincher:
                    projectile = new Pincher(id, content, position);
                    break;

                case ProjectileType.GreenOrb:
                    projectile = new GreenOrb(id, content, position);
                    break;

                case ProjectileType.AlienTurretOrb:
                    projectile = new AlienTurretOrb(id, content, position);
                    break;

                case ProjectileType.TwinJetMissile:
                    projectile = new Boss_TwinJetMissile(id, content, position);
                    break;

                case ProjectileType.TwinJetBullet:
                    projectile = new Boss_TwinJetBullet(id, content, position);
                    break;

                case ProjectileType.HomingMissile:
                    projectile = new HomingMissileProjectile(content, position, 1, id);
                    break;

                case ProjectileType.EnemyPsyBall:
                    projectile = new EnemyPsiBall(id, content, position);
                    break;

                case ProjectileType.EnemyLightningZap:
                    projectile = new EnemyLightningZap(id, content, position);
                    break;

                default:
                    throw new NotImplementedException("The projectile type " + Enum.GetName(typeof(ProjectileType), projectileType) + " is not supported");
            }

            if ((int)projectileType < 100)
                projectile.ObjectType = ObjectType.PlayerProjectile;
            else
                projectile.ObjectType = ObjectType.EnemyProjectile;
            QueueGameObjectForCreation(projectile);
            return projectile;
        }
示例#52
0
 private void Awake()
 {
     Instance = this;
     fizzle.Play();
 }
示例#53
0
        private void shootCharge()
        {
            var game = (GameStates.PlayableState)GameCore.GameEngine.Singleton.FindGameState(x => x is GameStates.PlayableState);

            var player = (Player)game.ActiveMap.Player;

            var mdir = Vector2.Normalize(player.Position - this.Position);
            var launchPort = this.Position + mdir * (this.Radius + 5); //launch stuff from slightly in front of player
            float launchVel = 500f + player.Velocity.Length();

            var carrier = new Bomb(launchPort, 5, this);
            carrier.Velocity = launchVel * mdir;

            game.SpawnObject<Actor>(carrier);

            var c = new GameObjects.Devices.Charge(10, 1);
            game.SpawnObject<Device>(c);
            carrier.AddDevice(c);
        }
示例#54
0
 public SendBomb(Bomb bomb)
 {
     Bombs = new List <Bomb> {
         bomb
     };
 }
示例#55
0
			public FuseTimer( Bomb bomb ) : base( TimeSpan.FromSeconds( BombermanSettings.EXPLODE_DELAY ), TimeSpan.FromSeconds( 1.0 ) )
			{
				Priority = TimerPriority.TwoFiftyMS;
				_Bomb = bomb;
			}
示例#56
0
 public IMove GetCopy()
 {
     return(new SendBomb(Bombs.Select(x => Bomb.GetCopy(x))));
 }
示例#57
0
		public DetonatorReceiver( Bomb bomb ) : base( 0xF13, bomb.Name )
		{
			_Bomb = bomb;
			
		}
 public override void BombEffect(Bomb bomb)
 {
     bomb.radius += (radiusUpAmount + tileBoost);
 }
	void OnTriggerEnter(Collider other){
		if (bombSet==null && other.tag == "bomb") {
			
			bombSet=other.gameObject;
			bomb=bombSet.GetComponent<Bomb>();	
			
			demage=bomb.power;
			StartCoroutine("bomb_function");
			
		}
	}
示例#60
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.R) && gameoverb)
        {
            Gamerestart();
            gameoverb      = false;
            speedChangeDif = 15;

            GameObject[] gos;
            gos = GameObject.FindGameObjectsWithTag("ground");
            foreach (GameObject go in gos)
            {
                GroundPart Scriptt = go.GetComponent <GroundPart>();
                Scriptt.speed = Speed;
            }

            GameObject[] gos2;
            gos2 = GameObject.FindGameObjectsWithTag("background");
            foreach (GameObject go2 in gos2)
            {
                bgmove Scriptt2 = go2.GetComponent <bgmove>();
                Scriptt2.speed = bgSpeed;
            }
        }

        if (!gameoverb)
        {
            gameTime += Time.deltaTime;

            if (gameTime - lastgametime > speedChangeDif)
            {
                lastgametime = gameTime;


                speedChangeDif = speedChangeDif / 1.2f;
                Speed         *= 1.2f;
                bgSpeed        = Speed / 2;

                GameObject[] gos;
                gos = GameObject.FindGameObjectsWithTag("ground");
                foreach (GameObject go in gos)
                {
                    GroundPart Scriptt = go.GetComponent <GroundPart>();
                    Scriptt.speed = Speed;
                }

                GameObject[] gos2;
                gos2 = GameObject.FindGameObjectsWithTag("bomb");
                foreach (GameObject gof in gos2)
                {
                    Bomb Scripttf = gof.GetComponent <Bomb>();
                    Scripttf.speed = Speed;
                }

                GameObject[] gos3;
                gos3 = GameObject.FindGameObjectsWithTag("background");
                foreach (GameObject go3 in gos3)
                {
                    bgmove Scriptt3 = go3.GetComponent <bgmove>();
                    Scriptt3.speed = bgSpeed;
                }
            }

            if (gameTime - lastTileTime > 7f / Speed)
            {
                lastTileTime = gameTime;
                newground();
            }
        }
    }