custom player actor, dont save map data in scene
This commit is contained in:
53
Source/Game/PlayerActor.cs
Normal file
53
Source/Game/PlayerActor.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FlaxEngine;
|
||||
using Cabrito;
|
||||
using FlaxEditor.CustomEditors;
|
||||
using FlaxEditor.CustomEditors.Dedicated;
|
||||
using FlaxEditor.CustomEditors.Editors;
|
||||
using FlaxEditor.CustomEditors.Elements;
|
||||
using FlaxEditor.Scripting;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user