Example #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);
 }
 //set friends data (called froom gamesparks handler) which then gets all friends records and such
 public void setfriendData(GSData gsDat)
 {
     friends     = gsDat.GetGSData("friends").BaseData;
     friendsIDS  = friends.Keys;
     requests    = gsDat.GetGSData("requests").BaseData;
     requestsIDS = requests.Keys;
     friendsData = new int[friendsIDS.Count, 6];
     gsh         = GameObject.FindGameObjectWithTag("gsh").GetComponent <GameSparksHandler>();
     //sets the number of friend requests on the main screem
     numRequests.text = "" + requests.Count;
     if (requests.Count > 0)
     {
         requestsBackground.gameObject.SetActive(true);
     }
     else
     {
         requestsBackground.gameObject.SetActive(false);
     }
     playerStats     = gsh.getData();
     displayName     = gsh.getName();
     blastLeadAmount = playerStats[0];
     winLeadAmount   = playerStats[2];
     if (playerStats[1] != 0)
     {
         bkLeadAmount = (float)playerStats[0] / playerStats[1];
     }
     else
     {
         bkLeadAmount = (float)playerStats[0];
     }
     getFriendsStats();
 }
    // Use this for initialization
    void Start()
    {
        pView = pc.GetComponent <PhotonView>();
        if (!pView.IsMine)
        {
            return;
        }
        correctStreak  = 0;
        gameOver       = true;
        questionMode   = false;
        Cursor.visible = false;
        paused         = false;

        imageHolder.SetActive(false);
        pauseMenu.SetActive(false);

        gameSparksHandler = GameObject.FindWithTag("gsh").GetComponent <GameSparksHandler>();
        words             = gameSparksHandler.getWords();
        defs      = gameSparksHandler.getDefs();
        defs2     = gameSparksHandler.getDefs2();
        misspell1 = gameSparksHandler.getMisspell();
        misspell2 = gameSparksHandler.getMisspell2();
        misspell3 = gameSparksHandler.getMisspell3();
        listID    = gameSparksHandler.getIDS();
        type      = gameSparksHandler.getTypes();
        listEmpty = gameSparksHandler.getListEmptys();
        studyXP   = gameSparksHandler.getStudyXPS();



        settings = gameSparksHandler.getSettings();

        numSets = 0;
        for (int i = 0; i < listID.Length; i++)
        {
//            Debug.Log("List Empty " + i + " val " + listEmpty[i]);
            if (!listEmpty[i])
            {
                indexes.Add(i);
                Debug.Log("id: " + listID[i]);
                numSets++;
            }
        }
        for (int i = 0; i < 10; i++)
        {
            if (!listEmpty[i])
            {
                donePhrases[i] = new bool[words[i].Length];
            }
        }
        //numSets = words.Length;
        //Debug.Log("sets: " + numSets);
    }