Files
GoakeFlax/Source/Game/PlayerActor.cs

52 lines
1.4 KiB
C#

using System.Collections.Generic;
using System.Linq;
using FlaxEngine;
using Cabrito;
#if FLAX_EDITOR
using FlaxEditor.CustomEditors.Dedicated;
using FlaxEditor.Scripting;
#endif
using FlaxEngine.GUI;
namespace Game
{
#if FLAX_EDITOR
[CustomEditor(typeof(PlayerActor))]
public class PlayerActorEditor : ActorEditor
{
protected override List<ItemInfo> GetItemsForType(ScriptType type)
{
List<ItemInfo> items = GetItemsForType(type, type.IsClass, true);
// Remove all Rigid Body options
items.RemoveAll(x => x.Display.Group == "Rigid Body");
// Inject scripts editor
var scriptsMember = type.GetProperty("Scripts");
if (scriptsMember != ScriptMemberInfo.Null)
{
var item = new ItemInfo(scriptsMember)
{
CustomEditor = new CustomEditorAttribute(typeof(ScriptsEditor))
};
items.Add(item);
}
return items;
}
}
#endif
public class PlayerActor : RigidBody
{
public PlayerActor()
{
// Default internal values for RigidBody
IsKinematic = true;
EnableGravity = false;
LinearDamping = 0f;
AngularDamping = 0f;
Constraints = RigidbodyConstraints.LockRotation;
}
}
}