SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class MoveSystem : ISystem, IUpdatable
  2. {
  3.  
  4.     void ISystem.Update(GameState State) {
  5.  
  6.         State.Components.FilterBy<Moving>().ForEach((i)=> {
  7.            
  8.             i.Entity.Components.FindAll(c => c is Velocity).ForEach((velc) =>
  9.             {
  10.                 var speed = (i as Moving).Speed * TimeService.DeltaTime;
  11.                 var vec = (velc as Velocity).Vector;
  12.                 TransformService.AddPosition(i.Entity, vec.X * speed, vec.Y * speed, vec.Z * speed);
  13.                 var animation = i.Entity.Components.Find(c => c is AnimationState) as AnimationState;
  14.                 if (animation != null && animation.Name<AnimationState.EName.Run)
  15.                 {
  16.                     animation.SetState(AnimationState.EName.Run);
  17.                 }
  18.             });
  19.         });
  20.     }
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top