using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
namespace Awperative;
public sealed partial class Body : DockerEntity
{
///
/// Current scene the body exists in
///
public Scene Scene { get; internal set; }
///
/// All components attached to the body
///
public List Components => _components.ToList();
internal HashSet _components { get; private set; } = [];
///
/// All tags attached to the body
///
public List Tags => _tags.ToList();
internal HashSet _tags { get; private set; }= [];
///
/// Position of the body
///
public Transform transform { get; internal set; } = new();
//Prevents outside construction
internal Body() {}
///
/// Creates a body in the given scene
///
///
internal Body(Scene __scene) {
Scene = __scene;
}
///
/// Creates a body with a scene and transform
///
///
///
internal Body(Scene __scene, Transform __transform) {
Scene = __scene;
transform = __transform;
}
internal void Unload() { foreach (Component component in _components) component.Unload(); }
internal void Load() { foreach (Component component in _components) { component.Load(); } }
internal void Update(GameTime __gameTime) { foreach (Component component in _components) { component.Update(__gameTime); } }
internal void Draw(GameTime __gameTime) { foreach (Component component in _components) { component.Draw(__gameTime); } }
internal void Destroy() { foreach(Component component in _components) component.Destroy(); }
internal void Create() { foreach (Component component in _components) component.Create(); }
}