コード例 #1
0
ファイル: PresetDrawer.cs プロジェクト: AtwoodDeng/Blind
        private void OnCameraBotGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            Preset preset = PropertyExtend.GetCurrent(property) as Preset;

            if (preset == null && property.serializedObject.targetObject is CameraBot)
            {
                CameraBot self = property.serializedObject.targetObject as CameraBot;
                self.OnValidate();
                return;
            }
            SerializedObject presetObj = new SerializedObject(preset);

            presetObj.Update();

            EditorGUI.BeginProperty(position, label, property);

            Rect line = position.Clone(height: lineH);

            Rect[] cells = line.SplitHorizontal(.1f, 50, 70);

            // First line
            if (GUI.Button(cells[0], (preset.m_DisplayOnScene ? "Show" : "Hide")))
            {
                preset.m_DisplayOnScene = !preset.m_DisplayOnScene;
            }

            cells = cells[1].Modify(x: 20f, width: -20f).SplitHorizontal(.85f);
            property.isExpanded = EditorGUI.Foldout(cells[0].Modify(), property.isExpanded, ((!property.isExpanded) ? preset.gameObject.name : ""));
            preset.m_DebugColor = EditorGUI.ColorField(cells[1], GUIContent.none, preset.m_DebugColor);

            if (property.isExpanded)
            {
                line = line.GetRectBottom(height: lineH).Modify(y: lineS);
                preset.gameObject.name = EditorGUI.TextField(line, preset.gameObject.name);

                SerializedProperty virtualPositionProp = presetObj.FindProperty("m_VirtualPosition");
                line = line.GetRectBottom(height: VirtualPositionDrawer.GetStaticHeight(virtualPositionProp)).Modify(y: lineS);
                EditorGUI.PropertyField(line, virtualPositionProp, true);

                SerializedProperty zoomProp = presetObj.FindProperty("m_Zoom");
                line = line.GetRectBottom(height: ZoomDrawer.GetStaticHeight(zoomProp)).Modify(y: lineS);
                EditorGUI.PropertyField(line, zoomProp, true);

                SerializedProperty clampAngleProp = presetObj.FindProperty("m_ClampAngle");
                line = line.GetRectBottom(height: ClampAngleDrawer.GetStaticHeight(clampAngleProp)).Modify(y: lineS);
                EditorGUI.PropertyField(line, clampAngleProp, true);

                SerializedProperty methodProp = presetObj.FindProperty("m_Method");
                line = line.GetRectBottom(height: MethodDrawer.GetStaticHeight(methodProp)).Modify(y: lineS);
                EditorGUI.PropertyField(line, methodProp, true);

                SerializedProperty positionOverriderProp = presetObj.FindProperty("m_PositionOverrider");
                line = line.GetRectBottom(height: PositionOverriderDrawer.GetStaticHeight(positionOverriderProp)).Modify(y: lineS);
                EditorGUI.PropertyField(line, positionOverriderProp, true);
            }


            presetObj.ApplyModifiedProperties();
            EditorGUI.EndProperty();
        }
コード例 #2
0
    void Awake()
    {
        m_Rigidbody           = GetComponent <Rigidbody> ();
        m_CharacterController = GetComponent <CharacterController> ();

        if (m_CamTransform == null && Camera.main != null)
        {
            m_CamTransform = Camera.main.transform;
        }

        if (m_CamTransform != null)
        {
            m_MainCamera = m_CamTransform.GetComponent <Camera> ();
        }

        if (cameraBot == null)
        {
            cameraBot = FindObjectOfType <CF.CameraBot.CameraBot> ();
        }

        if (m_animator != null)
        {
            m_animator = GetComponentInChildren <Animator> ();
        }

        if (model != null)
        {
        }

        cameraBot.InputSetting.Sensitive = CameraSensity;
        oriCamBotSensity = CameraSensity;
    }
コード例 #3
0
ファイル: PCKeyInput.cs プロジェクト: AtwoodDeng/Blind
 void FixedUpdate()
 {
     CameraBot.UpdatePosition(
         GetDirection.x,
         GetDirection.y,
         GetRotate.x,
         GetRotate.y,
         GetZoom);
 }
コード例 #4
0
ファイル: CameraBotEditor.cs プロジェクト: AtwoodDeng/Blind
 void OnEnable()
 {
     Tools.hidden = true;
     controlId    = GUIUtility.GetControlID(FocusType.Passive);
     self         = (CameraBot)target;
     InitReorderableList();
     InitTmpCameraOnScene();
     delta                     = delta1sec = delta5sec = delta10sec = 0f;
     lastUpdateTime            = EditorApplication.timeSinceStartup;
     EditorApplication.update += EditorUpdate;
 }
コード例 #5
0
ファイル: PCKeySwitch.cs プロジェクト: AtwoodDeng/Blind
 private void TriggerSwitchCamera()
 {
     foreach (BindKey bindKey in bindKeyList)
     {
         if (Input.GetKeyUp(bindKey.KeyCode))
         {
             CameraBot.SwitchCamera(bindKey.CameraName);
             break;
         }
     }
 }
コード例 #6
0
        void FixedUpdate()
        {
            Vector2 rotate = new Vector2(
                Input.acceleration.x * ((flipX) ? 1f : -1f),
                Input.acceleration.y * ((flipY) ? 1f : -1f));

            if (rotate.sqrMagnitude > 1f)
            {
                rotate.Normalize();
            }

            Vector2 move = new Vector2(
                ((Horizontal.Length > 0) ? Input.GetAxis(Horizontal) : 0f),
                ((Vertical.Length > 0) ? Input.GetAxis(Vertical) : 0f)
                );


            CameraBot.UpdatePosition(move.x, move.y, rotate.y, rotate.x, 0f);
        }
コード例 #7
0
 public PresetReorderableList(SerializedObject serializedObject, string propertyName, bool dragable = true, bool displayHeader = true, bool displayAddButton = true, bool displayRemoveButton = true)
     : base(serializedObject, propertyName, dragable, displayHeader, displayAddButton, displayRemoveButton)
 {
     target = serializedObject.targetObject as CameraBot;
 }