コード例 #1
0
        protected override void AdjustMotion(IMoveable movingObject, InterpolatedVector motion)
        {
            var speed = motion.Current;

            speed = speed.SetDegrees(AngleInDegrees).SetLength(DistancePerSecond);

            motion.X.Current = speed.X;
            motion.Y.Current = speed.Y;
        }
コード例 #2
0
ファイル: AxisMotion.cs プロジェクト: mp1011/Simple2DGame
        protected override void AdjustMotion(IMoveable movingObject, InterpolatedVector motion)
        {
            if (!setStart)
            {
                setStart = true;
                motion.GetAxis(Config.Axis).Current = Config.GetStartSpeed(movingObject);
            }

            motion.GetAxis(Config.Axis).SetTarget(Config.GetTargetSpeed(movingObject), Config.Change.Value);
        }
コード例 #3
0
 protected override void AdjustMotion(IMoveable movingObject, InterpolatedVector motion)
 {
     if (!Motion.Active)
     {
         Brake.Update(movingObject, motion);
     }
     else
     {
         Motion.Update(movingObject, motion);
     }
 }
コード例 #4
0
        public void Update(IMoveable movingObject, InterpolatedVector motion)
        {
            if (Condition.IsActiveAndNotNull())
            {
                if (!wasActive)
                {
                    OnActivated();
                }

                wasActive = true;
                AdjustMotion(movingObject, motion);
            }
            else
            {
                wasActive = false;
            }
        }
コード例 #5
0
        public InterpolatedVector Apply(InterpolatedVector v)
        {
            if (Condition.IsActive)
            {
                var ret = new InterpolatedVector();
                ret.X.Current = v.X.Current;
                ret.X.SetTarget(v.X.Target * TargetMod.Value, v.X.ChangePerSecond * DeltaMod.Value);

                ret.Y.Current = v.Y.Current;
                ret.Y.SetTarget(v.Y.Target * TargetMod.Value, v.Y.ChangePerSecond * DeltaMod.Value);

                return(ret);
            }
            else
            {
                return(v);
            }
        }
コード例 #6
0
 protected override void AdjustMotion(IMoveable movingObject, InterpolatedVector motion)
 {
     motion.X.Current = Config.MotionPerSecond.X;
     motion.Y.Current = Config.MotionPerSecond.Y;
 }
コード例 #7
0
 protected abstract void AdjustMotion(IMoveable movingObject, InterpolatedVector motion);