Exemple #1
0
 void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
Exemple #2
0
    void Start()
    {
        player = new PlayerGlobal();
        if (transform.name != "Main Canvas" || transform.name == "Network")
        {
            DontDestroyOnLoad(this.gameObject);
        }
        var config = new NetPeerConfiguration("of_masterserver")
        {
            ReceiveBufferSize = 4096,
            SendBufferSize    = 4096
        };

        client = new NetClient(config);
        client.Start();
        client.Connect("79.174.12.222", 57125);

        StartCoroutine("CheckVersion");
    }
Exemple #3
0
    // Start is called before the first frame update
    void Start()
    {
        gameActive         = false;
        coverSpawnLocation = 0;

        SoundManager.instance.menuMusic.Stop();

        for (int i = 0; i < coverPool.Length; i++)
        {
            GameObject obj = (GameObject)Instantiate(cover);
            coverPool[i] = obj;
            coverPool[i].SetActive(false);
        }

        for (int i = 0; i < powerUpPool.Length; i++)
        {
            GameObject obj = (GameObject)Instantiate(powerUp);
            powerUpPool[i] = obj;
            powerUpPool[i].SetActive(false);
        }
        _player1          = playerOne.GetComponent <PlayerGlobal>();
        _player2          = playerTwo.GetComponent <PlayerGlobal>();
        playerOneStartPos = playerOne.transform.position;
        playerTwoStartPos = playerTwo.transform.position;

        healthThreshold = _player1.maxHealthPoints / 2;

        SoundManager.instance.musicSource.Play();

        playerOneAmmo.text   = _player1.currentClipSize.ToString();
        playerTwoAmmo.text   = _player2.currentClipSize.ToString();
        playerOneReload.text = " ";
        playerTwoReload.text = " ";
        leftCountdown.text   = " ";
        rightCountdown.text  = " ";
        roundTextLeft.text   = " ";
        roundTextRight.text  = " ";
        StartCoroutine(StartUp("Round 1"));
    }
Exemple #4
0
 void SetAmmoText(Text ammoText, Text reloadText, Image unlimAmmo, Text relaodIndicator, PlayerGlobal player)
 {
     ammoText.text = player.currentClipSize.ToString();
     if (player.currentClipSize <= 0)
     {
         ammoText.text   = " ";
         reloadText.text = "Reload!";
         relaodIndicator.gameObject.SetActive(true);
     }
     else
     {
         reloadText.text = " ";
         relaodIndicator.gameObject.SetActive(false);
     }
     if (player.unlimAmmo)
     {
         ammoText.text     = " ";
         reloadText.text   = " ";
         unlimAmmo.enabled = true;
     }
     else
     {
         unlimAmmo.enabled = false;
     }
 }