Beispiel #1
0
        public BasePropertyChanger GetPropertyChanger()
        {
            ChangeBool result = new ChangeBool();

            result.SetValue(rbTrue.Checked);
            return(result);
        }
Beispiel #2
0
        internal async Task Observers_Should_Not_Receive_Dispatched_Actions_After_Disposing_Subscription()
        {
            var changeInt        = new ChangeInt(5);
            var changeBool       = new ChangeBool(true);
            var observedActionsA = new List <object>();
            var observedActionsB = new List <object>();
            var subscriptionA    = _store.Observe().Subscribe(observedActionsA.Add);
            var subscriptionB    = _store.Observe().Subscribe(observedActionsB.Add);

            await _store.Dispatch(changeInt);

            observedActionsA.ShouldBe(new object[] { changeInt });
            observedActionsB.ShouldBe(new object[] { changeInt });

            subscriptionA.Dispose();
            await _store.Dispatch(changeBool);

            observedActionsA.ShouldBe(new object[] { changeInt });
            observedActionsB.ShouldBe(new object[] { changeInt, changeBool });

            subscriptionB.Dispose();
            await _store.Dispatch(new object());

            observedActionsA.ShouldBe(new object[] { changeInt });
            observedActionsB.ShouldBe(new object[] { changeInt, changeBool });
        }
Beispiel #3
0
        internal async Task Subscribers_Should_Only_Receive_Actions_Of_Type_They_Subscribe_To()
        {
            var tcs = new TaskCompletionSource <object>();

            Task HandleDispatchedChangeBoolAction(ChangeBool changeBoolAction)
            {
                tcs.SetResult(changeBoolAction);
                return(Task.CompletedTask);
            }

            _store.Subscribe <ChangeBool>(HandleDispatchedChangeBoolAction);

            var changeInt  = new ChangeInt(5);
            var changeBool = new ChangeBool(true);
            await _store.Dispatch(changeInt);

            await _store.Dispatch(changeBool);

            var receivedAction = await tcs.Task;

            receivedAction.ShouldBe(changeBool);
        }
        public override void DrawInspectorGUI()
        {
            rigbody = (Rigidbody)UnityEditor.EditorGUILayout.ObjectField(new GUIContent("Rigidbody",
                                                                                        "The rigidbody that will be changed"), rigbody, typeof(Rigidbody), true);

            setMass = UnityEditor.EditorGUILayout.TextField(new GUIContent("Set Mass",
                                                                           "Set the mass of this rigidbody. If left blank the value will not be changed."), setMass);

            setDrag = UnityEditor.EditorGUILayout.TextField(new GUIContent("Set Drag",
                                                                           "Set the drag of this rigidbody. If left blank the value will not be changed."), setDrag);

            setAngularDrag = UnityEditor.EditorGUILayout.TextField(new GUIContent("Set Angular Drag",
                                                                                  "Set the angular drag of this rigidbody. If left blank the value will not be changed."), setAngularDrag);

            changeGravity = (ChangeBool)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Change Gravity",
                                                                                             "Choose to set whether this rigidbody should use gravity. Remain the same will not change the value and toggle will invert the value."), changeGravity);

            changeKinematic = (ChangeBool)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Change Kinematic",
                                                                                               "Choose to set whether this rigidbody should be kinematic. Remain the same will not change the value and toggle will invert the value."), changeKinematic);

            changeInterpolate = (ChangeInterpolate)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Change Interpolate",
                                                                                                        "Choose to set this rigidbody to interpolate or extrapolate. Remain the same will not change the value."), changeInterpolate);

            changeCollisionDetection = (ChangeCollisionDetection)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Change Collision Detection",
                                                                                                                      "Choose to set this rigidbody's collision detection between discrete or continuous. Remain the same will not change the value."), changeCollisionDetection);

            editConstraints = UnityEditor.EditorGUILayout.Toggle(new GUIContent("Edit Constraints", "Allows you to freeze position or rotation. If you want these to be unaffected uncheck this box."), editConstraints);

            if (editConstraints)
            {
                UnityEditor.EditorGUILayout.BeginHorizontal();

                float prevWidth = UnityEditor.EditorGUIUtility.labelWidth;

                UnityEditor.EditorGUILayout.LabelField(new GUIContent("Freeze Position", "Allows you to freeze movement in a specific axis."));

                UnityEditor.EditorGUIUtility.labelWidth = 30f;

                xPos = UnityEditor.EditorGUILayout.Toggle("X", xPos);
                yPos = UnityEditor.EditorGUILayout.Toggle("Y", yPos);
                zPos = UnityEditor.EditorGUILayout.Toggle("Z", zPos);

                UnityEditor.EditorGUIUtility.labelWidth = prevWidth;

                UnityEditor.EditorGUILayout.EndHorizontal();

                UnityEditor.EditorGUILayout.BeginHorizontal();

                UnityEditor.EditorGUILayout.LabelField(new GUIContent("Freeze Rotation", "Allows you to freeze rotation in a specific axis."));

                UnityEditor.EditorGUIUtility.labelWidth = 30f;

                xRot = UnityEditor.EditorGUILayout.Toggle("X", xRot);
                yRot = UnityEditor.EditorGUILayout.Toggle("Y", yRot);
                zRot = UnityEditor.EditorGUILayout.Toggle("Z", zRot);

                UnityEditor.EditorGUIUtility.labelWidth = prevWidth;

                UnityEditor.EditorGUILayout.EndHorizontal();
            }
        }
Beispiel #5
0
 public override void ClickEvent()
 {
     if (Change == null)
         Change = Managers.Executive.menuStack.Peek().ChangeBool;
    Change(index);
 }