コード例 #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
ファイル: NetworkRobot.cs プロジェクト: chargen/synthesis
        /// <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
ファイル: RobotBase.cs プロジェクト: chargen/synthesis
 /// <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);
 }