Пример #1
0
        private void ExecuteOutput(Shared.Out.Commands commands)
        {
            if (Output == null)
            {
                return;
            }

            textOutput.AppendLine(commands.Error);
            var text = textOutput.ToString();

            textOutput.Clear();
            Output.text = text;
        }
Пример #2
0
        private void ExecuteCommandLimbs(Shared.Out.Commands commands)
        {
            var limbs         = commands.Limbs;
            var maxMotorSpeed = Mathf.Abs(TopMotorSpeed);
            var minMotorSpeed = -maxMotorSpeed;

            void UpdateHinges(Shared.Out.Limb limb, ref HingeJoint2D hinge)
            {
                var motor = hinge.motor;
                var speed = Mathf.Min(maxMotorSpeed, Mathf.Max(minMotorSpeed, limb.MotorSpeed));

                motor.motorSpeed = Mirrored ? -speed : speed;
                hinge.motor      = motor;

                hinge.useMotor = limb.MotorEnabled;
            }

            UpdateHinges(limbs.Away, ref RobotActor.awayLimb);
            UpdateHinges(limbs.Facing, ref RobotActor.facingLimb);
            UpdateHinges(limbs.OuterAway, ref RobotActor.outerAwayLimb);
            UpdateHinges(limbs.OuterFacing, ref RobotActor.outerFacingLimb);
        }
Пример #3
0
 private void ExecuteCommands(Shared.Out.Commands commands)
 {
     ExecuteOutput(commands);
     ExecuteCommandLimbs(commands);
 }