// Start is called before the first frame update
    void Start()
    {
        if (singleTon)
        {
            Destroy(gameObject);//destroy this gameobject if singleton is already set because there's a singleton out there
        }
        else
        {
            singleTon = this;
            DontDestroyOnLoad(gameObject);//don't destroy this wehn we load a new scene otherwise we will loose this game object

            //show connection screen
            panelHostDetails.gameObject.SetActive(true);
            panelUsername.gameObject.SetActive(false);
            panelGameplay.gameObject.SetActive(false);
        }

        //test Buffer class;
        //Buffer buff = Buffer.Alloc(10);//should create a new byte array that holds 10 bytes
        //Buffer buff = Buffer.From("Hello World");

        /*  buff.Concat(Buffer.From("A WHOLE OTHER HELLO WORLD"));
         * //buff.WriteInt8(-123, 1);
         * //buff.WriteBytes(new byte[] { 0, 5}, 0);
         * //buff.WriteUInt16LE(517, 0);
         * //print(buff.ReadUInt16LE(0));
         * //print(buff.ReadUInt16BE(0));
         * print(buff);
         * print(buff.ReadString());*/
    }
Example #2
0
    // Start is called before the first frame update
    void Start()
    {
        panelGameplay.GetComponent <ControllerGameplay>();
        if (singleton)
        {
            // already set...
            Destroy(gameObject); // there's already one out there.....
        }
        else
        {
            singleton = this;
            DontDestroyOnLoad(gameObject); // dont destroy when loading new scenes!

            // show connection screen:
            panelHostDetails.gameObject.SetActive(true);
            panelUsername.gameObject.SetActive(false);
            panelGameplay.gameObject.SetActive(false);
        }


        // Buffer buff = Buffer.Alloc(4);
        // buff.Concat(new byte[] { 1, 2, 3, 4 },-1);
        // buff.Consume(3);
        // print(buff);
    }
 void Start()
 {
     if (singleton)
     {
         // already set...
         Destroy(gameObject); //there's already one out there...
     }
     else
     {
         singleton = this;
         DontDestroyOnLoad(gameObject); // don't destroy when loading a new scene
         SwitchToPanel(Panel.Host);
     }
 }
    //public GameplayController panelGameplay;

    void Start()
    {
        // buffer.validPacketIdentifyers = new string[] {"JOIN", "UPDT", "CHAT"};

        //implimented singleton design pattern
        if (singleton)
        {
            Destroy(gameObject); //there's already one out there.....
        }
        else
        {
            singleton = this;
            DontDestroyOnLoad(gameObject); //don't destroy when you load a new scene

            //controllerGameplay.SwitchScreenState(ScreenState.Conection);
        }
    }
    void Start()
    {
        if (singleton)
        {
            //already set...
            Destroy(gameObject); // there's already on out there.... and we dont want two
        }
        else
        {
            singleton = this;
            DontDestroyOnLoad(gameObject); //dont destroy when loading new scenes!

            // show connection screen
            panelHostDetails.gameObject.SetActive(true);
            panelUsername.gameObject.SetActive(false);
            panelGameplay.gameObject.SetActive(false);
        }
    }
Example #6
0
    void Start()
    {
        buffer.validPacketIdentifyers = new string[] { "JOIN", "UPDT", "CHAT" };

        //implimented singleton design pattern
        if (singleton)
        {
            Destroy(gameObject); //there's already one out there.....
        }
        else
        {
            singleton = this;
            DontDestroyOnLoad(gameObject); //don't destroy when you load a new scene
            paneHostDetails.gameObject.SetActive(true);
            panelUsername.gameObject.SetActive(false);
            panelGameplay.gameObject.SetActive(false);
        }
    }
Example #7
0
    void Start()
    {
        if (singleton)
        {
            // already set...
            Destroy(gameObject); //there's already one out there...
        }
        else
        {
            singleton = this;
            DontDestroyOnLoad(gameObject); // don't destroy when loading a new scene

            // show connection screen:
            panelHostDetails.gameObject.SetActive(true);
            panelUsername.gameObject.SetActive(false);
            panelGameplay.gameObject.SetActive(false);
        }

        Buffer buff = Buffer.Alloc(4);

        buff.Concat(new byte[] { 1, 2, 3, 4 }, 0);
        buff.Consume(10);
        print(buff);
    }