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

        if (GameObject.Find("Login Controller") != null)
        {
            loginController.GetComponent <ButtonLoginRegister>().SetGeneralInfoReference(this);
        }

        else if (GameObject.Find("Menu Controller") != null)
        {
            menuController.GetComponent <ButtonMenu>().SetGeneralInfoReference(this);
        }

        else if (GameObject.Find("Score Controller") != null)
        {
            scoreController.GetComponent <ScoreMenu>().SetGeneralInfoReference(this);
        }
        else if (GameObject.Find("Game Controller") != null)
        {
            gameController.GetComponent <GameController>().SetGeneralInfoReference(this);
        }
    }
Example #2
0
    private void Awake()
    {
        setGameControllerReferenceOnButtons();
        gameInfo     = (GameInfo)FindObjectOfType(typeof(GameInfo));
        generalInfo  = (generalInfo)FindObjectOfType(typeof(generalInfo));
        playerSide   = "player";
        textBox.text = "";

        textBoxBattleship.text = "Battleship: " + pcBattleship;
        textBoxCruiser.text    = "Cruiser: " + pcCruiser;
        textBoxSubmarine.text  = "Submarine: " + pcSubmarine;
        textBoxDestroyer.text  = "Destroyer: " + pcDestroyer;

        this.pcBoard     = gameInfo.pcBoard;
        this.playerBoard = gameInfo.playerBoard;
    }
Example #3
0
 public void SetGeneralInfoReference(generalInfo info)
 {
     generalInfo = info;
 }
 internal void SetGeneralInfoReference(generalInfo info)
 {
     generalInfo = info;
 }
 private void Awake()
 {
     generalInfo = (generalInfo)FindObjectOfType(typeof(generalInfo));
 }