Ejemplo n.º 1
0
 private void SetCurrentSpeed(WaypointInstruction instruction)
 {
     switch (instruction.Instruction)
     {
         case Instructions.None:
             this.CurrentSpeed = this.CurrentSpeed;
             break;
             
         case Instructions.SetSpeed:
             this.CurrentSpeed = instruction.Value;
             break;
             
         case Instructions.SpeedUpPercent:
             var speedUpValue = (this.CurrentSpeed*instruction.Value)/100;
             var speedAfterUp = this.CurrentSpeed + speedUpValue;
             this.CurrentSpeed = speedAfterUp <= this.MaxSpeed ? speedAfterUp : this.CurrentSpeed;
             break;
             
         case Instructions.SlowDownPercent:
             var slowDownValue = (this.CurrentSpeed * instruction.Value) / 100;
             var speedAfterDown = this.CurrentSpeed - slowDownValue;
             this.CurrentSpeed = speedAfterDown;
             break;
     }
 }
Ejemplo n.º 2
0
        public Waypoint(Position pos, WaypointInstruction instr)
        {
            pos.AssertNotNull();
            instr.AssertNotNull();

            _position = pos;
            _instruction = instr;
        }