Example #1
0
    public void Start()
    {
        //Prepare variables
        char inputKey = ' ';

        while (app_started)
        {
            //Main menu input loop
            do {
                MainMenuInput(inputKey);
            } while (!inputValid);

            //Prepare game if user wants to play
            if (game_started)
            {
                //Create objects
                board = new Board();
                bLoader = new BoardLoader(board);
                timer = new Timer();

                //Initialize board
                bLoader.initializeBoard();

                //Set timer
                timerInterval = TIMER_DEFAULT_INTERVAL;
                timer.Interval = TIMER_DEFAULT_INTERVAL;
                timer.Elapsed += Tick;
                timer.Start();
            }

            //Game input loop
            while (game_started)
                GameInput(inputKey);
        }
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        Instance = this;

        cam = Camera.main;

        //Initializing the escapeMenu to be invisible
        escapeMenu = GameObject.Find("escapeMenuPanel");
        escapeMenu.SetActive(false);
        gameFinishedPanel = GameObject.Find("GameFinishedPanel");
        gameFinishedPanel.SetActive(false);

        //Taking in all of the data from the Game Lobby
        //GameLobby gameLobby = GameObject.Find("GameLobbyHandle").GetComponent<GameLobby>();
        SetNumPlayers(PhotonNetwork.PlayerList.Length);
        SetRules((Ruleset)PhotonNetwork.CurrentRoom.CustomProperties["ruleset"]);
        SetStatus(GameStatus.SETUP);
        //gameLobby.Destroy();
        //gameLobby = null;

        foreach (Player player in PhotonNetwork.PlayerList)
        {
            players.Add(player);
        }

        //TODO this should have an argument so we can specify which board
        BoardLoader boardLoader = BoardLoader.Instance;

        cells = boardLoader.InitBoard1();
        StartCoroutine(RestOfStart());
    }
Example #3
0
    void LoadLevelAndStart(LevelInfo levelInfo)
    {
        var board = new Board();

        BoardLoader.LoadFromLevelInfo(board, levelInfo);
        boardEngine.UseBoard(board);

        //TODO: display level# onscreen.  ?store in BoardEngine or Board?

        StartGame();
    }
Example #4
0
        public void Move(MoveContent move)
        {
            if (move.TakenPiece.PieceType != ChessPieceType.None)
            {
                Destroy(move.TakenPiece.Position);
            }
            Move(move.MovingPiecePrimary);
            if (move.MovingPieceSecondary.PieceType != ChessPieceType.None)
            {
                Move(move.MovingPieceSecondary);
            }

            if (move.PawnPromotedTo != ChessPieceType.None)
            {
                ref var pos = ref _board[move.MovingPiecePrimary.DstPosition];
                pos = BoardLoader.ReplacePiece(pos, move.PawnPromotedTo);
                pos.SetPosition(new Position(move.MovingPiecePrimary.DstPosition));
            }
Example #5
0
 public void Setup()
 {
     boardLoader   = new BoardLoader();
     testBoardPath = AssemblyPath() + "testBoard.xml";
 }
Example #6
0
 void Start()
 {
     targets         = GetComponentsInChildren <Target>();
     gameBoardLoader = FindObjectOfType <BoardLoader>();
 }