custom player actor, dont save map data in scene

This commit is contained in:
2022-03-24 22:26:12 +02:00
parent 719dd40808
commit 31b380f718
4 changed files with 199 additions and 151 deletions

View 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;
}
}
}