Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        float localSpeed = speed * Time.deltaTime;

        if (Input.GetKey(KeyCode.Space) && bombPocket > 0)
        {
            bombPocket--;
            BombTimer clone = Instantiate <BombTimer>(bomb, transform.position, transform.rotation);
            clone.player = this;
            clone.bomb   = clone;
        }

        if (Input.GetKey(KeyCode.W))
        {
            transform.Translate(Vector3.up * localSpeed);
        }
        else if (Input.GetKey(KeyCode.S))
        {
            transform.Translate(Vector3.down * localSpeed);
        }
        else if (Input.GetKey(KeyCode.A))
        {
            transform.Translate(Vector3.left * localSpeed);
        }
        else if (Input.GetKey(KeyCode.D))
        {
            transform.Translate(Vector3.right * localSpeed);
        }
    }
Ejemplo n.º 2
0
 public void spawnBomb()
 {
     if (bombPocket > 0)
     {
         bombPocket--;
         Vector3   spawnPosition = getBombSpawnPosition();
         BombTimer bomb          = Instantiate <BombTimer>(bombPrefab, spawnPosition, Quaternion.identity);
         bomb.player = this;
     }
 }
 public void stopall()
 {
     ExplosionTimer.Stop();
     EnemyTimer.Stop();
     EnemyTimer1.Stop();
     EnemyTimer2.Stop();
     EnemyTimer3.Stop();
     EnemyTimer4.Stop();
     BombTimer.Stop();
 }
Ejemplo n.º 4
0
    private BombTimer SpawnAndActivateBombTimer(Bomb bomb, float timeToExplode)
    {
        BombTimer bombTimer = Instantiate(BombTimerToSpawn,
                                          bomb.transform.position,
                                          bomb.transform.rotation,
                                          FindObjectOfType <Canvas>().transform);

        bomb.SetBombTimer(bombTimer, timeToExplode);

        return(bombTimer);
    }
Ejemplo n.º 5
0
		public BombermanBomb( BombermanBombPlacer placer, BombermanGame game ) : base( 0x2256 )
		{
            m_Game = game;
			Movable = false;
			Weight = 1.0;
			Name = "Bomberman bomb";
			Hue = 1;
			
			m_Placer = placer;
			BombTimer m_Timer = new BombTimer( this );
			m_Timer.Start();
		}
Ejemplo n.º 6
0
        public BombermanBomb(BombermanBombPlacer placer, BombermanGame game) : base(0x2256)
        {
            m_Game  = game;
            Movable = false;
            Weight  = 1.0;
            Name    = "Bomberman bomb";
            Hue     = 1;

            m_Placer = placer;
            BombTimer m_Timer = new BombTimer(this);

            m_Timer.Start();
        }
 private void BombTimer_Tick(object sender, EventArgs e)
 {
     if (bomb3tick == 4)
     {
         BombTimer.Stop();
         expload.controls.play();
         explosion1.Visible  = true;
         explosion2.Visible  = true;
         explosion3.Visible  = true;
         explosion4.Visible  = true;
         explosion1.Location = new Point(bomb.Location.X, bomb.Location.Y - 50);
         explosion2.Location = new Point(bomb.Location.X + 50, bomb.Location.Y);
         explosion3.Location = new Point(bomb.Location.X, bomb.Location.Y + 50);
         explosion4.Location = new Point(bomb.Location.X - 50, bomb.Location.Y);
         ExplosionTimer.Start();
     }
     bomb3tick++;
 }
Ejemplo n.º 8
0
        public bool Equals(Vehicle other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Type.Equals(other.Type) &&
                   ModelIndex.Equals(other.ModelIndex) &&
                   Handle.Equals(other.Handle) &&
                   Matrix.Equals(other.Matrix) &&
                   EntityType.Equals(other.EntityType) &&
                   EntityStatus.Equals(other.EntityStatus) &&
                   EntityFlags.Equals(other.EntityFlags) &&
                   AutoPilot.Equals(other.AutoPilot) &&
                   Color1.Equals(other.Color1) &&
                   Color2.Equals(other.Color2) &&
                   AlarmState.Equals(other.AlarmState) &&
                   MaxNumPassengers.Equals(other.MaxNumPassengers) &&
                   Field1D0h.Equals(other.Field1D0h) &&
                   Field1D4h.Equals(other.Field1D4h) &&
                   Field1D8h.Equals(other.Field1D8h) &&
                   Field1DCh.Equals(other.Field1DCh) &&
                   SteerAngle.Equals(other.SteerAngle) &&
                   GasPedal.Equals(other.GasPedal) &&
                   BrakePedal.Equals(other.BrakePedal) &&
                   CreatedBy.Equals(other.CreatedBy) &&
                   IsLawEnforcer.Equals(other.IsLawEnforcer) &&
                   IsLockedByScript.Equals(other.IsLockedByScript) &&
                   IsEngineOn.Equals(other.IsEngineOn) &&
                   IsHandbrakeOn.Equals(other.IsHandbrakeOn) &&
                   LightsOn.Equals(other.LightsOn) &&
                   HasFreebies.Equals(other.HasFreebies) &&
                   Health.Equals(other.Health) &&
                   CurrentGear.Equals(other.CurrentGear) &&
                   ChangeGearTime.Equals(other.ChangeGearTime) &&
                   TimeOfDeath.Equals(other.TimeOfDeath) &&
                   BombTimer.Equals(other.BombTimer) &&
                   DoorLock.Equals(other.DoorLock));
        }
Ejemplo n.º 9
0
    public Level(int levelIndex, string filename)
    {
        LevelIndex = levelIndex;

        // load the background
        GameObjectList   backgrounds   = new GameObjectList();
        SpriteGameObject backgroundSky = new SpriteGameObject("Sprites/Backgrounds/spr_sky", TickTick.Depth_Background);

        backgroundSky.LocalPosition = new Vector2(0, 825 - backgroundSky.Height);
        backgrounds.AddChild(backgroundSky);

        AddChild(backgrounds);

        // load the rest of the level
        LoadLevelFromFile(filename);

        // add the timer
        timer = new BombTimer();
        AddChild(timer);

        // add mountains in the background
        for (int i = 0; i < 4; i++)
        {
            SpriteGameObject mountain = new SpriteGameObject(
                "Sprites/Backgrounds/spr_mountain_" + (ExtendedGame.Random.Next(2) + 1),
                TickTick.Depth_Background + 0.01f * (float)ExtendedGame.Random.NextDouble());

            mountain.LocalPosition = new Vector2(mountain.Width * (i - 1) * 0.4f,
                                                 BoundingBox.Height - mountain.Height);

            backgrounds.AddChild(mountain);
        }

        // add clouds
        for (int i = 0; i < 6; i++)
        {
            backgrounds.AddChild(new Cloud(this));
        }
    }
Ejemplo n.º 10
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
                m_Game = reader.ReadItem() as BombermanGame;
                goto case 0;

            case 0:
            {
                m_Placer = reader.ReadItem() as BombermanBombPlacer;

                break;
            }
            }
            BombTimer m_Timer = new BombTimer(this);

            m_Timer.Start();
        }
Ejemplo n.º 11
0
    void OnTriggerEnter2D(Collider2D other)
    {
        String name = other.tag;

        if (name == "Hole")
        {
            if (hasBomb)
            {
                colurControle.SetTimerOff();
                hasBomb = false;
                Destroy(other.gameObject);

                spawner.SetBomb();
                spawner.SetHole();
                pointCounter.madePoint();
            }
        }
        else if (name == "Bomb")
        {
            if (!hasBomb)
            {
                colurControle.SetTimer(1f);
                hasBomb = true;

                Destroy(other.gameObject);

                BombTimer bombTimer = (BombTimer)other.gameObject.GetComponent("BombTimer");

                fuse          = bombTimer.fuse;
                explosionTime = bombTimer.TimeNow;
            }
        }
        else if (name == "Explosion")
        {
            stunned = 2.5f;
        }
    }
Ejemplo n.º 12
0
    // Use this for initialization

    public virtual void Start()
    {
        hills = new List <ITweenMovableObject>(
            this.transform.Find("mainCamera/Hills").GetComponentsInChildren <ITweenMovableObject>()
            );

        pauseMenu = this.GetComponentInChildren <PauseMenu>();
        pauseMenu.AddEventListener(this.gameObject);
        pauseMenu.active = false;

        gameTimer = this.GetComponentInChildren <GameTimer>();
        gameTimer.OnPauseGame();

        docam         = this.GetComponentInChildren <DoCam>();
        docam.enabled = false;

        hand = this.GetComponentInChildren <Hand>();
        hand.AddEventListener(this.gameObject);

        player = this.GetComponentInChildren <PlayerControl>();

        player.AddEventListener(this.gameObject);
        gameTimer.AddEventListener(this.gameObject);
        hand.AddEventListener(player.gameObject);

        float savedTime = PlayerPrefs.GetFloat(GlobalSaveVars.TIMELEFT, -1);

        bombTimer = this.GetComponentInChildren <BombTimer>();

        if (savedTime != -1 && useSavedTime)
        {
            gameTimer.SetStartTimeInMS(savedTime);
        }

        DropPlayer();
    }
Ejemplo n.º 13
0
 public override char GetMapSymbol()
 {
     return(Location.IsSameCoordinates(Owner.Location)
         ? Char.ToLower(Owner.GetMapSymbol())
         : Convert.ToChar(BombTimer.ToString()));
 }
Ejemplo n.º 14
0
 public void SetBombTimer(BombTimer bT, float timeToExplode)
 {
     bombTimer = bT;
     bombTimer.SetTimer(timeToExplode);
 }
Ejemplo n.º 15
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();

			switch ( version )
			{
                case 1:
                    m_Game = reader.ReadItem() as BombermanGame;
                    goto case 0;
				case 0:
				{
					m_Placer = reader.ReadItem() as BombermanBombPlacer;

					break;
				}
            }
            BombTimer m_Timer = new BombTimer(this);
            m_Timer.Start();
		}
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            lf = true;
            if (e.KeyCode == Keys.Left && !CheckCollision())
            {
                Anime.Start();
                P1.Location = new Point(P1.Location.X - 4, P1.Location.Y);
            }
            else if (e.KeyCode == Keys.Left && CheckCollision())
            {
                P1.Location = new Point(P1.Location.X + 4, P1.Location.Y);
            }

            if (e.KeyCode == Keys.Right && !CheckCollision())
            {
                AnimeRight.Start();
                P1.Location = new Point(P1.Location.X + 5, P1.Location.Y);
            }
            else if (e.KeyCode == Keys.Right && CheckCollision())
            {
                P1.Location = new Point(P1.Location.X - 4, P1.Location.Y);
            }

            if (e.KeyCode == Keys.Up && !CheckCollision())
            {
                P1.Location = new Point(P1.Location.X, P1.Location.Y - 5);
                AnimeUp.Start();
            }
            else if (e.KeyCode == Keys.Up && CheckCollision())
            {
                P1.Location = new Point(P1.Location.X, P1.Location.Y + 4);
            }

            if (e.KeyCode == Keys.Down && !CheckCollision())
            {
                P1.Location = new Point(P1.Location.X, P1.Location.Y + 5);
                AnimeDown.Start();
            }
            else if (e.KeyCode == Keys.Down && CheckCollision())
            {
                P1.Location = new Point(P1.Location.X, P1.Location.Y - 4);
            }
            if (e.KeyCode == Keys.Z && bomb.Visible == false)
            {
                bomb.Image    = Properties.Resources.graphics_bombs_934360;
                bomb.Location = P1.Location;
                bomb.Visible  = true;
                BombTimer.Start();
            }
            if (e.KeyCode == Keys.P)
            {
                ExplosionTimer.Stop();
                EnemyTimer.Stop();
                EnemyTimer1.Stop();
                EnemyTimer2.Stop();
                EnemyTimer3.Stop();
                EnemyTimer4.Stop();
                BombTimer.Stop();
                label2.Visible       = true;
                pictureBox29.Visible = true;
                P1.Visible           = false;
                bomb.Visible         = false;
                explosion1.Visible   = false;
                explosion2.Visible   = false;
                explosion3.Visible   = false;
                explosion4.Visible   = false;
            }
            if (e.KeyCode == Keys.R)
            {
                EnemyTimer.Start();
                EnemyTimer1.Start();
                EnemyTimer2.Start();
                EnemyTimer3.Start();
                EnemyTimer4.Start();
                label2.Visible       = false;
                pictureBox29.Visible = false;
                P1.Visible           = true;
            }
            //if ((P1.Bounds.IntersectsWith(enemy1.Bounds) && enemy1.Visible == true) || (P1.Bounds.IntersectsWith(enemy2.Bounds) && enemy2.Visible == true) || (P1.Bounds.IntersectsWith(enemy3.Bounds) && enemy3.Visible == true) || (P1.Bounds.IntersectsWith(enemy4.Bounds) && enemy4.Visible == true) || (P1.Bounds.IntersectsWith(enemy5.Bounds) && enemy5.Visible == true))
            ////if (explosion1.Visible && P1.Bounds.IntersectsWith(explosion1.Bounds) || explosion2.Visible && P1.Bounds.IntersectsWith(explosion2.Bounds) || explosion3.Visible && P1.Bounds.IntersectsWith(explosion3.Bounds) || explosion4.Visible && P1.Bounds.IntersectsWith(explosion4.Bounds))
            //{
            //    DEAD3.Visible = true;
            //    P1.Dispose();
            //    stopall();
            //    MessageBox.Show("YOU SUCK!");
            //    Form home = new Form2();
            //    this.Hide();
            //    home.Show();
            //}
            else if (enemy1.Visible == false && enemy2.Visible == false && enemy3.Visible == false && enemy4.Visible == false && enemy5.Visible == false)
            {
                MessageBox.Show("YOU WON!");
                Form home = new Form2();
                this.Hide();
                home.Show();
            }
        }