예제 #1
0
        /// <summary>
        /// Updates pwm information and sends robot information to the server.
        /// </summary>
        private void FixedUpdate()
        {
            base.UpdatePhysics();

            BRigidBody rigidBody = GetComponentInChildren <BRigidBody>();

            if (rigidBody == null)
            {
                return;
            }

            if (isLocalPlayer)
            {
                float[] pwm = DriveJoints.GetPwmValues(Packet == null ? emptyDIO : Packet.dio, ControlIndex, false);

                if (isServer)
                {
                    RpcUpdateRobotInfo(pwm);
                }
                else
                {
                    CmdUpdateRobotInfo(pwm);
                }

                if (InputControl.GetButton(Controls.buttons[ControlIndex].resetRobot))
                {
                    CmdResetRobot();
                }
            }

            if (isServer && serverCanSendUpdate)
            {
                RemoteUpdateTransforms();
            }
        }
예제 #2
0
        /// <summary>
        /// Updates pwm information and sends robot information to the server.
        /// </summary>
        private void FixedUpdate()
        {
            base.UpdatePhysics();

            BRigidBody rigidBody = GetComponentInChildren <BRigidBody>();

            if (rigidBody == null)
            {
                return;
            }

            if (isLocalPlayer)
            {
                float[] pwm = DriveJoints.GetPwmValues(Packet == null ? emptyDIO : Packet.dio, ControlIndex, false);

                if (correctionEnabled)
                {
                    if (isServer)
                    {
                        RpcUpdateRobotInfo(pwm);
                    }
                    else
                    {
                        CmdUpdateRobotInfo(pwm);
                    }
                }
            }

            if (isServer && serverCanSendUpdate && correctionEnabled)
            {
                RemoteUpdateTransforms();
            }
        }
예제 #3
0
 /// <summary>
 /// Updates all motors on the robot.
 /// </summary>
 protected virtual void UpdateMotors(float[] pwm = null)
 {
     DriveJoints.UpdateAllMotors(RootNode, pwm ?? DriveJoints.GetPwmValues(Packet == null ? emptyDIO : Packet.dio, ControlIndex, IsMecanum()), emuList);
 }