Inheritance: MonoBehaviour
//--------------------------End battle-------------------------------
    public void EndBattle()
    {
        gameState      = GameState.Overworld;
        camSet         = CameraSetting.OverworldCam;
        cam_T.position = playerController.trans.position;
        battleMenu.SetActive(false);
    }
Esempio n. 2
0
 // Use this for initialization
 void Start()
 {
     Player       = this.gameObject;
     Animator     = Player.GetComponentInChildren <Animator>();
     CameraStatus = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraSetting>();
     //Debug.Log("this:" + Player.gameObject.tag);
 }
Esempio n. 3
0
 /// <summary>
 /// cTor:
 /// </summary>
 /// <param name="setting">The Setting for this Mode</param>
 /// <param name="button">The managed button</param>
 /// <param name="switchCam">Camera Switch Method</param>
 public ModeButton(CameraSetting setting, Button button, Action <CameraSetting, uint> switchCam)
 {
     Setting       = setting;
     Button        = button;
     button.Click += button_Click;
     _switchCam    = switchCam;
 }
        public void clickSaveChanges()
        {
            Transform            contentPanel = this.transform.Find("Panel").Find("Scroll Rect").Find("Content Panel");
            List <CameraSetting> cameraList   = new List <CameraSetting>();

            foreach (Transform cameraSetting in contentPanel)
            {
                CameraSetting item  = new CameraSetting();
                Transform     panel = cameraSetting.Find("Panel");
                if (panel.Find("ToggleIsActive").GetComponent <Toggle>().isOn)
                {
                    item.id          = panel.Find("TextID").GetComponent <Text>().text;
                    item.pitch       = float.Parse(panel.Find("IFpitch").GetComponent <InputField>().text);
                    item.yaw         = float.Parse(panel.Find("IFYaw").GetComponent <InputField>().text);
                    item.roll        = float.Parse(panel.Find("IFRoll").GetComponent <InputField>().text);
                    item.fieldOfView = float.Parse(panel.Find("IFfov").GetComponent <InputField>().text);
                    float posX = float.Parse(panel.Find("IFposX").GetComponent <InputField>().text);
                    float posY = float.Parse(panel.Find("IFposY").GetComponent <InputField>().text);
                    float posZ = float.Parse(panel.Find("IFposZ").GetComponent <InputField>().text);
                    item.position = new Vector3(posX, posY, posZ);
                    cameraList.Add(item);
                }
            }

            CameraVanEdit cameraVan = GameObject.Find("Canvas").transform.Find("CameraVanEdit").GetComponent <CameraVanEdit>();

            cameraVan.cameraList = cameraList;
        }
Esempio n. 5
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            UITableViewCell cell = base.GetCell(tableView, indexPath);

            switch (indexPath.Section)
            {
            case 3:
                CameraSetting cameraSetting = CameraSettingForRow(indexPath.Row);
                if (cameraSetting != null)
                {
                    foreach (UIView subview in cell.ContentView.Subviews)
                    {
                        if (subview.GetType() == typeof(UIPickerView))
                        {
                            UIPickerView pickerView = (UIPickerView)subview;
                            cameraSetting.Attach(pickerView, tableView, NSIndexPath.Create(indexPath.Section, indexPath.Row - 1));
                        }
                    }
                }
                else
                {
                    cameraSetting = CameraSettingForRow(indexPath.Row + 1);
                    if (cameraSetting != null)
                    {
                        cell.DetailTextLabel.Text = cameraSetting.SelectedData();
                    }
                }

                break;
            }

            return(cell);
        }
Esempio n. 6
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            if (indexPath.Section == 3)
            {
                if (indexPath.Row == 0 || indexPath.Row == 2 || indexPath.Row == 4)
                {
                    if (currentIndexPath != null && currentIndexPath != indexPath)
                    {
                        CameraSetting selectedCameraSetting = CameraSettingForRow(currentIndexPath.Row + 1);
                        if (selectedCameraSetting != null)
                        {
                            selectedCameraSetting.extended = false;
                        }
                    }
                    currentIndexPath = indexPath;

                    CameraSetting cameraSetting = CameraSettingForRow(indexPath.Row + 1);
                    if (cameraSetting != null)
                    {
                        cameraSetting.extended = !cameraSetting.extended;
                    }
                    tableView.BeginUpdates();
                    tableView.EndUpdates();
                }
            }
        }
Esempio n. 7
0
 public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
 {
     if (indexPath.Section == 3)
     {
         CameraSetting cameraSetting = CameraSettingForRow(indexPath.Row);
         if (cameraSetting != null)
         {
             if (cameraSetting.extended)
             {
                 return(120.0f);
             }
             else
             {
                 return(0.0f);
             }
         }
         else
         {
             return(base.GetHeightForRow(tableView, indexPath));
         }
     }
     else
     {
         return(base.GetHeightForRow(tableView, indexPath));
     }
 }
Esempio n. 8
0
        /// <summary>
        /// The MAIN switch the Camera View Method
        /// </summary>
        /// <param name="setting">The Cam Setting</param>
        /// <param name="viewIndex">The CamView Index</param>
        private void SwitchCamera_low(CameraSetting setting, uint viewIndex)
        {
            // sanity
            if (!SC.SimConnectClient.Instance.IsConnected)
            {
                return;
            }

            var cam = SC.SimConnectClient.Instance.CameraModule;

            _btMode[setting].ViewIndex = viewIndex; // save preset default
            if (SC.SimConnectClient.Instance.CameraModule.CameraSetting != setting)
            {
                // change if not already there
                cam.SmartCam_active = false;
                SC.SimConnectClient.Instance.CameraModule.CameraSetting = setting;
            }
            // Set the ViewIndex
            if (setting != CameraSetting.Cockpit_Custom)
            {
                // custom cams don't have a ViewIndex
                SC.SimConnectClient.Instance.CameraModule.ActCamView_index = viewIndex;
            }
            // restore Drone speeds
            _droneValueUpdate = c_triggerUpdate;
        }
Esempio n. 9
0
            protected override IEnumerator OnRun_Async()
            {
                Camera        rMainCamera    = Globals.Instance.GetMainCamera();
                CameraSetting rCameraSetting = new CameraSetting();

                rCameraSetting.AngleX   = this.GameMode.StageConfig.CameraSettings[0];
                rCameraSetting.AngleY   = this.GameMode.StageConfig.CameraSettings[1];
                rCameraSetting.Distance = this.GameMode.StageConfig.CameraSettings[2];
                rCameraSetting.OffsetY  = this.GameMode.StageConfig.CameraSettings[3];
                rCameraSetting.Target   = this.GameMode.MainPlayer.ActorGo;

                var rCameraController = rMainCamera.gameObject.ReceiveComponent <CameraController>();

                rCameraController.CameraSettings = rCameraSetting;

                // 设置角色的初始位置
                Vector3 rBornPos = new Vector3(
                    this.GameMode.StageConfig.BornPos[0],
                    this.GameMode.StageConfig.BornPos[1],
                    this.GameMode.StageConfig.BornPos[2]);

                this.GameMode.MainPlayer.ActorGo.transform.position = rBornPos;

                // 添加角色控制器
                this.GameMode.MainPlayer.ActorGo.ReceiveComponent <ActorUserController>();
                this.GameMode.MainPlayer.ActorGo.ReceiveComponent <ActorController>();

                // 加载Gamepad界面
                yield return(UIManager.Instance.OpenAsync("KNGamePad", View.State.dispatch));

                GameLoading.Instance.Hide();
                Debug.Log("GameStage -- Init data complete.");
                yield break;
            }
Esempio n. 10
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        Transform freeLookCameraTransform = transform.Find("Player_FreeLookCamera");

        if (freeLookCameraTransform != null)
        {
            freeLookCamera = freeLookCameraTransform.GetComponent <CinemachineFreeLook>();
        }

        PlayerController playerController = FindObjectOfType <PlayerController>();

        if (playerController != null && playerController.name == "Player")
        {
            followTransform = playerController.transform;
            lookAtTransform = followTransform.Find("HeadTarget");

            if (playerController.CameraSetting == null)
            {
                playerController.CameraSetting = this;
            }
        }
    }
Esempio n. 11
0
 /// <summary>
 /// The MAIN switch the Camera View Method
 /// </summary>
 /// <param name="setting">The Cam Setting</param>
 /// <param name="viewIndex">The CamView Index</param>
 private void SwitchCamera(CameraSetting setting, uint viewIndex)
 {
     _camSetting = setting;
     _camIndex   = viewIndex;
     _camUpdate  = c_triggerUpdate;
     SwitchCamera_low(setting, viewIndex);
 }
Esempio n. 12
0
        public static void Gui(CameraSetting setting)
        {
            EditorGUI.BeginChangeCheck();

            EditorGUILayout.LabelField("Pivot Location", EditorStyles.boldLabel);
            setting.offset.x = EditorGUILayout.Slider("Offset X", setting.offset.x, -0.2f, 0.2f);
            setting.offset.y = EditorGUILayout.Slider("Offset Y", setting.offset.y, -1f, 1f);
            setting.offset.z = EditorGUILayout.Slider("Offset Z", setting.offset.z, -1f, 1f);

            EditorGUILayout.Space();
            EditorGUILayout.Separator();

            EditorGUILayout.LabelField("View", EditorStyles.boldLabel);
            setting.fov      = EditorGUILayout.Slider("FOV", setting.fov, 2f, 80f);
            setting.distance = EditorGUILayout.Slider("Distance", setting.distance, 0f, 10f);

            EditorGUILayout.Space();
            EditorGUILayout.Separator();

            EditorGUILayout.LabelField("Orientation", EditorStyles.boldLabel);
            setting.angle = EditorGUILayout.Slider("Angle", setting.angle, 0f, 180f);
            setting.orbit = EditorGUILayout.Slider("Orbit", setting.orbit, 0f, 360f);

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(setting);
            }
        }
Esempio n. 13
0
 void SetCamera(int index)
 {
     if(cSetting[index]==null)
         return;
     currentCamera = cSetting[index];
     currentCamera.Init();
 }
        public void fillMenu()
        {
            Transform     contentPanel = this.transform.Find("Panel").Find("Scroll Rect").Find("Content Panel");
            CameraVanEdit cve          = GameObject.Find("Canvas").transform.Find("CameraVanEdit").GetComponent <CameraVanEdit>();

            if (cve.cameraList == null || cve.cameraList.Count < 1 || contentPanel.childCount > 1)
            {
                return;
            }


            for (int k = 0; k < cve.cameraList.Count - 1; k++)
            {
                clickAddCamera();
            }

            int iterator = 0;

            foreach (Transform cameraSetting in contentPanel)
            {
                CameraSetting item  = cve.cameraList[iterator++];
                Transform     panel = cameraSetting.Find("Panel");
                panel.Find("TextID").GetComponent <Text>().text        = item.id;
                panel.Find("IFpitch").GetComponent <InputField>().text = item.pitch.ToString();
                panel.Find("IFYaw").GetComponent <InputField>().text   = item.yaw.ToString();
                panel.Find("IFRoll").GetComponent <InputField>().text  = item.roll.ToString();
                panel.Find("IFfov").GetComponent <InputField>().text   = item.fieldOfView.ToString();
                panel.Find("IFposX").GetComponent <InputField>().text  = item.position.x.ToString();
                panel.Find("IFposY").GetComponent <InputField>().text  = item.position.y.ToString();
                panel.Find("IFposZ").GetComponent <InputField>().text  = item.position.z.ToString();
            }
        }
Esempio n. 15
0
    protected override void Awake()
    {
        base.Awake();

        GameSetting.Init();
        CameraSetting.InitUICamera();

        InitFirstUtil();
    }
Esempio n. 16
0
        private void Awake()
        {
            cam = GetComponent <Camera>();

            defaultSetting                     = new CameraSetting();
            defaultSetting.fieldOfView         = cam.fieldOfView;
            defaultSetting.clippingPlanes.near = cam.nearClipPlane;
            defaultSetting.clippingPlanes.far  = cam.farClipPlane;
            boundingBox = true;
        }
Esempio n. 17
0
        private async Task ExecuteSelectCameraOption(CameraSetting parm)
        {
            foreach (var item in CameraSettingItems)
            {
                item.IsSelected = false;
            }
            parm.IsSelected = true;
            await SecureStorage.SetAsync("CompressionQuality", parm.compression.ToString());

            App.CompressionQuality = parm.compression;
            // return await Task.FromResult(true);
        }
Esempio n. 18
0
        public async Task LoadData()
        {
            string CompressionQuality = await SecureStorage.GetAsync("CompressionQuality");

            if (string.IsNullOrEmpty(CompressionQuality))
            {
                CompressionQuality = "100";
            }
            CameraSetting cs = CameraSettingItems.Where(c => c.compression == Convert.ToInt32(CompressionQuality)).SingleOrDefault();

            cs.IsSelected = true;
        }
    public void InitializeEncounter()
    {
        playerController.isMoving = false;
        gameState      = GameState.Battle;
        camSet         = CameraSetting.BattleCam;
        cam_T.position = battlefield.position;

        enemyDefeated = 0;

        //Player Initialization
        partyMembers = PlayerPrefs.GetInt("PartyMembers", 1);
        characters   = new GameObject[partyMembers];
        charControl  = new CharControl_Battle[partyMembers];
        for (int i = 0; i < partyMembers; i++)
        {
            characters[i]          = Instantiate(battleCharacterPrefab);
            characters[i].name     = "Battle_Char_" + i;
            charControl[i]         = characters[i].GetComponent <CharControl_Battle>();
            charControl[i].rowSize = tileScript.yTiles;



            charControl[i].Init(i, true);
            charControl[i].UpdateTileID("Player");
            PlaceCharacterOnTheirTile("Player", i);
            tileScript.tiles[charControl[i].tileID].isOccupied = true;
        }

        //Enemy Initialization
        enemyAmount  = 1; //PLACHEOLDER
        enemies      = new GameObject[enemyAmount];
        enemyControl = new EnemyControl_Battle[enemyAmount];
        for (int i = 0; i < enemyAmount; i++)
        {
            enemies[i]              = Instantiate(battleEnemyPrefab);
            enemies[i].name         = "Battle_Enemy_" + i;
            enemyControl[i]         = enemies[i].GetComponent <EnemyControl_Battle>();
            enemyControl[i].rowSize = tileScript.yTiles;
            // THIS NEEDS SOME WORK
            enemyControl[i].Init(i, false);
            enemyControl[i].UpdateTileID("Enemy");
            PlaceCharacterOnTheirTile("Enemy", i);
            tileScript.tiles[enemyControl[i].tileID].isOccupied = true;
        }

        battleUI.InitializeInfoBoxes();
        battleUI.attackOptionAmount = charControl[activeCharacter].attacksAmount;
        battleMenu.SetActive(true);
        battleUI.ChangeNotifText("Encountered an enemy!");
    }
Esempio n. 20
0
        /// <summary>
        /// Saves the current state for this slot
        /// </summary>
        public void SaveCamera( )
        {
            // sanity
            if (!SC.SimConnectClient.Instance.IsConnected)
            {
                return;                                      // cannot
            }
            if (!Enabled)
            {
                return;
            }

            _camSetting = SC.SimConnectClient.Instance.CameraModule.CameraSetting;
            _camIndex   = SC.SimConnectClient.Instance.CameraModule.ActCamView_index;
        }
    public CameraController(Camera cam)
    {
        cameraSetting = cam.gameObject.GetComponent<CameraSetting>();
        if (cameraSetting == null) {
            cameraSetting = cam.gameObject.AddComponent<CameraSetting>();
        }
        //cameraSetting.yaw = cam.gameObject.transform.rotation.eulerAngles.y;
        //cameraSetting.pitch = cam.gameObject.transform.rotation.eulerAngles.x;
        cam.transform.rotation = cameraSetting.GetRotation();

        SetState(State.FollowPath);
        followPose.pos = cam.transform.position;
        followPose.rot = cam.transform.rotation;
        fixPose.pos = cam.transform.position;
        fixPose.rot = cam.transform.rotation;
        camera = cam;
    }
Esempio n. 22
0
 public void Set(Engine engine, CameraSetting setting)
 {
     switch (setting)
     {
         case CameraSetting.FacingPlayer:
             GotoFSpeed = 32;
             GotoPSpeed = 64;
             cameraSetting = setting;
             FindFocusPlayer(engine);
             break;
         default:
             GotoFSpeed = 8;
             GotoPSpeed = 8;
             cameraSetting = setting;
             break;
     }
 }
Esempio n. 23
0
    public static void SettingCamera(Camera camera, int sceneID)
    {
        Scene scene = DataReader <Scene> .Get(sceneID);

        if (scene == null)
        {
            return;
        }
        string[] array = scene.clip.Split(";".ToCharArray());
        if (array.Length >= 2)
        {
            CamerasMgr.CameraMain.set_nearClipPlane(float.Parse(array[0]));
            CamerasMgr.CameraMain.set_farClipPlane(float.Parse(array[1]));
        }
        CamerasMgr.CameraMain.set_fieldOfView((float)scene.CameraWideAngle);
        CameraSetting.SetCameraLayerCullDistances(scene);
    }
    public CameraController(Camera cam)
    {
        cameraSetting = cam.gameObject.GetComponent <CameraSetting>();
        if (cameraSetting == null)
        {
            cameraSetting = cam.gameObject.AddComponent <CameraSetting>();
        }
        //cameraSetting.yaw = cam.gameObject.transform.rotation.eulerAngles.y;
        //cameraSetting.pitch = cam.gameObject.transform.rotation.eulerAngles.x;
        cam.transform.rotation = cameraSetting.GetRotation();

        SetState(State.FollowPath);
        followPose.pos = cam.transform.position;
        followPose.rot = cam.transform.rotation;
        fixPose.pos    = cam.transform.position;
        fixPose.rot    = cam.transform.rotation;
        camera         = cam;
    }
Esempio n. 25
0
        public List <CameraSetting> convertBackToCamList(List <SaveCameraSetting> saveCamList)
        {
            List <CameraSetting> camSettingList = new List <CameraSetting>();

            for (int k = 0; k < saveCamList.Count; k++)
            {
                CameraSetting cs = new CameraSetting();
                cs.position    = saveCamList[k].position;
                cs.roll        = saveCamList[k].roll;
                cs.yaw         = saveCamList[k].yaw;
                cs.pitch       = saveCamList[k].pitch;
                cs.id          = saveCamList[k].id;
                cs.fieldOfView = saveCamList[k].FOV;
                camSettingList.Add(cs);
            }

            return(camSettingList);
        }
Esempio n. 26
0
        public void Set(Engine engine, CameraSetting setting)
        {
            switch (setting)
            {
            case CameraSetting.FacingPlayer:
                GotoFSpeed    = 32;
                GotoPSpeed    = 64;
                cameraSetting = setting;
                FindFocusPlayer(engine);
                break;

            default:
                GotoFSpeed    = 8;
                GotoPSpeed    = 8;
                cameraSetting = setting;
                break;
            }
        }
    void Update()
    {
        lastMouse = Input.mousePosition - lastMouse;
        lastMouse = new Vector3(-lastMouse.y * camSens, lastMouse.x * camSens, 0);
        lastMouse = new Vector3(transform.eulerAngles.x + lastMouse.x, transform.eulerAngles.y + lastMouse.y, 0);
        if (Input.GetMouseButton(1))
        {
            cameraMode          = 0;
            smoothFollow.target = null;

            //Mouse  camera angle done.
            transform.eulerAngles = lastMouse;
            //Keyboard commands
            float f = 0.0f;
            var   p = GetBaseInput();
            if (Input.GetKey(KeyCode.LeftShift))
            {
                totalRun += Time.deltaTime;
                p         = p * totalRun * shiftAdd;
                p.x       = Mathf.Clamp(p.x, -maxShift, maxShift);
                p.y       = Mathf.Clamp(p.y, -maxShift, maxShift);
                p.z       = Mathf.Clamp(p.z, -maxShift, maxShift);
            }
            else
            {
                totalRun = Mathf.Clamp(totalRun * 0.5f, 1, 1000);
                p        = p * mainSpeed;
            }

            p = p * Time.deltaTime;
            if (Input.GetKey(KeyCode.Space))
            { //If player wants to move on X and Z axis only
                f = transform.position.y;
                transform.Translate(p);
                transform.position = new Vector3(transform.position.x, f, transform.position.z);
            }
            else
            {
                transform.Translate(p);
            }
        }
        UpdateCameraPointer();
        lastMouse = Input.mousePosition;
    }
Esempio n. 28
0
        public void loadSetting(CameraSetting _camSetting)
        {
            if (rt == null)
            {
                camera = this.GetComponent <Camera>();
                Camera mainCamera = GameObject.Find("Main Camera").GetComponent <Camera>();
                camera.CopyFrom(mainCamera);

                resolutionWidth  = (int)camera.pixelWidth;
                resolutionHeight = (int)camera.pixelHeight;

                rt = new RenderTexture(resolutionWidth, resolutionHeight, 24);
                camera.targetTexture = rt;
            }

            camSetting = _camSetting;
            camera.transform.position = _camSetting.position;
            Quaternion quat = new Quaternion();

            quat.eulerAngles = new Vector3(-_camSetting.pitch, -_camSetting.yaw, -_camSetting.roll);
            camera.transform.localRotation = quat;
            camera.name        = _camSetting.id;
            camera.fieldOfView = _camSetting.fieldOfView;
        }
Esempio n. 29
0
    public static void Init(SceneName name)
    {
        CameraSetting.InitUICamera();
        if (m_rootUICanvas == null)
        {
            var rootCanvasGo = new GameObject("UGUIRootCanvas");
            rootCanvasGo.layer = GameSetting.LAYER_VALUE_UI;
            Canvas canvas = rootCanvasGo.AddComponent <Canvas>();
            canvas.renderMode    = RenderMode.ScreenSpaceCamera;
            canvas.worldCamera   = CameraSetting.UICamera;
            canvas.pixelPerfect  = false;
            canvas.sortingOrder  = 0;
            canvas.planeDistance = 0;
            var scaler = rootCanvasGo.AddComponent <CanvasScaler>();
            scaler.uiScaleMode         = CanvasScaler.ScaleMode.ScaleWithScreenSize;
            scaler.referenceResolution = new Vector2(1024f, 576f);
            scaler.screenMatchMode     = CanvasScaler.ScreenMatchMode.Expand;
            rootCanvasGo.AddComponent <GraphicRaycaster>();
            m_rootUICanvas = rootCanvasGo.GetRectTransform();
        }
        if (m_rootScenceCanvas == null)
        {
            var rootCanvasGo = new GameObject("UGUISceneUiRootCanvas");
            rootCanvasGo.layer = GameSetting.LAYER_VALUE_UI;
            Canvas canvas = rootCanvasGo.AddComponent <Canvas>();
            canvas.renderMode    = RenderMode.ScreenSpaceCamera;
            canvas.worldCamera   = CameraSetting.UICamera;
            canvas.pixelPerfect  = false;
            canvas.sortingOrder  = -1;
            canvas.planeDistance = 100;
            var scaler = rootCanvasGo.AddComponent <CanvasScaler>();
            scaler.uiScaleMode         = CanvasScaler.ScaleMode.ScaleWithScreenSize;
            scaler.referenceResolution = new Vector2(1024f, 576f);
            scaler.screenMatchMode     = CanvasScaler.ScreenMatchMode.Expand;
            rootCanvasGo.AddComponent <GraphicRaycaster>();
            m_rootScenceCanvas = rootCanvasGo.GetRectTransform();
        }

        switch (name)
        {
        case SceneName.MainScene:
            if (SceneUiLayer != null)
            {
                Object.DestroyImmediate(SceneUiLayer.gameObject);
                SceneUiLayer = null;
            }
            if (TipLayer != null && !GmView.Active)
            {
                Object.DestroyImmediate(TipLayer.gameObject);
                TipLayer = null;
            }

            if (UiLayer == null)
            {
                UiLayer = AddUiLayer("UILayer");
            }
            if (TipLayer == null)
            {
                TipLayer = AddUiLayer("TipLayer");
                Util.SetGoFrontUiEffect(TipLayer.gameObject, true, 20);
                TipLayer.localPosition = new UnityEngine.Vector3(0, 0, -1000);
            }
            if (GuideLayer == null)
            {
                GuideLayer = AddUiLayer("GuideLayer");
                Util.SetGoFrontUiEffect(GuideLayer.gameObject, true, 15);
                GuideLayer.localPosition = new UnityEngine.Vector3(0, 0, -1000);
            }
            if (EffectLayer == null)
            {
                EffectLayer = AddUiLayer("EffectLayer");
            }
            break;
        }
    }
Esempio n. 30
0
 public void Init(SceneInfo preScene)
 {
     if(preScene != null&&preScene.currentCamera!=null)
         currentCamera = preScene.currentCamera;
 }
    private void UpdateCameraPointer()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            cameraMode          = CameraSetting.free;
            smoothFollow.target = null;
        }
        else if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            if (AirSimUnity.AirSimServer.vehicleList.Count > 0)
            {
                cameraMode = CameraSetting.vehicle;
                if (AirSimUnity.AirSimServer.vehicleList.Count <= VehicleIndx)
                {
                    VehicleIndx = AirSimUnity.AirSimServer.vehicleList.Count - 1;
                }
                smoothFollow.target = AirSimUnity.AirSimServer.vehicleList[VehicleIndx];
            }
        }
        else if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            if (AirSimUnity.AirSimServer.pedestrianList.Count > 0)
            {
                cameraMode = CameraSetting.pedestrian;
                if (AirSimUnity.AirSimServer.pedestrianList.Count <= PedestrianIndx)
                {
                    PedestrianIndx = AirSimUnity.AirSimServer.pedestrianList.Count - 1;
                }
                smoothFollow.target = AirSimUnity.AirSimServer.pedestrianList[PedestrianIndx].GetChild(0);
            }
        }



        if (Input.GetKeyDown(KeyCode.Tab) && Input.GetKey(KeyCode.LeftShift))
        {
            if (cameraMode == CameraSetting.pedestrian)
            {
                PedestrianIndx      = mod((PedestrianIndx - 1), AirSimUnity.AirSimServer.pedestrianList.Count);
                smoothFollow.target = AirSimUnity.AirSimServer.pedestrianList[PedestrianIndx].GetChild(0);
            }
            else if (cameraMode == CameraSetting.vehicle)
            {
                VehicleIndx         = mod((VehicleIndx - 1), AirSimUnity.AirSimServer.vehicleList.Count);
                smoothFollow.target = AirSimUnity.AirSimServer.vehicleList[VehicleIndx];
            }
        }
        else if (Input.GetKeyDown(KeyCode.Tab))
        {
            if (cameraMode == CameraSetting.pedestrian)
            {
                PedestrianIndx      = mod((PedestrianIndx + 1), AirSimUnity.AirSimServer.pedestrianList.Count);
                smoothFollow.target = AirSimUnity.AirSimServer.pedestrianList[PedestrianIndx].GetChild(0);
            }
            else if (cameraMode == CameraSetting.vehicle)
            {
                VehicleIndx         = mod((VehicleIndx + 1), AirSimUnity.AirSimServer.vehicleList.Count);
                smoothFollow.target = AirSimUnity.AirSimServer.vehicleList[VehicleIndx];
            }
        }
    }
Esempio n. 32
0
 private void OnEnable()
 {
     _setting = target as CameraSetting;
 }
Esempio n. 33
0
	/// <summary>
	/// Configurable the specified config.
	/// </summary>
	/// <param name="config">Config.</param>
	public virtual void 			Configurable(CameraSetting config)
	{
		m_Configurable = config;
		
		#if UNITY_EDITOR
		lockPosition 		= m_Configurable.OffsetPosition;
		lockPositionLerp 	= m_Configurable.OffsetPositionLerp;
		lockRotation 		= m_Configurable.OffsetEulerAngles;
		lockRotationLerp 	= m_Configurable.OffsetEulerAnglesLerp;
		#endif
	}
Esempio n. 34
0
 public void SetNormalMode()
 {
     setting = CameraSetting.NORMAL;
     setNormalCameraEnabled(true);
     setOculusRiftCameraEnabled(false);
     setVisualAidsCameraEnabled(true);
     setAudioVRLinkCameraEnabled(false);
     currentFirstPersonCamera = normalCamera;
     currentViewingCamera = visualAidsCamera.GetComponent<Camera>();
     visualAidsGroup.alpha = 1f;
     oculusRiftActivated = false;
     ScreenAudioManager.SetScreen(normalCamera);
 }
Esempio n. 35
0
 public static void InitManagers()
 {
     CameraSetting.InitQualityMgr();
     CameraSetting.InitOcclusionComponent();
 }
Esempio n. 36
0
        /// <summary>
        /// Handle Data Arrival...
        /// </summary>
        /// <param name="refName"></param>
        private void DataUpdate(string refName)
        {
            // sanity
            if (!SC.SimConnectClient.Instance.IsConnected)
            {
                return;
            }

            _updating = true;

            var cam = SC.SimConnectClient.Instance.CameraModule;

            // Index Buttons (_prevIndex SHALL never be out of range...)
            _btIndex[_prevIndex].BackColor = c_vPassive;
            if (cam.ActCamView_index < _btIndex.Count)
            {
                _prevIndex = _actIndex;
                _actIndex  = (int)cam.ActCamView_index;
                _btIndex[_actIndex].BackColor = c_vActive;
            }
            SetIndexEnabled(cam.ActCam_View_index_max(cam.ActCam_viewType));

            // ViewMode Buttons
            _btMode[_prevSetting].Button.BackColor = c_vPassive;
            if (cam.CameraSetting != CameraSetting.NONE)
            {
                _prevSetting = _actSetting;
                _actSetting  = cam.CameraSetting;
                _btMode[_actSetting].Button.BackColor = c_vActive;
            }

            // Drone
            cbxDroneLock.CheckState   = cam.DroneCam_locked ? CheckState.Checked : CheckState.Unchecked;
            cbxDroneFollow.CheckState = cam.DroneCam_follow ? CheckState.Checked : CheckState.Unchecked;
            tbMove.Value   = (int)cam.DroneCam_movespeed;
            tbRotate.Value = (int)cam.DroneCam_rotspeed;
            if (_droneMovement < 2)
            {
                _droneMovement = (int)cam.DroneCam_movespeed;               // init or don't stay at 0
            }
            if (_droneRotation < 2)
            {
                _droneRotation = (int)cam.DroneCam_rotspeed;               // init or don't stay at 0
            }
            if (cam.CameraSetting == CameraSetting.ShCase_Drone)
            {
                pnlDroneSlider.BackColor = pnlDrone.BackColor;
                cbxDroneFollow.Enabled   = true;
                cbxDroneLock.Enabled     = true;
            }
            else
            {
                pnlDroneSlider.BackColor = this.BackColor; // Window Back
                cbxDroneFollow.Enabled   = false;
                cbxDroneLock.Enabled     = false;
            }

            // SmartTarget
            if (cam.SmartCam_active)
            {
                txSmartTargetType.Text      = $"{cam.SmarCamTarget_selected_type}";
                txSmartTargetName.Text      = cam.SmarCamTarget_selected_name;
                txSmartTargetType.ForeColor = c_scActiveText;
                txSmartTargetName.ForeColor = c_scActiveText;
                lbxSmartTargets.ForeColor   = c_scActiveText;
            }
            else
            {
                txSmartTargetType.Text      = "---";
                txSmartTargetName.Text      = "---";
                txSmartTargetType.ForeColor = c_scPassiveText;
                txSmartTargetName.ForeColor = c_scPassiveText;
                lbxSmartTargets.ForeColor   = c_scPassiveText;
            }

            PopulateSmartTargets(cam); // new targets to show

            _updating = false;
        }
Esempio n. 37
0
	/// <summary>
	/// Installs the main player.
	/// </summary>
	protected void 			InstallMainPlayer()
	{
		int nCurSceneID 	= SceneSupport.GetSingleton().GetSceneID();

		// Query current scene config
		SqlScene sqlScene 	= GameSqlLite.GetSingleton().Query<SqlScene>(nCurSceneID);
		if (!sqlScene)
			throw new System.NullReferenceException();
	
		// Query main player job info
		SqlJob sqlJob = GameSqlLite.GetSingleton().Query<SqlJob>(GlobalUserInfo.Job);
		if (!sqlJob)
			throw new System.NullReferenceException();

		// create mian player entity
		PlayerEntity entity = PlayerMgr.CreateEntity(EntityType.ET_MAIN.ToString(), 
		                                             EntityType.ET_MAIN, 
		                                             0, 
		                                             string.Empty, 
		                                             sqlScene.Born, 
		                                             Vector3.one, 
		                                             Vector3.zero,
		                                             0, 
		                                             sqlJob.ShapeID) as PlayerEntity;

		SqlCamera sqlCamera = GameSqlLite.GetSingleton().Query<SqlCamera>(sqlScene.CameraID);
		if (sqlCamera)
		{
			CameraSetting cs = new CameraSetting();
			cs.ID 						= sqlCamera.ID;
			cs.FieldOfView				= sqlCamera.FieldOfView;
			cs.IsRelative				= sqlCamera.IsRelative;
			cs.OffsetEulerAngles		= sqlCamera.OffsetEulerAngles;
			cs.OffsetEulerAnglesLerp	= sqlCamera.OffsetEulerAnglesLerp;
			cs.OffsetPosition			= sqlCamera.OffsetPosition;
			cs.OffsetPositionLerp		= sqlCamera.OffsetPositionLerp;
			
			// config the camera param
			MainCamrea.Configurable(cs);

			// bind character
			MainCamrea.SetTarget(entity, entity.transform, entity.transform);
			MainCamrea.Startup();
		}

		PlayerMgr.SetPlayer(entity);
	}
Esempio n. 38
0
 public void SetOculusRiftMode()
 {
     if (!IsOculusRiftConnected())
     {
         Debug.LogError("Oculus Rift is not connected.");
         return;
     }
     setting = CameraSetting.OCULUSRIFT;
     setNormalCameraEnabled(false);
     setOculusRiftCameraEnabled(true);
     setVisualAidsCameraEnabled(false);
     setAudioVRLinkCameraEnabled(false);
     currentFirstPersonCamera = oculusRiftRightCamera;
     currentViewingCamera = oculusRiftRightCamera;
     visualAidsGroup.alpha = 0f;
     oculusRiftActivated = true;
     ScreenAudioManager.SetScreen(oculusRiftRightCamera);
 }
Esempio n. 39
0
 private void SetAudioVRLinkMode()
 {
     AudioVRLink.connect();
     if (!AudioVRLink.isConnected())
     {
         Debug.LogError("Audio VR Link is not connected.");
         return;
     }
     setting = CameraSetting.AUDIOVRLINK;
     setNormalCameraEnabled(false);
     setOculusRiftCameraEnabled(false);
     setVisualAidsCameraEnabled(false);
     setAudioVRLinkCameraEnabled(true);
     currentFirstPersonCamera = audioVRLinkCamera;
     currentViewingCamera = audioVRLinkCamera;
     visualAidsGroup.alpha = 0f;
     oculusRiftActivated = false;
     ScreenAudioManager.SetScreen(audioVRLinkCamera);
 }
Esempio n. 40
0
 public void SetHeadTrackingMode()
 {
     if (!IsOculusRiftConnected())
     {
         Debug.LogError("Oculus Rift is not connected.");
         return;
     }
     setting = CameraSetting.HEADTRACKING;
     setNormalCameraEnabled(false);
     setOculusRiftCameraEnabled(true);
     setVisualAidsCameraEnabled(true);
     setAudioVRLinkCameraEnabled(false);
     currentFirstPersonCamera = oculusRiftRightCamera;
     currentViewingCamera = visualAidsCamera.GetComponent<Camera>();
     visualAidsGroup.alpha = 1f;
     oculusRiftActivated = true;
     ScreenAudioManager.SetScreen(oculusRiftRightCamera);
 }