Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MoveSystem : ISystem, IUpdatable
- {
- void ISystem.Update(GameState State) {
- State.Components.FilterBy<Moving>().ForEach((i)=> {
- i.Entity.Components.FindAll(c => c is Velocity).ForEach((velc) =>
- {
- var speed = (i as Moving).Speed * TimeService.DeltaTime;
- var vec = (velc as Velocity).Vector;
- TransformService.AddPosition(i.Entity, vec.X * speed, vec.Y * speed, vec.Z * speed);
- var animation = i.Entity.Components.Find(c => c is AnimationState) as AnimationState;
- if (animation != null && animation.Name<AnimationState.EName.Run)
- {
- animation.SetState(AnimationState.EName.Run);
- }
- });
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement