public void startGame(List <ConnectedPlayer> players)
        {
            singleton    = this;
            protocol     = gameMaster.protocol;
            gamePlaying  = true;
            this.players = players;

            StartCoroutine(updateGameStatus());
            broadcastBoard(protocol.sendBoardInit);
        }
Esempio n. 2
0
        public override void onPlayerLeft(ConnectedPlayer oldPlayer)
        {
            Debug.LogError("Player left: " + oldPlayer.username);
            int playerGameID           = BombermanOverlord.convertColorToTeam(oldPlayer.color);
            PlayerController playerObj = BombermanGameStateUpdater.getMatchingPlayerObj(playerGameID);

            if (playerObj != null)
            {
                playerObj.takeDamage();
            }
        }
Esempio n. 3
0
        public void init(float delay, int range, int[] pos, PlayerController owner)
        {
            this.owner   = owner;
            explodeRange = range;
            explodeTime  = Time.time + delay;
            this.pos     = (int[])pos.Clone();
            this.square  = GameBoard.singleton.gridMap [pos [1]] [pos [0]];;
            square.setState(SquareState.Bomb);
            StartCoroutine(tickTock());

            type = BombermanObjType.Bomb;
            ID   = BombermanGameStateUpdater.generateNewID();
            BombermanGameStateUpdater.addNewObj(this as BombermanMapObject);
        }
Esempio n. 4
0
        private void explode()
        {
            GameBoard.explodeBomb(pos);
            explodeInDir(1, 0);
            explodeInDir(0, 1);
            explodeInDir(-1, 0);
            explodeInDir(0, -1);
            square.setState(SquareState.Empty);
            BombermanGameStateUpdater.addNewAction(new BoardAction(ActionType.BombExplosion, ID, null));
            BombermanGameStateUpdater.removeObj(this as BombermanMapObject);

            if (owner != null)
            {
                owner.placedBombExplode();
            }
            Destroy(gameObject);
        }
        public void placeBomb()
        {
            if (GameBoard.validCoord(currentCoord [0], currentCoord [1]) == false)
            {
                return;
            }
            if (bombsLeft == 0)
            {
                return;
            }

            Bomb temp = Instantiate(bombPrefab, GameBoard.getGridPos(currentCoord [0], currentCoord [1]), Quaternion.identity, transform.parent).GetComponent <Bomb> ();

            temp.init(3, 3, currentCoord, this);

            BoardAction dropAction = new BoardAction(ActionType.BombSpawn, temp.ID, BombermanOverlord.vecToFlArray(temp.transform.localPosition));

            BombermanGameStateUpdater.addNewAction(dropAction);
            bombsLeft--;
        }
 public static void playerDied(PlayerController p)
 {
     singleton.players.Remove(p);
     BombermanGameStateUpdater.addNewAction(new BoardAction(ActionType.PlayerDeath, p.ID, p.getFloatPos()));
     BombermanGameStateUpdater.removeObj(p as BombermanMapObject);
 }