예제 #1
0
        //Function to verify if camera settings are good
        void CheckCamera()
        {
            //If spectator cam is on
            bool camOn = PlayerPreferences.I.SpectatorCam.Get();

            if (camOn)
            {
                //If spectator cam is set to static third person
                float camMode = PlayerPreferences.I.SpectatorCamMode.Get();
                if (camMode == 1)
                {
                    //If camOK is already true at this point we don't need to do anything
                    if (!camOK)
                    {
                        //If it's not, get reference for SpectatorCam class and set camOK to true
                        spectatorCam = UnityEngine.Object.FindObjectOfType <SpectatorCam>();
                        camOK        = true;
                    }
                }
                else
                {
                    camOK = false;
                }
            }
            else
            {
                camOK = false;
            }
        }
예제 #2
0
 private static void Postfix(SpectatorCam __instance)
 {
     if (AudicaMod.camOK && AudicaMod.spectatorCamSet && AudicaMod.activated)
     {
         AudicaMod.SpectatorCamUpdate();
     }
 }
예제 #3
0
            private static void Postfix(SpectatorCam __instance)
            {
                if (AudicaMod.spectatorCamSet)
                {
                    return;
                }

                AudicaMod.SetSpectatorCam(__instance, true);
            }
예제 #4
0
 private static bool Prefix(SpectatorCam __instance)
 {
     if (AudicaMod.camOK && AudicaMod.spectatorCamSet && AudicaMod.activated)
     {
         //AudicaMod.SpectatorCamUpdate();
         return(false);
     }
     else
     {
         return(true);
     }
 }
예제 #5
0
        public static void FixSpectatorCam()
        {
            spectatorCamFixed = true;

            SpectatorCam cam = GameObject.FindObjectOfType <SpectatorCam>();

            if (cam is null)
            {
                MelonLogger.Log("Spectator cam is disabled.");
                return;
            }

            cam.cam.enabled = false;
            cam.cam.enabled = true;
        }
예제 #6
0
 private static bool Prefix(SpectatorCam __instance)
 {
     if (AudicaMod.camOK)
     {
         return(false);
     }
     else
     {
         if (AudicaMod.isMouseAwake)
         {
             AudicaMod.isMouseAwake = false;
         }
         return(true);
     }
 }
예제 #7
0
            private static void Postfix(SpectatorCam __instance)
            {
                if (AudicaMod.camOK)
                {
                    Camera thirdPersonCam = AudicaMod.spectatorCam.cam;

                    if (!AudicaMod.isMouseAwake)
                    {
                        AudicaMod.MouseAwake();
                    }

                    if (Input.GetKey(KeyCode.W))
                    {
                        thirdPersonCam.gameObject.transform.position = thirdPersonCam.gameObject.transform.position + thirdPersonCam.gameObject.transform.forward;
                    }

                    if (Input.GetKey(KeyCode.S))
                    {
                        thirdPersonCam.gameObject.transform.position = thirdPersonCam.gameObject.transform.position - thirdPersonCam.gameObject.transform.forward;
                    }

                    if (Input.GetKey(KeyCode.A))
                    {
                        thirdPersonCam.gameObject.transform.position = thirdPersonCam.gameObject.transform.position - thirdPersonCam.gameObject.transform.right;
                    }

                    if (Input.GetKey(KeyCode.D))
                    {
                        thirdPersonCam.gameObject.transform.position = thirdPersonCam.gameObject.transform.position + thirdPersonCam.gameObject.transform.right;
                    }

                    if (Input.GetKey(KeyCode.Space))
                    {
                        thirdPersonCam.gameObject.transform.position = thirdPersonCam.gameObject.transform.position + thirdPersonCam.gameObject.transform.up;
                    }

                    if (Input.GetKey(KeyCode.C))
                    {
                        thirdPersonCam.gameObject.transform.position = thirdPersonCam.gameObject.transform.position - thirdPersonCam.gameObject.transform.up;
                    }

                    if (Input.GetKey(KeyCode.Mouse1))
                    {
                        float MIN_X = 0.0f;
                        float MAX_X = 360.0f;
                        float MIN_Y = -90.0f;
                        float MAX_Y = 90.0f;

                        AudicaMod.xAxis += Input.GetAxis("Mouse X") * (AudicaMod.mouseSensitivity * Time.deltaTime);

                        /*
                         * if (xAxis < MIN_X) xAxis = MIN_X;
                         * else if (xAxis > MAX_X) xAxis = MAX_X;
                         */

                        AudicaMod.yAxis -= Input.GetAxis("Mouse Y") * (AudicaMod.mouseSensitivity * Time.deltaTime);

                        /*
                         * if (yAxis < MIN_Y) yAxis = MIN_Y;
                         * else if (yAxis > MAX_Y) yAxis = MAX_Y;
                         */

                        thirdPersonCam.gameObject.transform.rotation = Quaternion.Euler(AudicaMod.yAxis, AudicaMod.xAxis, 0.0f);
                    }

                    if (Input.GetKey(KeyCode.Z))
                    {
                        Vector3 euler = thirdPersonCam.gameObject.transform.rotation.eulerAngles;
                        thirdPersonCam.gameObject.transform.rotation = Quaternion.Euler(euler.y, euler.x, euler.z + 1.0f);
                    }

                    if (Input.GetKey(KeyCode.X))
                    {
                        Vector3 euler = thirdPersonCam.gameObject.transform.rotation.eulerAngles;
                        thirdPersonCam.gameObject.transform.rotation = Quaternion.Euler(euler.y, euler.x, euler.z - 1.0f);
                    }
                }
            }
예제 #8
0
 public override void Start()
 {
     specCam = CameraMaster.instance.gameObject.GetComponent <SpectatorCam>();
     _Replay = null;
 }
예제 #9
0
    public override void Start()
    {
        #region Init GUI
        if (Camera == null)
        {
            Debug.Log("Camera Master cannot find camera");
        }

        JoinHost = gameObject.GetComponent <GUIJoinHost>();
        if (JoinHost == null)
        {
            Debug.Log("Camera Master cannot find GUI script for join/host");
        }
        MainMenu = gameObject.GetComponent <GUIMainMenu>();
        if (MainMenu == null)
        {
            Debug.Log("Camera master could not find GUI script for main menu");
        }
        SelectTeam = gameObject.GetComponent <GUISelectTeam>();
        if (SelectTeam == null)
        {
            Debug.Log("Camera Master cannot find GUI script for select");
        }

        ExitMenu = gameObject.GetComponent <GUIExitMenu>();
        if (ExitMenu == null)
        {
            Debug.Log("Camera Master cannot find GUI script for exit");
        }

        HostMenu = gameObject.GetComponent <GUIHostMenu>();
        if (HostMenu == null)
        {
            Debug.Log("Camera Master cannot find GUI script for host");
        }

        OptionsMenu = gameObject.GetComponent <GUIOptionsMenu>();
        if (OptionsMenu == null)
        {
            Debug.Log("Camera Master cannot find GUI script for Options");
        }


        LoadingScreen = gameObject.GetComponent <GUILoadingScreen>();
        if (LoadingScreen == null)
        {
            Debug.Log("Camera Maser cannot find GUI script for loading screen");
        }

        ChadCam = gameObject.GetComponent <ChadCam>();
        if (ChadCam == null)
        {
            Debug.Log("Camera Master cannot find ChadCam");
        }
        else
        {
            ChadCam.enabled = false;
        }

        SpectatorCam = gameObject.GetComponent <SpectatorCam>();
        if (SpectatorCam == null)
        {
            Debug.Log("Camera Master cannot find SpectatorCam");
        }
        else
        {
            SpectatorCam.enabled = false;
        }

        Hud = gameObject.GetComponent <ChadHud>();
        if (Hud == null)
        {
            Debug.Log("Camera Master could not find Hud");
        }

        ReplayCam         = gameObject.GetComponent <ReplayCamera>();
        ReplayCam.enabled = false;
        #endregion

        #region Chad Hats
        string settingsHat = UserSettings.GetSetting("Hat");

        if (settingsHat != null)
        {
            SelectedHat = System.Convert.ToInt32(settingsHat);
        }
        else
        {
            SelectedHat = (int)(Random.Range(0.0f, 1.0f) * (HatManager.Instance.Hats.Count - 2)) + 1;
            settingsHat = SelectedHat.ToString();
            UserSettings.AddOrUpdateAppSetting("Hat", settingsHat);
        }

        if (ChadMainMenu != null)
        {
            ChadMMHat = ChadMainMenu.GetComponent <Hatter>();
            ChadMMHat.SetHat(SelectedHat);
        }
        if (ChadTeam1 != null)
        {
            ChadT1Hat = ChadTeam1.GetComponent <Hatter>();
            ChadT1Hat.SetHat(SelectedHat);
        }
        if (ChadTeam1 != null)
        {
            ChadT2Hat = ChadTeam2.GetComponent <Hatter>();
            ChadT2Hat.SetHat(SelectedHat);
        }
        #endregion

        SetState(CAM_STATE.MAIN_MENU);
    }
예제 #10
0
 public static void SetSpectatorCam(SpectatorCam cam, bool isSet)
 {
     spectatorCam    = cam;
     spectatorCamSet = isSet;
 }