예제 #1
0
        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
 void FixedUpdate()
 {
     CameraBot.UpdatePosition(
         GetDirection.x,
         GetDirection.y,
         GetRotate.x,
         GetRotate.y,
         GetZoom);
 }
예제 #4
0
 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
 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;
 }