コード例 #1
0
    //int toolbarint = 0;
    //string[] toolbarstrings = new string[]{"Toolbar 1", "Toolbar 2","Toolbar 3", "Toolbar 4"};
    void Awake()
    {
        networkScript = GameObject.Find("NetworkCode").GetComponent<NetworkGame>();

        playersScores = new List<PlayerScore>();

        //scoreTitle.material.color = Color.yellow;
        if(scoreTitle != null)
        scoreTextStyle.font = scoreTitle;

        scoreTextStyle.alignment = TextAnchor.MiddleCenter;
        scoreTextStyle.normal.textColor = Color.yellow;
        scoreTextStyle.fontSize = 30;

        screenX = Screen.width * 0.5f - scoreMenuHeight * 0.5f;
        screenY = Screen.height * 0.5f - scoreMenuWidth * 0.5f;

        Script = this;
    }
コード例 #2
0
    /* -------------------------------------------------------------------------------------------------------- */
    /*
     * UNITY STUFF
     */
    /* -------------------------------------------------------------------------------------------------------- */
    void Awake()
    {
        Script = this;

        scoreScript = GameObject.Find("GameCode").GetComponent<ScoreCounter>();

        networkScript = GameObject.Find("NetworkCode").GetComponent<NetworkGame>();

        levelTimer = (2 + networkScript.levelTimeNetworkGame) * 60;
        //levelTimer = 5.0f;

        menuTime = Time.time;
    }
コード例 #3
0
    /* -------------------------------------------------------------------------------------------------------- */
    /*
     * UNITY STUFF
     */
    /* -------------------------------------------------------------------------------------------------------- */
    // Use this for initialization
    void Awake()
    {
        Script = this;

        // Background stuff
        mainScreenBGPos.x = 0;
        mainScreenBGPos.y = 0;

        mainScreenBGPos.width = Screen.width;
        mainScreenBGPos.height = Screen.height;

        // Menu stuff
        screenX = Screen.width * 0.5f - menuWidth * 0.5f;
        screenY = Screen.height * 0.5f - menuHeight * 0.5f;
        //screenY = Screen.height * 0.5f - menuHeight * 0.5f;
        currentMenu = MainMenu;

        // Host game window stuff
        subMenuWindow.x = Screen.width * 0.5f - hostMenuWidth * 0.5f;
        subMenuWindow.y = (Screen.height * 0.5f - hostMenuHeight * 0.5f) + hostMenuOffsetY;

        subMenuWindow.width = hostMenuWidth;
        subMenuWindow.height = hostMenuHeight;

        // Network stuff
        netScript = GameObject.Find("NetworkCode").GetComponent<NetworkGame>();
        serverName = netScript.GetServerName();

        if(playerName == null || playerName == "") {

            playerName = "RandomName" + Random.Range(1,999);
        }
    }
コード例 #4
0
    /* -------------------------------------------------------------------------------------------------------- */
    /*
     * UNITY STUFF
     */
    /* -------------------------------------------------------------------------------------------------------- */
    void Awake()
    {
        Script = this;

        //http://unity3d.com/support/documentation/Components/net-NetworkLevelLoad.html
        DontDestroyOnLoad(this);
        networkView.group = 1;

        /* HACK TO USE LOCAL MASTER SERVER */
        /*
        MasterServer.ipAddress = "127.0.0.1";
        MasterServer.port = 23466;
        Network.natFacilitatorIP = "127.0.0.1";
        Network.natFacilitatorPort = 50005; // your own port number
        */
    }