Esempio n. 1
0
        protected virtual void DrawItemSpawningProperties(SerializedObject m_Object)
        {
            // Item spawning options
            SerializedProperty property = m_Object.FindProperty("spawnItemsOnStateEnter");

            EditorGUILayout.PropertyField(property);

            if (property.boolValue)
            {
                property = m_Object.FindProperty("itemSpawnMode");
                EditorGUILayout.PropertyField(property);

                if (itemSpawnMode == ItemSpawnMode.SpawnPoint)
                {
                    property = m_Object.FindProperty("itemSpawnPoint");
                    EditorGUILayout.PropertyField(property);
                }
                else if (itemSpawnMode == ItemSpawnMode.Transform)
                {
                    property = m_Object.FindProperty("itemSpawnTfm");
                    EditorGUILayout.PropertyField(property);
                }

                property = m_Object.FindProperty("exactPosition");
                EditorGUILayout.PropertyField(property);

                InspectorHelper.DrawArray(m_Object, "spawnableItems");

                property = m_Object.FindProperty("totalAmount");
                EditorGUILayout.PropertyField(property);
            }
        }
        /// <summary>
        /// Allow the joint to render it's own GUI. This GUI is used
        /// for displaying and manipulating the joint itself.
        /// </summary>
        /// <returns>Reports if the object's value was changed</returns>
        public override bool OnInspectorManipulatorGUI(IKBoneModifier rModifier)
        {
#if UNITY_EDITOR
            // Determine if the swing is changing
            if (mBone != null)
            {
                Vector3 lSwing    = rModifier.Swing.eulerAngles;
                Vector3 lNewSwing = InspectorHelper.Vector3Fields("Swing", "Euler angles to swing the bone.", lSwing, true, true, false);
                if (lNewSwing != lSwing)
                {
                    // Grab the amount that was just rotated by based on the current rotation.
                    // We do this so the change is relative to the current swing rotation
                    Vector3 lDeltaRotations = lNewSwing - lSwing;
                    rModifier.Swing = rModifier.Swing * Quaternion.Euler(lDeltaRotations);

                    rModifier.IsDirty = true;
                }

                // Determine if the twist is changing
                //float lTwist = mBone.Twist.eulerAngles.y;
                float lTwist    = Vector3Ext.SignedAngle(Vector3.up, rModifier.Twist * Vector3.up, Vector3.forward);
                float lNewTwist = EditorGUILayout.FloatField("Twist", lTwist);
                if (_AllowTwist && lNewTwist != lTwist)
                {
                    rModifier.Twist   = Quaternion.AngleAxis(lNewTwist, Vector3.forward);
                    rModifier.IsDirty = true;
                }

                // Reset the values if needed
                if (GUILayout.Button("reset rotation", EditorStyles.miniButton))
                {
                    rModifier.Swing   = Quaternion.identity;
                    rModifier.Twist   = (_AllowTwist ? Quaternion.identity : mBone._Twist);
                    rModifier.IsDirty = true;

                    mBone._Transform.localRotation = mBone._BindRotation;
                }

                if (rModifier.IsDirty)
                {
                    // Before we go to far, see if we are within the joint limits. If not,
                    // we need to go back to a good position.
                    bool lIsInLimits = ApplyLimits(ref rModifier.Swing, ref rModifier.Twist);
                    if (lIsInLimits || QuaternionExt.IsEqual(rModifier.Swing, Quaternion.identity))
                    {
                        mLastSwing = rModifier.Swing;
                        mLastTwist = rModifier.Twist;
                    }
                    else
                    {
                        rModifier.Swing = mLastSwing;
                        rModifier.Twist = mLastTwist;
                    }
                }
            }
#endif

            return(rModifier.IsDirty);
        }
 public void TestGetFieldOffsets()
 {
     Console.WriteLine(
         string.Join("\r\n",
                     InspectorHelper.GetFieldOffsets(typeof(ByteAndInt))
                     .Select(tpl => $"Field {tpl.fieldInfo.Name}: starts at offset {tpl.offset}"))
         );
 }
Esempio n. 4
0
    private void createAttachToSurfaceMoverBehaviorUI(MoverBehavior moverBehavior)
    {
        SurfaceMoverBehavior surfaceMover = moverBehavior as SurfaceMoverBehavior;

        if (surfaceMover != null)
        {
            //EditorGUI.BeginChangeCheck();
            //Vector3 positionOffset = EditorGUILayout.Vector3Field("Position Offset", surfaceMover.getPositionOffset());
            //if (EditorGUI.EndChangeCheck())
            //{
            //	Undo.RecordObject(surfaceMover, "Position Offset");
            //	EditorUtility.SetDirty(surfaceMover);
            //	surfaceMover.setPositionOffset(positionOffset);
            //}

            EditorGUILayout.LabelField("Surface Collision Checker Transform");
            EditorGUI.BeginChangeCheck();
            Transform surfaceCheckTransform = (Transform)EditorGUILayout.ObjectField(surfaceMover.getSurfaceCheckSourceTransform(), typeof(Transform), true);
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(surfaceMover, "Surface Collision Checker Transform");
                EditorUtility.SetDirty(surfaceMover);
                surfaceMover.setSurfaceCheckSourceTransform(surfaceCheckTransform);
            }

            if (surfaceCheckTransform)
            {
                EditorGUI.BeginChangeCheck();
                Vector3 rayCastDirection = EditorGUILayout.Vector3Field("Default RayCast Direction", surfaceMover.getDefaultRaycastDirection());
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(surfaceMover, "Default RayCast Direction");
                    EditorUtility.SetDirty(surfaceMover);
                    surfaceMover.setDefaultRaycastDirection(rayCastDirection);
                }

                LayerMask surfaceLayerMask = InspectorHelper.convert32BitLayerMaskToTrimmedMask(surfaceMover.getSurfaceLayerMask());
                EditorGUI.BeginChangeCheck();
                surfaceLayerMask = EditorGUILayout.MaskField("Surface Layer Mask", surfaceLayerMask, UnityEditorInternal.InternalEditorUtility.layers);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(surfaceMover, "Surface Layer Mask");
                    EditorUtility.SetDirty(surfaceMover);

                    surfaceMover.setSurfaceLayerMask(InspectorHelper.convertTrimmedLayerMaskTo32BitMask(surfaceLayerMask));
                }
            }

            EditorGUI.BeginChangeCheck();
            float friction = EditorGUILayout.FloatField("Friction", surfaceMover.getFrictionValue());
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(surfaceMover, "Friction");
                EditorUtility.SetDirty(surfaceMover);
                surfaceMover.setFrictionValue(Mathf.Clamp01(friction));
            }
        }
    }
    // Implement your own custom GUI here if you want to
    public override void DrawInspectorProperties(AIBehaviors fsm, SerializedObject sObject)
    {
        if (fsm.GetComponent <NavMeshAgent>() == null)
        {
            Color oldColor = GUI.contentColor;
            GUI.contentColor = Color.yellow;
            EditorGUILayout.HelpBox("This trigger only works with an AI that uses a NavMeshAgent", MessageType.Warning);
            GUI.contentColor = oldColor;
        }

        InspectorHelper.DrawInspector(sObject);
    }
Esempio n. 6
0
        protected override void DrawStateInspectorEditor(SerializedObject m_Object, AIBehaviors stateMachine)
        {
            GUILayout.Label("Dead Properties:", EditorStyles.boldLabel);

            GUILayout.BeginVertical(GUI.skin.box);

            InspectorHelper.DrawInspector(m_Object);

            GUILayout.EndVertical();

            m_Object.ApplyModifiedProperties();
        }
Esempio n. 7
0
    /**
     * Called to draw the custom inspector
     */
    public override void OnInspectorGUI()
    {
        // Buffering info
        Arena instance = (Arena)target;

        // Rendering
        InspectorHelper.DisplayInfoMessage("Here you can set up the arena");
        InspectorHelper.DisplaySeparator("Physics");
        PhysicSection(instance);

        // Editor bug fix with custom window
        EditorUtility.SetDirty(instance);
    }
    /**
     * Called to draw the custom inspector
     */
    public override void OnInspectorGUI()
    {
        // Buffering info
        PlayerInputController controller = (PlayerInputController)target;

        // Rendering
        InspectorHelper.DisplayInfoMessage("You can modify all player settings from this custom editor window");
        InspectorHelper.DisplaySeparator("Player input settings");
        InputSection(controller);

        // Editor bug fix with custom window
        EditorUtility.SetDirty(controller);
    }
    /**
     * Called to draw the custom inspector
     */
    public override void OnInspectorGUI()
    {
        // Getting target
        PlayerSphereController controller = (PlayerSphereController)target;

        InspectorHelper.DisplaySeparator("Weapon");
        WeaponSection(controller);

        InspectorHelper.DisplaySeparator("Debug");
        DebugSection(controller);

        EditorUtility.SetDirty(controller);
    }
Esempio n. 10
0
        private void FillRulesAux(Inspector inspector)
        {
            if (inspector.Enable)
            {
                inspector.ImageEnable = @"/Resources/play.png";
            }
            else
            {
                inspector.ImageEnable = @"/Resources/pausa.png";
            }

            inspector.CheckPeriodText = InspectorDetail.GetPeriodText(inspector.CheckPeriod) + " ";

            inspector.RulesAux = new List <InspectorHelper>(3);

            var queryRule = from rule in inspector.Rules
                            where rule.RuleType.Equals((int)RuleFile.TypeFileRule.FileName)
                            select rule;

            InspectorHelper inspHelper = new InspectorHelper();

            inspHelper.CountRuleType = queryRule.Count();
            inspHelper.Type          = RuleFile.TypeFileRule.FileName;
            inspHelper.ImagePath     = @"/images/icon_ruleFileName.png";

            inspector.RulesAux.Add(inspHelper);

            queryRule = from rule in inspector.Rules
                        where rule.RuleType.Equals((int)RuleFile.TypeFileRule.Extension)
                        select rule;

            inspHelper = new InspectorHelper();
            inspHelper.CountRuleType = queryRule.Count();
            inspHelper.Type          = RuleFile.TypeFileRule.Extension;
            inspHelper.ImagePath     = @"/images/icon_ruleFileExtension.png";

            inspector.RulesAux.Add(inspHelper);

            queryRule = from rule in inspector.Rules
                        where rule.RuleType.Equals((int)RuleFile.TypeFileRule.Date)
                        select rule;

            inspHelper = new InspectorHelper();
            inspHelper.CountRuleType = queryRule.Count();
            inspHelper.Type          = RuleFile.TypeFileRule.Date;
            inspHelper.ImagePath     = @"/images/icon_ruleFileDate.png";

            inspector.RulesAux.Add(inspHelper);
        }
        // ************************************** EDITOR SUPPORT **************************************

        /// <summary>
        /// Allow the constraint to render it's own GUI
        /// </summary>
        /// <returns>Reports if the object's value was changed</returns>
        public override bool OnInspectorConstraintGUI(bool rIsSelected)
        {
            bool lIsDirty = false;

#if UNITY_EDITOR
            GUILayout.Space(5);

            // Determine if the swing is changing
            if (mBone != null)
            {
                Vector3 lSwing    = _Swing.eulerAngles;
                Vector3 lNewSwing = InspectorHelper.Vector3Fields("Swing", "Euler angles to swing the bone.", lSwing, true, true, false);
                if (lNewSwing != lSwing)
                {
                    lIsDirty = true;

                    // Grab the amount that was just rotated by based on the current rotation.
                    // We do this so the change is relative to the current swing rotation
                    Vector3 lDeltaRotations = lNewSwing - lSwing;
                    _Swing = _Swing * Quaternion.Euler(lDeltaRotations);
                }

                // Determine if the twist is changing
                float lTwist    = Vector3Ext.SignedAngle(Vector3.up, _Twist * Vector3.up, Vector3.forward);
                float lNewTwist = EditorGUILayout.FloatField("Twist", lTwist);
                if (lNewTwist != lTwist)
                {
                    lIsDirty = true;
                    _Twist   = Quaternion.AngleAxis(lNewTwist, Vector3.forward);
                }

                // Reset the values if needed
                if (GUILayout.Button("reset rotation", EditorStyles.miniButton))
                {
                    _Swing   = Quaternion.identity;
                    _Twist   = Quaternion.identity;
                    lIsDirty = true;
                }

                if (lIsDirty)
                {
                    mBone.SetLocalRotation(_Swing, _Twist, 1f);
                }
            }
#endif

            return(lIsDirty);
        }
    /**
     * Called to draw the custom inspector
     */
    public override void OnInspectorGUI()
    {
        // Buffering info
        SoundEvent soundEvent = (SoundEvent)target;

        InspectorHelper.DisplaySeparator("Informations");
        soundEvent.SoundEventName = EditorGUILayout.TextField("Name", soundEvent.SoundEventName);

        EditorGUILayout.Space();
        InspectorHelper.DisplaySeparator("Event type");
        soundEvent.Play = EditorGUILayout.Toggle("Type Play", soundEvent.Play);
        soundEvent.Stop = EditorGUILayout.Toggle("Type Stop", soundEvent.Stop);

        EditorGUILayout.Space();
        InspectorHelper.DisplaySeparator("Settings");
        if (soundEvent.Play)
        {
            soundEvent.SoundEventType        = (SoundEvent.Type)EditorGUILayout.EnumPopup(soundEvent.SoundEventType);
            soundEvent.SoundEventLoop        = EditorGUILayout.Toggle("Loop ", soundEvent.SoundEventLoop);
            soundEvent.SoundEventTarget      = EditorGUILayout.ObjectField(soundEvent.SoundEventTarget, typeof(AudioClip), false) as AudioClip;
            soundEvent.SoundEventMaxInstance = EditorGUILayout.IntField("Max instance", soundEvent.SoundEventMaxInstance);
            soundEvent.SoundEventVolume      = EditorGUILayout.FloatField("Volume", soundEvent.SoundEventVolume);
            soundEvent.SoundEventPitch       = EditorGUILayout.FloatField("Pitch ", soundEvent.SoundEventPitch);
            soundEvent.SoundEventReverb      = EditorGUILayout.FloatField("Reverb", soundEvent.SoundEventReverb);

            soundEvent.RandomizePitch  = EditorGUILayout.Toggle("Randomize pitch ", soundEvent.RandomizePitch);
            soundEvent.RandomizeVolume = EditorGUILayout.Toggle("Randomize volume", soundEvent.RandomizeVolume);

            if (soundEvent.RandomizePitch)
            {
                soundEvent.PitchRandomRange = EditorGUILayout.Vector2Field("Pitch random range  ", soundEvent.PitchRandomRange);
            }

            if (soundEvent.RandomizeVolume)
            {
                soundEvent.VolumeRandomRange = EditorGUILayout.Vector2Field("Volume random range", soundEvent.VolumeRandomRange);
            }
        }

        if (soundEvent.Stop)
        {
            soundEvent.SoundEventTarget = EditorGUILayout.ObjectField(soundEvent.SoundEventTarget, typeof(AudioClip), false) as AudioClip;
        }

        // Editor bug fix with custom window
        EditorUtility.SetDirty(soundEvent);
    }
        /// <summary>
        /// Allow the joint to render it's own GUI. This GUI is used
        /// for displaying and manipulating the joint itself.
        /// </summary>
        /// <returns>Reports if the object's value was changed</returns>
        public override bool OnInspectorManipulatorGUI(IKBoneModifier rModifier)
        {
#if UNITY_EDITOR
            // Determine if the swing is changing
            if (mBone != null)
            {
                // Determine if the swing is changing
                Vector3 lSwing    = rModifier.Swing.eulerAngles;
                Vector3 lNewSwing = InspectorHelper.Vector3Fields("Swing", "Euler angles to swing the bone.", lSwing, true, true, false); //lBoneForward.x == 0f, lBoneForward.y == 0f, lBoneForward.z == 0f);
                if (lNewSwing != lSwing)
                {
                    // Grab the amount that was just rotated by based on the current rotation.
                    // We do this so the change is relative to the current swing rotation
                    Vector3 lDeltaRotations = lNewSwing - lSwing;
                    rModifier.Swing = rModifier.Swing * Quaternion.Euler(lDeltaRotations);

                    rModifier.IsDirty = true;
                }

                float lTwist    = Vector3Ext.SignedAngle(Vector3.up, rModifier.Twist * Vector3.up, Vector3.forward);
                float lNewTwist = EditorGUILayout.FloatField("Twist", lTwist);
                if (lNewTwist != lTwist)
                {
                    rModifier.Twist   = Quaternion.AngleAxis(lNewTwist, Vector3.forward);
                    rModifier.IsDirty = true;
                }

                // Reset the values if needed
                if (GUILayout.Button("reset rotation", EditorStyles.miniButton))
                {
                    rModifier.Swing   = Quaternion.identity;
                    rModifier.Twist   = Quaternion.identity;
                    rModifier.IsDirty = true;

                    mBone._Transform.localRotation = mBone._BindRotation;
                }

                if (rModifier.IsDirty)
                {
                    ApplyLimits(ref rModifier.Swing, ref rModifier.Twist);
                }
            }
#endif

            return(rModifier.IsDirty);
        }
Esempio n. 14
0
        protected override void DrawStateInspectorEditor(SerializedObject m_Object, AIBehaviors stateMachine)
        {
            SerializedProperty property;

            GUILayout.Label("Dead Properties:", EditorStyles.boldLabel);

            GUILayout.BeginVertical(GUI.skin.box);

            property = m_Object.FindProperty("destroyGameObject");
            EditorGUILayout.PropertyField(property, new GUIContent("Destroy This Object"));
            if (property.boolValue)
            {
                property = m_Object.FindProperty("destroyAfterTime");
                EditorGUILayout.PropertyField(property);
            }

            property = m_Object.FindProperty("destroyColliders");
            EditorGUILayout.PropertyField(property);

            property = m_Object.FindProperty("destroyGameObjects");
            EditorGUILayout.PropertyField(property);
            if (property.boolValue)
            {
                InspectorHelper.DrawArray(m_Object, "gameObjectsToDestroy");
            }

            property = m_Object.FindProperty("destroyComponents");
            EditorGUILayout.PropertyField(property);
            if (property.boolValue)
            {
                InspectorHelper.DrawArray(m_Object, "componentsToDestroy");
            }

            property = m_Object.FindProperty("changeTag");
            EditorGUILayout.PropertyField(property);
            if (property.boolValue)
            {
                property = m_Object.FindProperty("deadTag");
                EditorGUILayout.PropertyField(property);
            }

            GUILayout.EndVertical();

            m_Object.ApplyModifiedProperties();
        }
    /**
     * Called to draw the custom inspector
     */
    public override void OnInspectorGUI()
    {
        // Buffering info
        PlayerController controller = (PlayerController)target;

        playerBody = controller.GetComponent <Rigidbody2D>();

        // Rendering
        InspectorHelper.DisplaySeparator("Rendering");
        RenderingSection(controller);

        // Gameplay
        InspectorHelper.DisplaySeparator("Gameplay");
        GameplaySection(controller);

        DrawDefaultInspector();

        // Editor bug fix with custom window
        EditorUtility.SetDirty(controller);
    }
Esempio n. 16
0
        public static void Main(string[] args)
        {
            var st1 = new SomeType();
            var st2 = new SomeType {
                S = "Hello!"
            };

            var pid = Process.GetCurrentProcess().Id;

            using var target = DataTarget.AttachToProcess(pid, 3000, AttachFlag.Passive);
            var runtime = target.ClrVersions[0].CreateRuntime();
            var heap    = runtime.Heap;

            Console.WriteLine($"CanWalkHeap: {heap.CanWalkHeap}");
            ulong st1size = ObjSize(heap, (ulong)st1.GetAddress1());

            Console.WriteLine($"ClrMd st1 size: {st1size}");
            ulong st2size = ObjSize(heap, (ulong)st2.GetAddress1());

            Console.WriteLine($"ClrMd st2 size: {st2size}");

            // For reference types it will return size of the reference...
            var stsize = Unsafe.SizeOf <SomeType>();

            Console.WriteLine($"Unsafe st size: {stsize}");

            // Object Layout Inspector returns managed part of the object,
            // so we only need to add two pointer-sizes (header, MT)
            var stsize2 = InspectorHelper.GetSizeOfReferenceTypeInstance(typeof(SomeType));

            Console.WriteLine($"OLI st size: {stsize2}");

            var fields =
                typeof(SomeType).GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic);

            foreach (var field in fields)
            {
                Console.WriteLine(field.FieldType.IsClass);
            }
        }
Esempio n. 17
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            GUI.enabled = true;
            EditorGUI.showMixedValue = InspectorHelper.TargetsAreMixed <Block>(targets, (a, b) => a.Dimensions != b.Dimensions);
            var dimensions = EditorGUILayout.Vector3IntField("Dimentions", script.Dimensions);

            if (dimensions != script.Dimensions)
            {
                foreach (Block s in targets)
                {
                    s.Dimensions = dimensions;
                }
            }

            GUI.enabled = false;
            EditorGUI.showMixedValue = InspectorHelper.TargetsAreMixed <Block>(targets, (a, b) => a.Location.Grid != b.Location.Grid);
            EditorGUILayout.PropertyField(m_location.FindPropertyRelative("grid"), new GUIContent("Grid Reference"));
            EditorGUI.showMixedValue = InspectorHelper.TargetsAreMixed <Block>(targets, (a, b) => a.Location.GridVector != b.Location.GridVector);
            EditorGUILayout.PropertyField(m_location.FindPropertyRelative("vector"), new GUIContent("Grid Position"));

            GUI.enabled = Application.isEditor;
            var mass = Mass_UnityPropertyDrawer.LayoutFromValue(script.Mass, new GUIContent("Mass"),
                                                                InspectorHelper.TargetsAreMixed <Block>(targets, (a, b) => a.Mass.magnitude != b.Mass.magnitude),
                                                                InspectorHelper.TargetsAreMixed <Block>(targets, (a, b) => a.Mass.position != b.Mass.position));

            if (script.Mass != mass)
            {
                foreach (Block s in targets)
                {
                    InspectorHelper.SetBlockMass(s, mass);
                }
            }

            GUI.enabled = true;
            script.OnInspectorGUI(targets, serializedObject);

            serializedObject.ApplyModifiedProperties();
        }
    /**
     * Displays weapon controller properties
     * https://docs.unity3d.com/ScriptReference/EditorGUILayout.ObjectField.html
     */
    private void WeaponSection(PlayerSphereController instance)
    {
        EditorGUILayout.BeginVertical();

        instance.spherePrefab = EditorGUILayout.ObjectField("Shpere prefab", instance.spherePrefab,
                                                            typeof(GameObject), true) as GameObject;

        InspectorHelper.DisplayInfoMessage("This is the cooldown between two rotation direction inversion");
        instance.reverseDelay = EditorGUILayout.FloatField("Reverse delay", instance.reverseDelay);

        InspectorHelper.DisplayInfoMessage("This is the cooldown between two sphere addings");
        instance.sphereDelay       = EditorGUILayout.FloatField("Sphere delay", instance.sphereDelay);
        instance.radius            = EditorGUILayout.FloatField("Current radius", instance.radius);
        instance.minRadius         = EditorGUILayout.FloatField("Minimal radius", instance.minRadius);
        instance.maxRadius         = EditorGUILayout.FloatField("Maximal radius", instance.maxRadius);
        instance.radiusCrunchSpeed = EditorGUILayout.FloatField("Radius crunch speed", instance.radiusCrunchSpeed);
        instance.radiusGrowSpeed   = EditorGUILayout.FloatField("Radius grow speed", instance.radiusGrowSpeed);
        instance.rotationSpeed     = EditorGUILayout.FloatField("Base rotation speed", instance.rotationSpeed);
        instance.startSphereCount  = EditorGUILayout.IntField("Start sphere count", instance.startSphereCount);
        instance.speedPenalty      = EditorGUILayout.FloatField("Speed penalty (%)", instance.speedPenalty);

        EditorGUILayout.EndVertical();
    }
        public void PrivateBaseMembersShouldBeIncluded()
        {
            var offsets = InspectorHelper.GetFieldOffsets(typeof(Derived));

            Assert.That(offsets.Length, Is.EqualTo(2));
        }
 /**
  * Custom inspector for player redering properties
  * @param instance The instance of the target (PlayerController)
  */
 private void RenderingSection(PlayerController instance)
 {
     InspectorHelper.DisplayInfoMessage("No features yet. Coming soon.");
 }
Esempio n. 21
0
    private void createRigidBodyForceMoverBehaviorUI(MoverBehavior moverBehavior)
    {
        RigidBodyForceMoverBehavior rigidBodyForceMover = moverBehavior as RigidBodyForceMoverBehavior;

        if (rigidBodyForceMover != null)
        {
            EditorGUI.BeginChangeCheck();
            Vector3 forceMagnitude = EditorGUILayout.Vector3Field("Force Magnitude", rigidBodyForceMover.getForceMagnitude());
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(rigidBodyForceMover, "Force Magnitude");
                EditorUtility.SetDirty(rigidBodyForceMover);
                rigidBodyForceMover.setForceMagnitude(forceMagnitude);
            }

            EditorGUI.BeginChangeCheck();
            float duration = EditorGUILayout.DelayedFloatField("Duration", rigidBodyForceMover.getDuration());
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(rigidBodyForceMover, "Duration");
                EditorUtility.SetDirty(rigidBodyForceMover);
                rigidBodyForceMover.setDuration(duration);
            }

            EditorGUILayout.LabelField("RigidBody");
            EditorGUI.BeginChangeCheck();
            Rigidbody rigidBody = (Rigidbody)EditorGUILayout.ObjectField(rigidBodyForceMover.getRigidBody(), typeof(Rigidbody), true);
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(rigidBodyForceMover, "RigidBody");
                EditorUtility.SetDirty(rigidBodyForceMover);
                rigidBodyForceMover.setRigidBody(rigidBody);
            }

            EditorGUI.BeginChangeCheck();
            bool isAdditiveForce = EditorGUILayout.Toggle("Is Additive Force", rigidBodyForceMover.getIsAdditiveForce());
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(rigidBodyForceMover, "Is Additive Force");
                EditorUtility.SetDirty(rigidBodyForceMover);
                rigidBodyForceMover.setIsAdditiveForce(isAdditiveForce);
            }

            EditorGUILayout.LabelField("Surface Collision Checker Transform");
            EditorGUI.BeginChangeCheck();
            Transform surfaceCheckTransform = (Transform)EditorGUILayout.ObjectField(rigidBodyForceMover.getSurfaceCheckSourceTransform(), typeof(Transform), true);
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(rigidBodyForceMover, "Surface Collision Checker Transform");
                EditorUtility.SetDirty(rigidBodyForceMover);
                rigidBodyForceMover.setSurfaceCheckSourceTransform(surfaceCheckTransform);
            }

            if (surfaceCheckTransform)
            {
                EditorGUI.BeginChangeCheck();
                float surfaceCheckRadius = EditorGUILayout.DelayedFloatField("Checker Radius", rigidBodyForceMover.getSurfaceCheckRadius());
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(rigidBodyForceMover, "Checker Radius");
                    EditorUtility.SetDirty(rigidBodyForceMover);
                    rigidBodyForceMover.setSurfaceCheckRadius(surfaceCheckRadius);
                }

                LayerMask surfaceLayerMask = InspectorHelper.convert32BitLayerMaskToTrimmedMask(rigidBodyForceMover.getSurfaceLayerMask());
                EditorGUI.BeginChangeCheck();
                surfaceLayerMask = EditorGUILayout.MaskField("Surface Layer Mask", surfaceLayerMask, UnityEditorInternal.InternalEditorUtility.layers);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(rigidBodyForceMover, "Surface Layer Mask");
                    EditorUtility.SetDirty(rigidBodyForceMover);

                    rigidBodyForceMover.setSurfaceLayerMask(InspectorHelper.convertTrimmedLayerMaskTo32BitMask(surfaceLayerMask));
                }
            }
        }
    }
Esempio n. 22
0
 protected override void DrawStateInspectorEditor(SerializedObject m_Object, AIBehaviors stateMachine)
 {
     InspectorHelper.DrawInspector(m_Object);
     m_Object.ApplyModifiedProperties();
 }
Esempio n. 23
0
 protected virtual void DrawStateInspectorEditor(SerializedObject stateObject, AIBehaviors stateMachine)
 {
     InspectorHelper.DrawInspector(stateObject);
     stateObject.ApplyModifiedProperties();
 }
Esempio n. 24
0
 public virtual void DrawInspectorProperties(AIBehaviors fsm, SerializedObject triggerObject)
 {
     InspectorHelper.DrawInspector(triggerObject);
 }