Example #1
0
    private void Awake()
    {
        if (instance == null)
        {
            DontDestroyOnLoad(gameObject);
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        if (GameObject.Find("Create Ships Controller") != null)
        {
            shipController.GetComponent <CreateShipsController>().SetGameInfoReference(this);
        }

        else if (GameObject.Find("Game Controller") != null)
        {
            gameController.GetComponent <GameController>().SetGameInfoReference(this);
        }

        battleship    = 1;
        cruiser       = 2;
        destroyer     = 4;
        submarine     = 3;
        submarineSize = 2;

        pcBattleship = 1;

        for (int k = 0; k < 100; k++)
        {
            playerBoard[k] = "0";
        }

        for (int k = 0; k < 10; k++)
        {
            for (int l = 0; l < 10; l++)
            {
                pcBoard[k, l] = "0";
            }
        }

        setPCBoard();
    }
Example #2
0
    private void Awake()
    {
        if (instance == null)
        {
            DontDestroyOnLoad(gameObject);
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        if (GameObject.Find("Create Ships Controller") != null)
        {
            shipController.GetComponent <CreateShipsController>().SetGameInfoReference(this);
        }

        else if (GameObject.Find("Game Controller") != null)
        {
            gameController.GetComponent <GameController>().SetGameInfoReference(this);
        }

        battleship    = 1;
        cruiser       = 2;
        destroyer     = 4;
        submarine     = 3;
        submarineSize = 2;

        pcBattleship = 1;
        //carrier = 1;
        //carrier_size = 4;
        //carrier_placed = false;

        //pc_carrier = 1;
        //pc_carrier_size = 4;
        //pc_carrier_placed = false;
        //shipController = GetComponent<CreateShipsController>();

        for (int k = 0; k < 100; k++)
        {
            playerBoard[k] = "0";
        }

        for (int k = 0; k < 10; k++)
        {
            for (int l = 0; l < 10; l++)
            {
                pcBoard[k, l] = "0";
            }
        }

        setPCBoard();

        //for (int i = 0; i < 10; i++)
        //{
        //    for (int j = 0; j < 10; j++)
        //    {
        //        Debug.Log(pcBoard[i, j]);
        //    }
        //    Debug.Log("");
        //}
    }