Base Update() method was removed from components in engine, added some basic ECS systems to update the components. (#79)
This commit is contained in:
committed by
Pieter-Jan Briers
parent
18ed1041ba
commit
8c874c76dc
22
Content.Server/GameObjects/EntitySystems/DoorSystem.cs
Normal file
22
Content.Server/GameObjects/EntitySystems/DoorSystem.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using SS14.Shared.GameObjects;
|
||||
using SS14.Shared.GameObjects.System;
|
||||
|
||||
namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
class DoorSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
EntityQuery = new TypeEntityQuery(typeof(ServerDoorComponent));
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
foreach (var entity in RelevantEntities)
|
||||
{
|
||||
var comp = entity.GetComponent<ServerDoorComponent>();
|
||||
comp.OnUpdate(frameTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
Content.Server/GameObjects/EntitySystems/PowerApcSystem.cs
Normal file
23
Content.Server/GameObjects/EntitySystems/PowerApcSystem.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Content.Server.GameObjects.Components.Power;
|
||||
using SS14.Shared.GameObjects;
|
||||
using SS14.Shared.GameObjects.System;
|
||||
|
||||
namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
class PowerApcSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
EntityQuery = new TypeEntityQuery(typeof(ApcComponent));
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
foreach (var entity in RelevantEntities)
|
||||
{
|
||||
var comp = entity.GetComponent<ApcComponent>();
|
||||
comp.OnUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
Content.Server/GameObjects/EntitySystems/PowerSmesSystem.cs
Normal file
23
Content.Server/GameObjects/EntitySystems/PowerSmesSystem.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Content.Server.GameObjects.Components.Power;
|
||||
using SS14.Shared.GameObjects;
|
||||
using SS14.Shared.GameObjects.System;
|
||||
|
||||
namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
internal class PowerSmesSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
EntityQuery = new TypeEntityQuery(typeof(SmesComponent));
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
foreach (var entity in RelevantEntities)
|
||||
{
|
||||
var comp = entity.GetComponent<SmesComponent>();
|
||||
comp.OnUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,8 @@
|
||||
using SS14.Shared.GameObjects.System;
|
||||
using SS14.Shared.Interfaces.GameObjects;
|
||||
using SS14.Shared.IoC;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SS14.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.GameObjects.EntitySystems
|
||||
{
|
||||
@@ -18,6 +15,11 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
|
||||
private int _lastUid = 0;
|
||||
|
||||
public PowerSystem()
|
||||
{
|
||||
EntityQuery = new TypeEntityQuery(typeof(PowerDeviceComponent));
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -61,8 +63,9 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
}
|
||||
|
||||
// Draw power for devices not connected to anything.
|
||||
foreach (var device in componentManager.GetComponents<PowerDeviceComponent>())
|
||||
foreach (var entity in EntityManager.GetEntities(EntityQuery))
|
||||
{
|
||||
var device = entity.GetComponent<PowerDeviceComponent>();
|
||||
device.ProcessInternalPower(frametime);
|
||||
}
|
||||
}
|
||||
|
||||
23
Content.Server/GameObjects/EntitySystems/WelderSystem.cs
Normal file
23
Content.Server/GameObjects/EntitySystems/WelderSystem.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Content.Server.GameObjects.Components.Interactable.Tools;
|
||||
using SS14.Shared.GameObjects;
|
||||
using SS14.Shared.GameObjects.System;
|
||||
|
||||
namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
class WelderSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
EntityQuery = new TypeEntityQuery(typeof(WelderComponent));
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
foreach (var entity in RelevantEntities)
|
||||
{
|
||||
var comp = entity.GetComponent<WelderComponent>();
|
||||
comp.OnUpdate(frameTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user