예제 #1
0
    void init()
    {
        GameBoard = new gameBoard[10][];
        for (int i = 0; i < 10; i++)
        {
            GameBoard[i] = new gameBoard[10];
        }
        for (int i = 0; i < 10; i++)
        {
            for (int j = 0; j < 10; j++)
            {
                GameBoard[i][j] = new gameBoard();
            }
        }
        currentSelectedPiece = new gameBoard();
        validCoordinates     = new SC_DefiendVariables.Point[4];
        for (int i = 0; i < 4; i++)
        {
            validCoordinates[i] = new SC_DefiendVariables.Point();
        }
        enemyArray = new List <SC_PieceLogic>();



        currentTurn = (SC_DefiendVariables.Turn)UnityEngine.Random.Range(0, 2);
        print("CurrentTurn see if its working= " + currentTurn);
    }
예제 #2
0
    void ConsumePellet()
    {
        GameObject o = GetTileAtPosition(transform.position);  //pellet object created with correct coordinates

        if (o != null)
        {
            Pills tile = o.GetComponent <Pills>(); //gets pill information
            if (tile != null)
            {
                if (!tile.Consumed && (tile.isPellet || tile.isLargePellet))
                {                                                      //tile has visible pellet and is a pellet of some form
                    o.GetComponent <SpriteRenderer>().enabled = false; //make oill invisible
                    tile.Consumed = true;                              //update system
                    GameObject temp = GameObject.Find("Game");         //get the game object.
                    gameBoard  game = temp.GetComponent <gameBoard>(); //get the game state
                    game.score();                                      //score
                    game.munch();
                    if (tile.isLargePellet)
                    {
                        GhostController.ScaredTimer = 0f;
                        GhostController.IsScared    = true;
                    }
                    //game.addTime(BUFFER_PILL_TIME);// WORKS AT SPEED 5 or maybe sorta (.45f*(5/speed))
                    //if (!temp.GetComponent<AudioSource>().isPlaying)
                    //{
                    //    temp.GetComponent<AudioSource>().Play();
                    //}
                }
            }
        }
    }
예제 #3
0
        private void btnSingle_Click(object sender, RoutedEventArgs e)
        {
            //main.Visibility = Visibility.Hidden;

            lobbyVals test = new lobbyVals();

            test.difficulty = 2;
            test.players[0] = "Dave";
            test.roles[0] = 3;
            test.players[1] = "Bob";
            test.roles[1] = 2;

            test.slots[2] = false;
            test.slots[3] = false;

            //Game.game gameTest = new Game.game(test);
            gameBoard board = new gameBoard();
            board.Show();
        }
    void ConsumePellet()
    {
        GameObject o = GetTileAtPosition(transform.position);  //pellet object created with correct coordinates

        if (o != null)
        {
            Pills tile = o.GetComponent <Pills>(); //gets pill information
            if (tile != null)
            {
                if (!tile.Consumed && (tile.isPellet || tile.isLargePellet))
                {                                                      //tile has visible pellet and is a pellet of some form
                    o.GetComponent <SpriteRenderer>().enabled = false; //make oill invisible
                    tile.Consumed = true;                              //update system
                    GameObject temp = GameObject.Find("Game");         //get the game object.
                    gameBoard  game = temp.GetComponent <gameBoard>(); //get the game state
                    game.score();                                      //score
                    game.munch();

                    totalPellets++;

                    if (totalPellets == allPellets)  // allPellets = 191

                    {
                        GhostController.canCruise = false;

                        GetComponent <Animator>().enabled      = false;
                        GetComponent <SpriteRenderer>().sprite = nextLevel;


                        GameObject.Find("Game").GetComponent <gameBoard>().LevelUp();
                    }



                    if (totalPellets == cruisePellets) // cruisePellets = 140, after 140 pellets blinky speeds up
                    {
                        GhostController.canCruise = true;
                        //GhostController.cruiseElroy();
                    }

                    if (tile.isLargePellet)
                    {
                        if (GhostController.IsScared)
                        {
                            Debug.Log("Ghost # = " + ghostCounter);
                        }
                        else
                        {
                            ghostCounter = 1;
                        }
                        GhostController.ScaredTimer = 0f;
                        GhostController.IsScared    = true;
                    }



                    //game.addTime(BUFFER_PILL_TIME);// WORKS AT SPEED 5 or maybe sorta (.45f*(5/speed))
                    //if (!temp.GetComponent<AudioSource>().isPlaying)
                    //{
                    //    temp.GetComponent<AudioSource>().Play();
                    //}
                }
            }
        }
    }