Пример #1
0
 private void Awake()
 {
     DontDestroyOnLoad(gameObject);
     SceneManager.sceneLoaded += OnSceneLoaded;
     pView = GetComponent <PhotonView>();
     if (!pView.IsMine)
     {
         return;
     }
     xpEarned          = 0;
     gameOver          = false;
     canExit           = false;
     outOfBounds       = false;
     damaged           = false;
     goldHealth        = false;
     falling           = false;
     handler           = GameObject.FindWithTag("gsh").GetComponent <GameSparksHandler>();
     username          = handler.getName();
     usernameText.text = username;
     pView.RPC("setUsername", RpcTarget.OthersBuffered, username);
     playerProp = new ExitGames.Client.Photon.Hashtable();
     int[] skinMatVals = skins.setMySkin(handler.getProfNum());
     playerProp.Add("skin", skinMatVals[0]);
     playerProp.Add("mat", skinMatVals[1]);
     PhotonNetwork.LocalPlayer.SetCustomProperties(playerProp, null, null);
     redScore         = 0;
     blueScore        = 0;
     countdown        = false;
     gameStarted      = false;
     blasts           = 0;
     deaths           = 0;
     blastText.text   = "" + 0;
     deathText.text   = "" + 0;
     gnc              = GameObject.FindGameObjectWithTag("GNC").GetComponent <gameNetworkController>();
     defaultSpeed     = speed;
     defaultJumpSpeed = jumpSpeed;
     canvas.gameObject.SetActive(true);
     gc.gameObject.SetActive(true);
     goldBlasterText.gameObject.SetActive(false);
     cam = GameObject.FindGameObjectWithTag("cam");
     if (cam == null)
     {
         Debug.Log("null cam found");
     }
     cam.gameObject.GetComponent <SmoothMouseLook>().setTheParent(transform);
     hp              = 100;
     sprinting       = false;
     runTime         = .4f;
     crossHair.color = Color.black;
     chColor         = crossHair.color;
     crossHairChange = false;
     dead            = false;
     cam.GetComponent <SmoothMouseLook>().enabled = true;
     waterPacks         = 0;
     waterPackText.text = "Water Packs: " + waterPacks;
     bubbleImg.gameObject.SetActive(false);
     bubbleImageShown = false;
     crossHitShown    = false;
     crossHairHit.gameObject.SetActive(false);
 }
    //Everything to be done on all players
    void Start()
    {
        //newly added condition in hopes of preventing error in finding gnc
        if (!pView.IsMine)
        {
            return;
        }
        gameStarted = false;
        gnc = GameObject.FindGameObjectWithTag("GNC").GetComponent<gameNetworkController>();
        defaultSpeed = speed;
        defaultJumpSpeed = jumpSpeed;
        dead = false;

        hp = 100;
        sprinting = false;
        runTime = .4f;
        waterPacks = 0;
        nextPosCheck = 0f;
        //random skill level 1-10
        skillLevel = Random.Range(1, 11);
    }
Пример #3
0
 public void beginGame()
 {
     gnc = GameObject.FindWithTag("GNC").GetComponent <gameNetworkController>();
     gnc.spawnMe();
 }