From 67fca0c271ce945c612999f54223bca0718349dc Mon Sep 17 00:00:00 2001 From: avery Date: Sun, 8 Feb 2026 18:33:00 -0500 Subject: [PATCH] Messing with stuff idk if i like --- .../Kernel/Entities/Entity/Components.cs | 7 ++ .../Kernel/Entities/Entity/DockerEntity.cs | 21 ++++++ .../Kernel/Entities/Scenes/Behaviors.cs | 2 +- Awperative/Kernel/Entities/Scenes/Bodies.cs | 2 +- Awperative/Kernel/Entities/Scenes/Core.cs | 2 +- Awperative/Kernel/Entities/Scenes/Events.cs | 2 +- Awperative/Kernel/Entities/Scenes/Time.cs | 2 +- .../Kernel/Scripting/Behaviors/Behavior.cs | 64 ------------------- Awperative/Kernel/Scripting/BodyComponent.cs | 7 ++ .../Kernel/Scripting/Component/Component.cs | 47 ++++++++++++++ .../Component.cs => Component/NewFile1.txt} | 19 ++---- .../Kernel/Scripting/Component/hello.cs | 10 +++ Awperative/Kernel/Scripting/SceneComponent.cs | 7 ++ 13 files changed, 109 insertions(+), 83 deletions(-) create mode 100644 Awperative/Kernel/Entities/Entity/Components.cs create mode 100644 Awperative/Kernel/Entities/Entity/DockerEntity.cs delete mode 100644 Awperative/Kernel/Scripting/Behaviors/Behavior.cs create mode 100644 Awperative/Kernel/Scripting/BodyComponent.cs create mode 100644 Awperative/Kernel/Scripting/Component/Component.cs rename Awperative/Kernel/Scripting/{Components/Component.cs => Component/NewFile1.txt} (85%) create mode 100644 Awperative/Kernel/Scripting/Component/hello.cs create mode 100644 Awperative/Kernel/Scripting/SceneComponent.cs diff --git a/Awperative/Kernel/Entities/Entity/Components.cs b/Awperative/Kernel/Entities/Entity/Components.cs new file mode 100644 index 0000000..28f2791 --- /dev/null +++ b/Awperative/Kernel/Entities/Entity/Components.cs @@ -0,0 +1,7 @@ +namespace Awperative; + + +internal abstract partial class DockerEntity +{ + +} \ No newline at end of file diff --git a/Awperative/Kernel/Entities/Entity/DockerEntity.cs b/Awperative/Kernel/Entities/Entity/DockerEntity.cs new file mode 100644 index 0000000..df5bfe0 --- /dev/null +++ b/Awperative/Kernel/Entities/Entity/DockerEntity.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using System.Linq; + + +namespace Awperative; + + +/// +/// Base class for all Awperative entities, manages components as a requirement because that is the job of all entities. +/// +internal abstract partial class DockerEntity +{ + public Scene scene; + + public List Components => _components.ToList(); + + + + + internal HashSet _components; +} \ No newline at end of file diff --git a/Awperative/Kernel/Entities/Scenes/Behaviors.cs b/Awperative/Kernel/Entities/Scenes/Behaviors.cs index 783b084..eeb90be 100644 --- a/Awperative/Kernel/Entities/Scenes/Behaviors.cs +++ b/Awperative/Kernel/Entities/Scenes/Behaviors.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; namespace Awperative; -public sealed partial class Scene +public sealed partial class Scene : DockerEntity { public List behaviors { get; private set; } = []; diff --git a/Awperative/Kernel/Entities/Scenes/Bodies.cs b/Awperative/Kernel/Entities/Scenes/Bodies.cs index 5f653e7..20ece63 100644 --- a/Awperative/Kernel/Entities/Scenes/Bodies.cs +++ b/Awperative/Kernel/Entities/Scenes/Bodies.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; namespace Awperative; -public sealed partial class Scene +public sealed partial class Scene : DockerEntity { public List bodies { get; private set; } = []; diff --git a/Awperative/Kernel/Entities/Scenes/Core.cs b/Awperative/Kernel/Entities/Scenes/Core.cs index 0559e78..bd33b0a 100644 --- a/Awperative/Kernel/Entities/Scenes/Core.cs +++ b/Awperative/Kernel/Entities/Scenes/Core.cs @@ -2,7 +2,7 @@ namespace Awperative; -public sealed partial class Scene +public sealed partial class Scene : DockerEntity { diff --git a/Awperative/Kernel/Entities/Scenes/Events.cs b/Awperative/Kernel/Entities/Scenes/Events.cs index aacb9f6..10a6762 100644 --- a/Awperative/Kernel/Entities/Scenes/Events.cs +++ b/Awperative/Kernel/Entities/Scenes/Events.cs @@ -4,7 +4,7 @@ using System; namespace Awperative; -public sealed partial class Scene +public sealed partial class Scene : DockerEntity { public event EventHandler BehaviorCreatedEvent; public event EventHandler BehaviorDestroyedEvent; diff --git a/Awperative/Kernel/Entities/Scenes/Time.cs b/Awperative/Kernel/Entities/Scenes/Time.cs index 0b5bd81..8a9102a 100644 --- a/Awperative/Kernel/Entities/Scenes/Time.cs +++ b/Awperative/Kernel/Entities/Scenes/Time.cs @@ -4,7 +4,7 @@ using Microsoft.Xna.Framework; namespace Awperative; -public sealed partial class Scene +public sealed partial class Scene : DockerEntity { public void Unload() { diff --git a/Awperative/Kernel/Scripting/Behaviors/Behavior.cs b/Awperative/Kernel/Scripting/Behaviors/Behavior.cs deleted file mode 100644 index 55d076e..0000000 --- a/Awperative/Kernel/Scripting/Behaviors/Behavior.cs +++ /dev/null @@ -1,64 +0,0 @@ - - -using Microsoft.Xna.Framework; - - -namespace Awperative; - -public abstract class Behavior -{ - public Scene scene; - - public bool Enabled = false; - public bool EnforceSingleton = false; - - public int Priority = 0; - - - //scene relay - protected Body AddBody() => scene.AddBody(); - protected Body AddBody(Transform __transform) => scene.AddBody(__transform); - - protected Body GetBody(string __tag) => scene.GetBody(__tag); - protected Body[] GetBodies(string __tag) => scene.GetBodies(__tag); - - protected void DestroyBody(Body __body) => scene.DestroyBody(__body); - - - - protected Generic AddBehavior() where Generic : Behavior => scene.AddBehavior(); - protected Generic AddBehavior(object[] __args) where Generic : Behavior => scene.AddBehavior(__args); - - protected Generic GetBehavior() where Generic : Behavior => scene.GetBehavior(); - protected Generic[] GetBehaviors() where Generic : Behavior => scene.GetBehaviors(); - - protected void RemoveBehavior() where Generic : Behavior => scene.RemoveBehavior(); - - - - //GAME HAS JUST BEGUN/ended - public virtual void Unload() {} - - //WE ARE LOADING STUFF - public virtual void Load() {} - - //You know what these do - public virtual void Update(GameTime __gameTime) {} - public virtual void Draw(GameTime __gameTime) {} - - //component/body/scene is being created or destroyed - public virtual void Create() {} - public virtual void Destroy() {} - - //New behavior functionality - internal void Initiate(Scene __scene) { - scene = __scene; - Create(); - } - - //destroy behavior functionality - internal void End() - { - Destroy(); - } -} \ No newline at end of file diff --git a/Awperative/Kernel/Scripting/BodyComponent.cs b/Awperative/Kernel/Scripting/BodyComponent.cs new file mode 100644 index 0000000..8d813c6 --- /dev/null +++ b/Awperative/Kernel/Scripting/BodyComponent.cs @@ -0,0 +1,7 @@ +namespace Awperative; + + +public class BodyComponent : Component +{ + +} \ No newline at end of file diff --git a/Awperative/Kernel/Scripting/Component/Component.cs b/Awperative/Kernel/Scripting/Component/Component.cs new file mode 100644 index 0000000..b64b236 --- /dev/null +++ b/Awperative/Kernel/Scripting/Component/Component.cs @@ -0,0 +1,47 @@ +using Microsoft.Xna.Framework; + + +namespace Awperative; + + + +/// +/// The lowest level scripting class in Awperative. Components are scene level and provide access to all scene level methods, can be applied to any docker and inherited +/// +public abstract class Component +{ + internal DockerEntity Parent; + + + + + + internal void Initiate(DockerEntity __parent) { + Parent = __parent; + Create(); + } + + + + internal void End() { + Destroy(); + } + + + + + + //GAME HAS JUST BEGUN/ended + public virtual void Unload() {} + + //WE ARE LOADING STUFF + public virtual void Load() {} + + //You know what these do + public virtual void Update(GameTime __gameTime) {} + public virtual void Draw(GameTime __gameTime) {} + + //component/body/scene is being created or destroyed + public virtual void Create() {} + public virtual void Destroy() {} +} \ No newline at end of file diff --git a/Awperative/Kernel/Scripting/Components/Component.cs b/Awperative/Kernel/Scripting/Component/NewFile1.txt similarity index 85% rename from Awperative/Kernel/Scripting/Components/Component.cs rename to Awperative/Kernel/Scripting/Component/NewFile1.txt index 7e461f7..93a106f 100644 --- a/Awperative/Kernel/Scripting/Components/Component.cs +++ b/Awperative/Kernel/Scripting/Component/NewFile1.txt @@ -5,6 +5,11 @@ namespace Awperative; public abstract class Component { + + + + + public Scene scene; public Body body; @@ -51,20 +56,6 @@ public abstract class Component public void RemoveComponent() where Generic : Component => body.RemoveComponent(); - - //GAME HAS JUST BEGUN/ended - public virtual void Unload() {} - - //WE ARE LOADING STUFF - public virtual void Load() {} - - //You know what these do - public virtual void Update(GameTime __gameTime) {} - public virtual void Draw(GameTime __gameTime) {} - - //component/body/scene is being created or destroyed - public virtual void Create() {} - public virtual void Destroy() {} //creation logic internal void Initiate(Body __body) diff --git a/Awperative/Kernel/Scripting/Component/hello.cs b/Awperative/Kernel/Scripting/Component/hello.cs new file mode 100644 index 0000000..5499214 --- /dev/null +++ b/Awperative/Kernel/Scripting/Component/hello.cs @@ -0,0 +1,10 @@ +namespace Awperative; + + +public class hello : BodyComponent +{ + public void Start() { + + this.ExtensionTest(); + } +} \ No newline at end of file diff --git a/Awperative/Kernel/Scripting/SceneComponent.cs b/Awperative/Kernel/Scripting/SceneComponent.cs new file mode 100644 index 0000000..413e75e --- /dev/null +++ b/Awperative/Kernel/Scripting/SceneComponent.cs @@ -0,0 +1,7 @@ +namespace Awperative; + + +public class SceneComponent : Component +{ + +} \ No newline at end of file