Messing with stuff idk if i like

This commit is contained in:
2026-02-08 18:33:00 -05:00
parent d4c70c7f00
commit 67fca0c271
13 changed files with 109 additions and 83 deletions

View File

@@ -0,0 +1,7 @@
namespace Awperative;
internal abstract partial class DockerEntity
{
}

View File

@@ -0,0 +1,21 @@
using System.Collections.Generic;
using System.Linq;
namespace Awperative;
/// <summary>
/// Base class for all Awperative entities, manages components as a requirement because that is the job of all entities.
/// </summary>
internal abstract partial class DockerEntity
{
public Scene scene;
public List<Component> Components => _components.ToList();
internal HashSet<Component> _components;
}

View File

@@ -5,7 +5,7 @@ using System.Collections.Generic;
namespace Awperative; namespace Awperative;
public sealed partial class Scene public sealed partial class Scene : DockerEntity
{ {
public List<Behavior> behaviors { get; private set; } = []; public List<Behavior> behaviors { get; private set; } = [];

View File

@@ -5,7 +5,7 @@ using System.Collections.Generic;
namespace Awperative; namespace Awperative;
public sealed partial class Scene public sealed partial class Scene : DockerEntity
{ {
public List<Body> bodies { get; private set; } = []; public List<Body> bodies { get; private set; } = [];

View File

@@ -2,7 +2,7 @@
namespace Awperative; namespace Awperative;
public sealed partial class Scene public sealed partial class Scene : DockerEntity
{ {

View File

@@ -4,7 +4,7 @@ using System;
namespace Awperative; namespace Awperative;
public sealed partial class Scene public sealed partial class Scene : DockerEntity
{ {
public event EventHandler<BehaviorCreateEvent> BehaviorCreatedEvent; public event EventHandler<BehaviorCreateEvent> BehaviorCreatedEvent;
public event EventHandler<BehaviorDestroyEvent> BehaviorDestroyedEvent; public event EventHandler<BehaviorDestroyEvent> BehaviorDestroyedEvent;

View File

@@ -4,7 +4,7 @@ using Microsoft.Xna.Framework;
namespace Awperative; namespace Awperative;
public sealed partial class Scene public sealed partial class Scene : DockerEntity
{ {
public void Unload() { public void Unload() {

View File

@@ -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<Generic>() where Generic : Behavior => scene.AddBehavior<Generic>();
protected Generic AddBehavior<Generic>(object[] __args) where Generic : Behavior => scene.AddBehavior<Generic>(__args);
protected Generic GetBehavior<Generic>() where Generic : Behavior => scene.GetBehavior<Generic>();
protected Generic[] GetBehaviors<Generic>() where Generic : Behavior => scene.GetBehaviors<Generic>();
protected void RemoveBehavior<Generic>() where Generic : Behavior => scene.RemoveBehavior<Generic>();
//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();
}
}

View File

@@ -0,0 +1,7 @@
namespace Awperative;
public class BodyComponent : Component
{
}

View File

@@ -0,0 +1,47 @@
using Microsoft.Xna.Framework;
namespace Awperative;
/// <summary>
/// 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
/// </summary>
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() {}
}

View File

@@ -5,6 +5,11 @@ namespace Awperative;
public abstract class Component public abstract class Component
{ {
public Scene scene; public Scene scene;
public Body body; public Body body;
@@ -51,20 +56,6 @@ public abstract class Component
public void RemoveComponent<Generic>() where Generic : Component => body.RemoveComponent<Generic>(); public void RemoveComponent<Generic>() where Generic : Component => body.RemoveComponent<Generic>();
//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 //creation logic
internal void Initiate(Body __body) internal void Initiate(Body __body)

View File

@@ -0,0 +1,10 @@
namespace Awperative;
public class hello : BodyComponent
{
public void Start() {
this.ExtensionTest();
}
}

View File

@@ -0,0 +1,7 @@
namespace Awperative;
public class SceneComponent : Component
{
}