2023-03-12 20:45:18 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace DCFApixels.DragonECS
|
|
|
|
|
{
|
|
|
|
|
public class VelocitySystem : IEcsInject<EcsWorldMap>, IEcsRunSystem
|
|
|
|
|
{
|
|
|
|
|
private EcsWorld<DefaultWorld> _world;
|
|
|
|
|
public void Inject(EcsWorldMap obj) { _world = obj.Get<DefaultWorld>(); }
|
|
|
|
|
|
|
|
|
|
public void Run(EcsSession session)
|
|
|
|
|
{
|
2023-03-13 04:32:24 +08:00
|
|
|
|
var x = _world.GetFilter<Inc<TransfromCom, Velocity>>();
|
2023-03-12 20:45:18 +08:00
|
|
|
|
foreach (var item in _world.GetFilter<Inc<TransfromCom, Velocity>>().Entities)
|
|
|
|
|
{
|
|
|
|
|
item.Write<TransfromCom>().position += item.Read<Velocity>().value * Time.deltaTime;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|