Ejemplo n.º 1
0
    void Start()
    {
        Cursor.visible              = !Cursor.visible;
        Cursor.lockState            = CursorLockMode.Locked;
        QualitySettings.vSyncCount  = 0; // VSync must be disabled
        Application.targetFrameRate = 30;
        players      = new Dictionary <int, GameObject>();
        hpTxt        = GameObject.Find("hp").GetComponent <Text>();
        dmTxt        = GameObject.Find("dm").GetComponent <Text>();
        youTxt       = GameObject.Find("youTxt").GetComponent <Text>();
        maxTxt       = GameObject.Find("maxTxt").GetComponent <Text>();
        timeTxt      = GameObject.Find("timeTxt").GetComponent <Text>();
        recordTxt    = GameObject.Find("recordTxt").GetComponent <Text>();
        hpFill       = GameObject.Find("hpfill").GetComponent <Image>();
        keyMenu      = GameObject.Find("menuchiavi").GetComponent <KeyMenu>();
        quitmenu     = GameObject.Find("quitmenu").transform;
        UI           = GameObject.Find("UI");
        respawnTimer = GameObject.Find("esito").GetComponent <RespawnTimer>();
        materieShow  = GameObject.Find("materieshow").GetComponent <MaterieShow>();
        cam          = GameObject.Find("Camera").GetComponent <CameraController>();
        overlayItems = new List <OverlayControl>((OverlayControl[])GameObject.FindObjectsOfType(typeof(OverlayControl)));
        nm           = GameObject.Find("NetworkManager").GetComponent <NetworkManager>();
        maxTxt.text  = nm.getConfiguration().kills.ToString();

        if (nm.getConfiguration().time2newmatch > 0)
        {
            timeLeft = 0;
            respawnTimer.Start(nm.getConfiguration().time2newmatch, "Partita terminata!");
        }
        else
        {
            timeLeft = nm.getConfiguration().timeLeft;
        }

        calculateProperties();

        nm.nc.RegisterHandler(100, MatchEnded);
        nm.nc.RegisterHandler(101, MatchStarted);
        nm.nc.RegisterHandler(778, OnWelcome);
        nm.nc.RegisterHandler(811, OnEnemyConnect);

        ServerAuth serverAuth = new ServerAuth();

        serverAuth.username = username;
        serverAuth.media    = baseDamage;
        Debug.Log("Connected: " + nm.nc.isConnected);
        nm.nc.Send(777, serverAuth);
        regenerateMaterie();
    }
Ejemplo n.º 2
0
 public FunctionKey(KeyType type, KeyMenu action)
 {
     Type   = (byte)type;
     Action = (int)action;
 }