Beispiel #1
0
 void SetID(int ID)
 {
     this.ID = ID;
     CBUG.Do("Recording ID " + ID + " with Gamemaster.");
     CBUG.Do("Character is: " + gameObject.name);
     GameManager.AddPlayer(ID, gameObject);
 }
Beispiel #2
0
 private void startMatch()
 {
     CBUG.Do("WAIT UI STARTING MATCH!");
     //j.GameStarted(N.GetSlotNum(PhotonNetwork.player.ID));
     transform.GetChild(0).gameObject.SetActive(false);
     PlayerHead.sprite = getImage(getImageNum());
 }
Beispiel #3
0
    // Update is called once per frame
    void Update()
    {
        if (!DoneInstantiating)
        {
            if (_cityData != null && _stateData != null && dataLoaded)
            {
                DoneInstantiating = true;
            }

            if (_cityData == null && _cityData.Length > 0)
            {
                CBUG.Do("City Data not yet loaded.");
            }
            else
            {
                string temp = "Sampling CSV Data: " + _cityData[0].City + " in " + _cityData[0].State;
                CBUG.Do(temp);
            }

            if (_stateData == null && _stateData.Length > 0)
            {
                CBUG.Do("State Data not yet loaded.");
            }
            else
            {
                string temp2 = "Sampling CSV Data: " + _stateData[0].State + " is " + _stateData[0].StateAbbreviation;
                CBUG.Do(temp2);
            }
        }
    }
Beispiel #4
0
 private void makeCityList()
 {
     while (!dataLoaded)
     {
         currentCity++;
         cityDataByState[currentState].Add(
             new City(
                 _cityData[currentCity].CriteriaID,
                 _stateData[currentState].ID,
                 _cityData[currentCity].City,
                 _cityData[currentCity].State,
                 _stateData[currentState].StateAbbreviation
                 )
             );
         if (_cityData[currentCity].State != _stateData[currentState].State)
         {
             StateNameToID.Add(_stateData[currentState].State, _stateData[currentState].ID);
             StateNameToID.Add(_stateData[currentState].StateAbbreviation, _stateData[currentState].ID);
             currentState++;
         }
         if (currentState >= TotalStates || currentCity >= _cityData.Length - 1)
         {
             dataLoaded = true;
             CBUG.Do("Data Loaded!");
         }
     }
 }
Beispiel #5
0
 public static void GameMusic()
 {
     CBUG.Do("Game Music!");
     FindObjectOfType <MusicManager>().MySource.Stop();
     FindObjectOfType <MusicManager>().MySource.clip = GameObject.FindObjectOfType <MusicManager>().GameClip;
     FindObjectOfType <MusicManager>().MySource.Play();
 }
Beispiel #6
0
    private void _RecordDeath(int killer, int killed, bool isDisconnect)
    {
        /*
         * Players know when they've killed someone, but they think they
         * suicided when someone kills them.
         */
        //Not sure if above is still issue.

        if (isDisconnect)
        {
            killer = -1;
            CBUG.Do("Player " + killed + " disconnected midgame!");
            playerLives[killed] = 0;
        }
        else
        {
            //Note: Killer=-1 means player suicided.
            if (killer != -1)
            {
                killsMatrix[killer, killed]++;
                CBUG.Do("Player " + (killer + 1) + " knocked out Player " + (killed + 1));
            }
            else
            {
                CBUG.Do("Player " + (killed + 1) + " Suicided!");
            }
            playerLives[killed]--;
        }
    }
 void SetSlotNum(int SlotNUm)
 {
     this.SlotNum = SlotNUm;
     CBUG.Do("Recording ID " + SlotNUm + " with Gamemaster.");
     CBUG.Do("Character is: " + gameObject.name);
     GameManager.AddPlayer(SlotNUm, gameObject);
 }
Beispiel #8
0
 public static void ElevatorMusic()
 {
     CBUG.Do("Elevator Music!");
     FindObjectOfType <MusicManager>().MySource.Stop();
     FindObjectOfType <MusicManager>().MySource.clip = GameObject.FindObjectOfType <MusicManager>().ElevatorClip;
     FindObjectOfType <MusicManager>().MySource.Play();
 }
Beispiel #9
0
 void Start()
 {
     showAnyway = (PlayerPrefs.GetInt("CBUG_ON", 0) == 1);
     if (showAnyway)
     {
         CBUG.Do("CBUG ENABLED MANUALLY!");
     }
 }
Beispiel #10
0
    // Update is called once per frame
    void Update()
    {
        x += RotSpeed;
        y += RotSpeed;

        myRotation.Set(x, y, 0f);
        gameObject.transform.rotation = Quaternion.Euler(myRotation); //Rotate(myRotation);
        CBUG.Do("ROTATING");
    }
            //    private void UpdateHurt()
            //    {
            //        if(invincibilityCount>=0)
            //            invincibilityCount--;
            //    }

            //    private void updateSpecials()
            //    {
            //        if (Input.GetButtonDown("Special") && invincibilityCount < 0)
            //        {
            //            _PhotonView.RPC("SpecialActivate", PhotonTargets.All);
            //            PauseMvmnt();
            //        }
            //    }

            private void updateJumping()
            {
                if (Input.GetButtonDown("Jump") == true && jumpsRemaining > 0)
                {
                    applyJumpPhysics = true;
                    CBUG.Do("Jumped is true!");
                    jumpsRemaining -= 1;
                }
            }
Beispiel #12
0
 void Update()
 {
     if (ObjectPlace.GetComponentInChildren <MeshRenderer>().enabled&& !finishedAlready)
     {
         finishedAlready = true;
         CBUG.Do("Level Victory! From: " + player);
         gameManager.GetComponent <PhotonView>().RPC("PlayerMoveToNextFloor", RpcTarget.All, player);
         //gameManager.PlayerMoveToNextFloor(player);
     }
 }
    // Use this for initialization
    void Start()
    {
        CBUG.Do("Online Character Spawned!");
        _PM = PhotonArenaManager.Instance;

        if (GetComponent <PhotonView>().IsMine == false)
        {
            Destroy(GetComponentInChildren <Camera>().gameObject);
        }
    }
Beispiel #14
0
 /// <summary>
 /// Goes from MAX_CARDS -> 0
 /// </summary>
 public static void RoleUp()
 {
     CBUG.Do("Activated Up!");
     if (currentNum - 1 < 0) //==1 because we never move up last card
     {
         return;
     }
     currentNum--;
     currentPage = _Pages[currentNum];
     currentPage.GetComponent <Animator>().SetBool("IsIn", false);
 }
Beispiel #15
0
 /// <summary>
 /// Goes from 0 -> MAX_CARDS
 /// </summary>
 public static void RoleDown()
 {
     CBUG.Do("Activated Down!");
     if (currentNum + 1 > _Pages.Length)
     {
         return;
     }
     currentPage.GetComponent <Animator>().SetBool("IsIn", true);
     currentNum++;
     currentPage = _Pages[currentNum >= _Pages.Length ? _Pages.Length - 1 : currentNum];
 }
Beispiel #16
0
    private IEnumerator loadStateDataWeb(string path)
    {
        CBUG.Do("State Path is: " + path);
        WWW www = new WWW(path);

        yield return(www);

        stateCSVWeb = www.text;
        _stateData  = engine_StateData.ReadString(stateCSVWeb);
        makeCityList();
    }
 private void updateJumpingPhysics()
 {
     if (applyJumpPhysics)
     {
         CBUG.Do("JUMP!");
         CBUG.Do("JUMP!");
         applyJumpPhysics        = false;
         _Rigibody3D.isKinematic = true;
         _Rigibody3D.position   += new Vector3(0f, 500f, 0f);
         _Rigibody3D.isKinematic = false;
     }
 }
Beispiel #18
0
    void Pickup(int itemId, PhotonMessageInfo info)
    {
        cItem = neighbourhoodMan.allItems[itemId] = detector.closeObj;

        CBUG.Do("MY PHOTRON ID IS " + photonView.ViewID);

        charAnim.SetBool("Packing", true);

        cItem.transform.parent           = holdPos;
        cItem.transform.localPosition    = cItem.localPos;
        cItem.transform.localEulerAngles = cItem.localErot;
        cItem.collido.enabled            = false;
        cItem.rby.isKinematic            = true;

        if (photonView.IsMine)
        {
            canAttack = true;
            hudMan.SetInstructionText(1);
            playerState = PlayerState.Holding;

            bool pos = false;
            for (int i = 0; i < cItem.traits.Count; i++)
            {
                if (cItem.traits[i] == myPersonality)
                {
                    pos = true;
                }
            }

            if (pos == true)
            {
                positiveObj.SetActive(true);
                Invoke("TurnOffParticleFx", 1.5f);
            }
            else
            {
                bool neg = false;
                for (int i = 0; i < cItem.negativeTraits.Count; i++)
                {
                    if (cItem.negativeTraits[i] == myPersonality)
                    {
                        neg = true;
                    }
                }

                if (neg == true)
                {
                    negativeObj.SetActive(true);
                    Invoke("TurnOffParticleFx", 1.5f);
                }
            }
        }
    }
Beispiel #19
0
    private IEnumerator StartBoilBuffer()
    {
        CBUG.Do("STARTING BOIL!!");
        isBuffered = true;
        yield return(boilBuffer);

        if (CanBoil && !GameControls.IsQuizTime())
        {
            IsBoiling = true;
            Tips.Spawn(0);
        }
        isBuffered = false;
    }
    public override void OnConnectedToMaster()
    {
        base.OnConnectedToMaster();

        CBUG.Do("Connected To Master! Joining Lobby ...");
        TypedLobby sqlLobby = new TypedLobby("Lobby", LobbyType.SqlLobby);
        bool       success  = PhotonNetwork.JoinLobby(sqlLobby);

        if (!success)
        {
            CBUG.Do("PunCockpit: Could not join Lobby ...");
        }
    }
 // Update is called once per frame
 void Update()
 {
     if (!testRan && TestInRelease && ParseManager.DoneInstantiating && URLLoader.DoneInstatiating)
     {
         if (!Application.isEditor && !TestInRelease)
         {
             return;
         }
         testRan = true;
         URLLoader.BuildURL(URLLoader.GetDataFrom(TestURL + "?" + TestCode).ToArray());
         CBUG.Do("Retrieved URL: " + URLLoader.URL);
     }
 }
 //[PunRPC]
 private void netDie()
 {
     CBUG.Do("DIED!");
     dieSound.Play();
     isDead = true;
     ArmLeft.transform.SetParent(null);
     ArmLeft.GetComponent <Rigidbody>().isKinematic = false;
     ArmLeft.GetComponent <BoxCollider>().isTrigger = false;
     ArmRight.transform.SetParent(null);
     ArmRight.GetComponent <BoxCollider>().isTrigger = false;
     ArmRight.GetComponent <Rigidbody>().isKinematic = false;
     Body.transform.SetParent(null);
     Body.GetComponent <Rigidbody>().isKinematic = false;
     Head.transform.SetParent(null);
     Head.GetComponent <Rigidbody>().isKinematic = false;
 }
Beispiel #23
0
    private void updateJumping()
    {
        //bool K = ();

        CBUG.Do(Input.GetAxisRaw("Jump") + "");

        if ((Input.GetButtonDown("Jump") == true ||
             _MobileInput.GetButtonDown("Jump") || Input.GetAxisRaw("Jump") > 0f) &&
            jumpsRemaining > 0 && totalJumpFrames < 0)
        {
            jumped = true;
            //CBUG.Log("Jumped is true!");
            jumpsRemaining -= 1;
            totalJumpFrames = jumpLag;
        }
        totalJumpFrames -= 1;
    }
    public IEnumerator LerpVolume2(float from, float to)
    {
        bool lerpUp = false;

        if (from < to)
        {
            lerpUp = true;
        }

        CBUG.Do("Lerping 2");

        float startTime = Time.time;

        if (lerpUp)
        {
            CBUG.Do("LERP UP");
            while (MusicBox2.volume <= to - 0.01f)
            {
                MusicBox2.volume = Mathf.Lerp(from, to, (Time.time - startTime) / fadeLength);
                //CBUG.Do("Lerp in Vol2: " + MusicBox2.volume);
                yield return(null);
            }
        }
        else
        {
            CBUG.Do("LERP DOWN");
            CBUG.Do("Playing down to " + to + " and currentVol for 2 is: " + MusicBox2.volume);
            while (MusicBox2.volume >= to + 0.01f)
            {
                MusicBox2.volume = Mathf.Lerp(from, to, (Time.time - startTime) / fadeLength);
                //CBUG.Do("Lerp in Vol2: " + MusicBox2.volume);
                yield return(null);
            }
        }

        isSwitching = false;
        CBUG.Do("IsSwitching IS OFF in 2");
        //NOT Only on LerpVolume1 ...??
        if (nextSongNum != -1)
        {
            SwitchSong(nextSongNum);
        }
    }
    // Just for reloading the scene! You can delete this function entirely if you want to
    void Update()
    {
        if (reloadSceneButton)
        {
            if (Input.GetKeyDown(KeyCode.R))
            {
                SceneManager.LoadScene("Menu");
            }
        }

        if (PhotonArenaManager.Instance.CurrentServerUserDepth == PhotonArenaManager.ServerDepthLevel.InRoom)
        {
            if (PhotonArenaManager.Instance.GetRoom().PlayerCount > 1)
            {
                // Has game already started?
                var gameStartData = PhotonArenaManager.Instance.GetData("GameStartTime");

                if (gameStartData == null)
                {
                    PhotonArenaManager.Instance.SaveData("GameStartTime", PhotonArenaManager.Instance.GetClock());
                }
                else
                {
                    int gameStartTime = (int)gameStartData;
                    CBUG.Do("start time is " + gameStartTime);

                    if ((PhotonArenaManager.Instance.GetClock() - gameStartTime) / 1000 < quizTimeLength)
                    {
                        SceneManager.LoadScene("PersonalitySelection");
                        SceneManager.UnloadSceneAsync("Menu");
                    }
                    else
                    {
                        foreach (var photonObj in GameObject.FindGameObjectsWithTag("LocalPlayer"))
                        {
                            PhotonNetwork.LocalCleanPhotonView(photonObj.GetComponent <PhotonView>());
                        }
                        PhotonArenaManager.Instance.NewRoom();
                    }
                }
            }
        }
    }
Beispiel #26
0
    // Update is called once per frame
    void Update()
    {
        if (!gameStarted || IsLocalGame || gameEnded)
        {
            return;
        }

        if (startingPlayers - 1 <= totalGhosts ||
            Time.time > startTime + gameLength)
        {
            //END GAME SEQUENCE
            endGame();
        }

        if (CBUG.DEBUG_ON && ((int)(Time.time)) % 20 == 0)
        {
            CBUG.Do("Time Remaining: " + (int)(startTime + gameLength - Time.time));
        }
    }
Beispiel #27
0
    private IEnumerator loadCityDataWeb(string path)
    {
        CBUG.Do("City Path is: " + path);
        WWW www = new WWW(path);

        yield return(www);

        cityCSVWeb = www.text;
        CBUG.Do("CityScript is: ");
        CBUG.Do(cityCSVWeb.Substring(0, 20));
        _cityData = engine_CityData.ReadString(cityCSVWeb);
        if (_cityData == null)
        {
            CBUG.Do("OUR LIBRARY DOESN'T WORK");
        }
        else
        {
            CBUG.Do("City DATA_LENGTH: " + _cityData.Length);
        }
    }
    public void ConnectAndJoinRoom(string username, string[] singletons)
    {
        if (CurrentServerUserDepth != ServerDepthLevel.Offline)
        {
            CBUG.Do("Redundant connect call! Already at " + CurrentServerUserDepth.ToString());
            return;
        }

        CBUG.Do("Connecting!");
        PhotonNetwork.GameVersion = "HotelGame";

        PhotonNetwork.NetworkingClient.AppId = PhotonNetwork.PhotonServerSettings.AppSettings.AppIdRealtime;

        PhotonNetwork.AuthValues        = new AuthenticationValues();
        PhotonNetwork.AuthValues.UserId = username + "_" + UnityEngine.Random.Range(0, 9999);

        string region  = "us";
        bool   _result = PhotonNetwork.ConnectToRegion(region);

        CBUG.Log("PunCockpit:ConnectToRegion(" + region + ") -> " + _result);
    }
Beispiel #29
0
    void Awake()
    {
        version = Application.version;
        CBUG.Do("Application Version is: " + version + ".");
        currentMenu = Menu.main;
        currentMap  = Map.pillar;
        rmAction    = RoomAction.unset;

        stageName = "Pillar";

        isEast = true;
        bool tempControlsShown = PlayerPrefs.GetInt("isControlsShown", 1) == 1 ? true : false;

        isControlsShown = tempControlsShown;

        myMusicAudio = GetComponent <AudioSource>();
        mySFXAudio   = transform.GetChild(0).GetComponent <AudioSource>();
        PlayMSX(3);
        NameStrengthDict = new Dictionary <string, float>();
        foreach (NameToStrength character in StrengthsList)
        {
            NameStrengthDict.Add(character.Name, character.Power);
        }

        //DontDestroyOnLoad(gameObject); Disabling, we never leave the scene Master is born in.
        AssignPlayerCharacter(0);
        //Cursor.lockState = CursorLockMode.Confined;
        //Cursor.visible = false;

        stageNames = new string[totalUniqueStages] {
            "Pillar", "Void", "Lair"
        };

        if (IsOfflineMode)
        {
            return;
        }
        VersionUI.text = "BETA " + Application.version;
        N = GameObject.FindGameObjectWithTag("Networking").GetComponent <NetworkManager>();
    }
    public void SwitchSong(int SongNum)
    {
        CBUG.Do("Switch");
        if (isSwitching || currentSongNum == SongNum)
        {
            nextSongNum = SongNum;
            return;
        }

        CBUG.Do("Switch");
        currentSongNum = SongNum;
        isSwitching    = true;
        nextSongNum    = -1;
        if (musicBox1IsActive)
        {
            CBUG.Do("Fading out 1");
            musicBox1IsActive = false;
            fadeLength        = TransitionLength[SongNum];
            MusicBox1.time    = TransitionPos[SongNum];
            MusicBox2.Stop();
            MusicBox2.clip = Songs[SongNum];
            MusicBox2.Play();
            StartCoroutine(LerpVolume1(1f, 0.0f));
            StartCoroutine(LerpVolume2(0f, 1.0f));
        }
        else
        {
            CBUG.Do("Fading out 2");
            musicBox1IsActive = true;
            fadeLength        = TransitionLength[SongNum];
            MusicBox2.time    = TransitionPos[SongNum];
            MusicBox1.Stop();
            MusicBox1.clip = Songs[SongNum];
            MusicBox1.Play();
            StartCoroutine(LerpVolume1(0f, 1.0f));
            StartCoroutine(LerpVolume2(1f, 0.0f));
        }
    }