Exemple #1
0
    public void SetStageName(string stage_name)
    {
        stageName = stage_name;
        switch (stage_name)
        {
        case "Practice":
            currentMap = Map.practice;
            break;

        case "Pillar":
            currentMap = Map.pillar;
            break;

        case "Void":
            currentMap = Map._void;
            break;

        case "Lair":
            currentMap = Map.lair;
            break;

        default:
            CBUG.Error("WRONG ROOMMNAME GIVEN.");
            break;
        }
    }
Exemple #2
0
    /// <summary>
    /// Returns a smooth value using -x^4 + 1
    /// </summary>
    /// <param name="_x">Current X</param>
    /// <param name="min">Min X Value [inc]</param>
    /// <param name="max">Max X Value [inc]</param>
    /// <param name="swappable">Means if min > max, swap</param>
    /// <returns></returns>
    private float Smooth(float _x, float min, float max, bool swappable)
    {
        if (max < min && swappable)
        {
            float temp = max;
            max = min;
            min = temp;
        }
        else if (!swappable)
        {
            CBUG.Error("MIN GREATER THAN MAX");
        }

        if (_x < min)
        {
            return(1f); //Max speed
        }
        if (_x > max)
        {
            return(1f); //More than arrived, no move.
        }
        float x = (_x - min) / (max - min);

        return(-1f * (x * x * x * x) + 1 + BaseSpeed);
    }
Exemple #3
0
 /// <summary>
 /// Moves to target selection. Used for mouse support.
 /// Always does thing, so no need for boolean to verify.
 /// </summary>
 /// <param name="targetButton">A valid number between 0 and @MAX_BUTTONS - 1</param>
 public void _SelectTarget(int targetButton)
 {
     if (targetButton > MAX_BUTTONS - 1 || targetButton < 0)
     {
         CBUG.Error("TARGET BUTTON EXCEEDS MAXIMUM BUTTONS OF: " + MAX_BUTTONS);
         return;
     }
     currentPage.SelectTarget(targetButton);
     UFE.PlaySound(moveCursorSound);
 }
Exemple #4
0
 public void SetMSXVolume(float amt)
 {
     if (amt < 0f || amt > 1f)
     {
         CBUG.Error("Volume amount must be betweeen 0 and 1.");
     }
     myMusicAudio.volume = amt;
     PlayerPrefs.SetFloat("MSXVol", amt);
     PlayerPrefs.Save();
     CBUG.Log("MSXVolume Set");
 }
Exemple #5
0
 private int getImageNum()
 {
     for (int i = 0; i < UIHeads.Length; i++)
     {
         if (i == M.PlayerCharNum)
         {
             return(i);
         }
     }
     CBUG.Error("No Head Found!");
     return(-1);
 }
Exemple #6
0
 private static EndGameManager getRef()
 {
     for (int x = 0; x < SceneManager.GetSceneAt(0).GetRootGameObjects().Length; x++)
     {
         if (SceneManager.GetSceneAt(0).GetRootGameObjects()[x].name == "EndGameCanvas")
         {
             return(SceneManager.GetSceneAt(0).GetRootGameObjects()[x].GetComponent <EndGameManager>());
         }
         //CBUG.Do("RootObjName: " + SceneManager.GetSceneAt(0).GetRootGameObjects()[x]);
     }
     CBUG.Error("FRIEND NOT FOUND!");
     return(null);
 }
Exemple #7
0
    public void HandleUnityLog(string LogString, string StackTrace, LogType type)
    {
        switch (type)
        {
        case LogType.Error:
            CBUG.Error(type.ToString() + LogString + "/n" + StackTrace);
            break;

        case LogType.Exception:
            CBUG.Error(type.ToString() + LogString + "/n" + StackTrace);
            break;

        default:
            break;
        }
    }
 public Photon.Realtime.Room GetRoom()
 {
     if (CurrentServerUserDepth == ServerDepthLevel.Offline)
     {
         return(null); //??? TODO HANDLE BETTER
     }
     else if (CurrentServerUserDepth == ServerDepthLevel.InRoom)
     {
         return(PhotonNetwork.CurrentRoom);
     }
     else
     {
         CBUG.Error("We are not currently in a room!");
         return(null); //??? TODO HANDLE BETTER!
     }
 }
 public bool IsLocalClient(PhotonView playerView)
 {
     if (CurrentServerUserDepth == ServerDepthLevel.Offline)
     {
         return(true);
     }
     else if (CurrentServerUserDepth == ServerDepthLevel.InRoom)
     {
         return(playerView.IsMine);
     }
     else
     {
         CBUG.Error("This can only be called when player is in a room or offline! You're currently in: " + CurrentServerUserDepth.ToString());
         return(false);
     }
 }
 public int GetLocalPlayerID()
 {
     if (CurrentServerUserDepth == ServerDepthLevel.Offline)
     {
         return(1);
     }
     else if (CurrentServerUserDepth == ServerDepthLevel.InRoom)
     {
         return(PhotonNetwork.LocalPlayer.ActorNumber); //??? unchanging? Unique? Todo;
     }
     else
     {
         CBUG.Error("This can only be called when player is in a room or offline! You're currently in: " + CurrentServerUserDepth.ToString());
         return(PhotonNetwork.LocalPlayer.ActorNumber);
     }
 }
Exemple #11
0
    /// <summary>
    /// To other Menu Canvas "Scenes" or to an in-game scene.
    /// </summary>
    /// <param name="to">To.</param>
    public void GoTo(int to)
    {
        switch (to)
        {
        case (int)Menu.main:
            switchCanvas((int)Menu.main);
            break;

        case (int)Menu.map:
            N.JoinServer(true);
            StartCoroutine(gotoMap());
            break;

        case (int)Menu.chara:
            StartCoroutine(gotoCharacterSelect());
            break;

        case (int)Menu.options:
            switchCanvas((int)Menu.options);
            break;

        case (int)Menu.ingame:     //game is actually loaded up from map -> chara.
            //This just disables the main menu.
            switchCanvas((int)Menu.ingame);
            unloadMenu();
            PlayMSX(1);
            GameObject.FindGameObjectWithTag("StageCamera").GetComponent <AudioListener>().enabled = true;
            break;

        case (int)Menu.practice:
            loadStage();
            switchCanvas((int)Menu.ingame);
            unloadMenu();
            PlayMSX(1);
            break;

        case -1:     //Disabling all UI
            switchCanvas(-1);
            break;

        default:
            CBUG.Error("BAD MENU SCENE GIVEN!! :: " + to);
            break;
        }
    }
 public string GetLocalUsername()
 {
     if (CurrentServerUserDepth == ServerDepthLevel.Offline)
     {
         return(_fakeServer.Username);
     }
     else if (CurrentServerUserDepth == ServerDepthLevel.InRoom)
     {
         string username = PhotonNetwork.LocalPlayer.UserId;
         username = username.Substring(0, username.IndexOf('_'));
         return(username);
     }
     else
     {
         CBUG.Error("Username only available when Offline or InRoom, this was called at " + CurrentServerUserDepth.ToString() + ".");
         return(null);
     }
 }
 public GameObject SpawnObject(string resourceName, Vector3 spawnLoc, Quaternion spawnRot)
 {
     if (CurrentServerUserDepth == ServerDepthLevel.Offline)
     {
         GameObject instance = Instantiate(Resources.Load(resourceName, typeof(GameObject)), spawnLoc, spawnRot) as GameObject;
         return(instance);
         /// ??? todo make playerlist local ref
     }
     else if (CurrentServerUserDepth == ServerDepthLevel.InRoom)
     {
         GameObject PlayerObj = PhotonNetwork.Instantiate(resourceName, spawnLoc, spawnRot);
         return(PlayerObj);
     }
     else
     {
         CBUG.Error("SpawnObject only available when Offline or InRoom, this was called at " + CurrentServerUserDepth.ToString() + ".");
         return(null);
     }
 }
 public void SaveData(string label, System.Object data)
 {
     if (CurrentServerUserDepth == ServerDepthLevel.Offline)
     {
         _fakeServer.DataStore.Remove(label);
         _fakeServer.DataStore.Add(label, data);
     }
     else if (CurrentServerUserDepth == ServerDepthLevel.InRoom)
     {
         ExitGames.Client.Photon.Hashtable roomProps = PhotonNetwork.CurrentRoom.CustomProperties;
         roomProps.Remove(label);
         roomProps.Add(label, data);
         PhotonNetwork.CurrentRoom.SetCustomProperties(roomProps);
     }
     else
     {
         CBUG.Error("SaveData only available when Offline or InRoom, this was called at  " + CurrentServerUserDepth.ToString() + ".");
     }
 }
 public GameObject SpawnPlayer(Vector3 pos, Quaternion rot, string ResourceName = "PhotonArenaPlayer")
 {
     if (CurrentServerUserDepth == ServerDepthLevel.Offline)
     {
         _fakeServer.totalPlayers++;
         //spawn player? ???todo
         return(null);
     }
     else if (CurrentServerUserDepth == ServerDepthLevel.InRoom)
     {
         //ExitGames.Client.Photon.Hashtable roomProps = PhotonNetwork.CurrentRoom.CustomProperties;
         //roomProps.Add(label, data);
         return(PhotonNetwork.Instantiate(ResourceName, pos, rot));
     }
     else
     {
         CBUG.Error("Spawn Player only available when Offline or InRoom, this was called at " + CurrentServerUserDepth.ToString() + ".");
     }
     return(null);
 }
    void HurtAnim(int hurtNum)
    {
        switch (hurtNum)
        {
        case 1:
            anim.SetBool("HurtSmall", true);
            break;

        case 2:
            anim.SetBool("HurtMedium", true);
            break;

        case 3:
            anim.SetBool("HurtBig", true);
            break;

        default:
            CBUG.Error("BAD ANIM NUMBER GIVEN");
            break;
        }
    }
    public System.Object GetData(string label)
    {
        //todo ??? Make generic
        bool containsData = true;

        if (CurrentServerUserDepth == ServerDepthLevel.Offline)
        {
            if (_fakeServer.DataStore.ContainsKey(label))
            {
                return(_fakeServer.DataStore[label] as System.Object);
            }
            else
            {
                newData      = false;
                containsData = false;
            }
        }
        else if (CurrentServerUserDepth == ServerDepthLevel.InRoom)
        {
            ExitGames.Client.Photon.Hashtable roomProps = PhotonNetwork.CurrentRoom.CustomProperties;
            if (roomProps.ContainsKey(label))
            {
                newData = false;
                return(roomProps[label] as System.Object);
            }
            else
            {
                containsData = false;
            }
        }
        else
        {
            CBUG.Error("GetData only available when Offline or InRoom, this was called at " + CurrentServerUserDepth.ToString() + ".");
        }
        if (containsData == false)
        {
            CBUG.Error("No data was found for " + label + ".");
        }
        return(null);
    }
Exemple #18
0
 private IEnumerator gotoCharacterSelect()
 {
     if (rmAction == RoomAction.unset)
     {
         CBUG.Error("No room action given! Create or Join?");
     }
     else if (rmAction == RoomAction.join)
     {
         N.JoinRoom();
     }
     else
     {
         N.CreateRoom();
     }
     timeConnecting = Time.time;
     ToggleConnectLoadScreen(true);
     GoTo(-1);
     while (!PhotonNetwork.inRoom)
     {
         if (Time.time - timeConnecting > ConnectToRoomMaxWaitTime)
         {
             GoTo(1);
             MapUI.FullRoomWarning.SetActive(true);
             break;
         }
         else
         {
             yield return(null);
         }
     }
     if (PhotonNetwork.inRoom)
     {
         switchCanvas((int)Menu.chara);
         loadStage(); //the InGame map is loaded in the background.
     }
     ToggleConnectLoadScreen(false);
 }
Exemple #19
0
    // the following methods are implemented to give you some context. re-implement them as needed.

    public virtual void OnFailedToConnectToPhoton(DisconnectCause cause)
    {
        CBUG.Error("Failed to Connect!");
        CBUG.Error("Cause: " + cause);
        M.GoBack();
    }