/
EugenyCh7
/
Puppet2D.Net
Обзор
Документация
Войти
/
EugenyCh7
/
Puppet2D.Net
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Puppet2D.Engine/Components/Component.cs
65 строк
2 KB
EugenyCh7
UpdateComponent(float milliseconds)
25 авг 2025, 21:13
25 авг 2025, 21:13
3101026
Код
Авторство
О чём код?
using Puppet2D.Engine.Common; using Puppet2D.Engine.Components.RigidBodies; using Puppet2D.Engine.GameWindows; using Puppet2D.Engine.Worlds; using System; using System.Collections.Generic; namespace Puppet2D.Engine.Components { public abstract class Component : GameResource, ICloneable<Component> { public GameObject GameObject { get; internal set; } public World World => GameObject?.World; public GameWindow Window => GameObject?.Window; public Transformation Transformation => GameObject?.Transformation; public RigidBody RigidBody => GameObject?.RigidBody; public ObjectBehavior ObjectBehavior => GameObject?.ObjectBehavior; public T GetComponent<T>() where T : Component { return GameObject.GetComponent<T>(); } public T GetComponentOrThrow<T>() where T : Component { return GameObject.GetComponentOrThrow<T>(); } public IEnumerable<T> GetComponents<T>() where T : Component { return GameObject.GetComponents<T>(); } internal override void Create() { base.Create(); State = ObjectState.Created; } internal override void Destroy() { base.Destroy(); State = ObjectState.Destroyed; } protected virtual void Update(float milliseconds) { } internal void UpdateComponent(float milliseconds) { Update(milliseconds); } public abstract Component Clone(); object ICloneable.Clone() { return Clone(); } } }