示例#1
0
 void Start()
 {
     if (gihInstance == null)
     {
         gihInstance     = this;
         mainPlayerIndex = -1;
     }
     SetRawString(rawString);
     if (dictionaryNameIndex == null || dictionaryNameIndex.Count == 0)
     {
         // dictionaryNameIndex = new List<string>();dictionaryNameIndex.Add("UpperEngineRoom");dictionaryNameIndex.Add("MedBayRoom");dictionaryNameIndex.Add("CafeteriaRoom");dictionaryNameIndex.Add("WeaponsRoom");dictionaryNameIndex.Add("LifeSupportRoom");dictionaryNameIndex.Add("NavigationRoom");dictionaryNameIndex.Add("AdminRoom");dictionaryNameIndex.Add("ShieldsRoom");dictionaryNameIndex.Add("CommunicationsRoom");dictionaryNameIndex.Add("StorageRoom");dictionaryNameIndex.Add("ElectricalRoom");dictionaryNameIndex.Add("LowerEngineRoom");dictionaryNameIndex.Add("ReactorRoom");dictionaryNameIndex.Add("SecurityRoom");
     }
 }
示例#2
0
    void Start()
    {
        pieces = GlobalVariables.instance.getPiece();
        //turnPlayer = one;

        if (boardSize % 2 == 0)
        {
            centerPoint = new Vector3(-TilePrefab.transform.localScale.x / 2, 4 * boardSize, -TilePrefab.transform.localScale.z / 2);
        }
        else
        {
            centerPoint = new Vector3(0, 4 * boardSize, 0);
        }
        Camera.main.transform.position = centerPoint;
        if (GameObject.Find("SetupObject"))
        {
            GameInfoHolder go = GameObject.Find("SetupObject").GetComponent <GameInfoHolder>();
            boardSize     = go.boardSize;
            promotionRows = go.promoRows;
            createBoard();
            if (boardSize % 2 == 0)
            {
                centerPoint = new Vector3(-TilePrefab.transform.localScale.x / 2, 4 * boardSize, -TilePrefab.transform.localScale.z / 2);
            }
            else
            {
                centerPoint = new Vector3(0, 4 * boardSize, 0);
            }
            Camera.main.transform.position = centerPoint;
            rules = go.rules;
            switch (go.ai)
            {
            case 0:     // player is versus another player do nothing
                break;

            case 1:     //player vs rando
                one.ai = new Rando();
                two.ai = new Rando();
                break;

            case 2:     //player vs xana
                one.ai = new Xana();
                two.ai = new Xana();
                break;

            case 3:     //player vs skynet
                one.ai = new Skynet();
                two.ai = new Skynet();
                break;

            default:
                break;
            }
            turnPlayer  = one;
            one.isWhite = true;
            two.isWhite = false;
            foreach (Piece item in go.white)
            {
                spawnPiece(one, item.number, new Vector2(item.position.y, item.position.x));
            }
            one.setup();
            foreach (Piece item in go.black)
            {
                spawnPiece(two, item.number, new Vector2(item.position.y, item.position.x));
            }
            two.setup();
            UILogic.instance.setup();
            doCaptured = go.useCaptured;
            if (go.player != 100)
            {
                if (go.player == 0)
                {
                    Camera.main.transform.rotation = one.camQ;
                    two.user = false;
                }
                else
                {
                    Camera.main.transform.rotation = two.camQ;
                    one.user = false;
                    //turnPlayer.takeTurn();
                }
            }
            if (go.ai == 0)
            {
                one.user = true;
                two.user = true;
            }
        }
        else
        {
            pieceBoard = new Piece[boardSize, boardSize];
            createBoard();
            rules = new Checkmate();
            //Debug.Log(pieces[0].title + "Here");
            //spawn white pieces
            for (int i = 0; i < 8; i++)
            {
                spawnPiece(one, 0, new Vector2(i, 1));
            }
            spawnPiece(one, 3, new Vector2(0, 0));
            spawnPiece(one, 3, new Vector2(7, 0));
            spawnPiece(one, 1, new Vector2(1, 0));
            spawnPiece(one, 1, new Vector2(6, 0));
            spawnPiece(one, 2, new Vector2(2, 0));
            spawnPiece(one, 2, new Vector2(5, 0));
            spawnPiece(one, 4, new Vector2(3, 0));
            spawnPiece(one, 5, new Vector2(4, 0));
            //black pieces
            for (int i = 0; i < 8; i++)
            {
                spawnPiece(two, 0, new Vector2(i, 6));
            }
            spawnPiece(two, 3, new Vector2(0, 7));
            spawnPiece(two, 3, new Vector2(7, 7));
            spawnPiece(two, 1, new Vector2(1, 7));
            spawnPiece(two, 1, new Vector2(6, 7));
            spawnPiece(two, 2, new Vector2(2, 7));
            spawnPiece(two, 2, new Vector2(5, 7));
            spawnPiece(two, 4, new Vector2(3, 7));
            spawnPiece(two, 5, new Vector2(4, 7));
            UILogic.instance.setup();
            sendMessage("Hello");
        }
    }