コード例 #1
0
    private void parse392(string message)
    {
        string[] values = message.Split('.');
        int      length = values.Length;

        if (length > 1)
        {
            boomAngle[0] = Convert.ToInt32(values[0]);
            boomAngle[1] = Convert.ToInt32(values[1]);
            ExcavatorData392.Instance.setBoom(convertBoom(boomAngle[0], boomAngle[1]));
        }
        if (length > 3)
        {
            armAngle[0] = Convert.ToInt32(values[2]);
            armAngle[1] = Convert.ToInt32(values[3]);
            ExcavatorData392.Instance.setArm(convertArm(armAngle[0], armAngle[1]));
        }
        if (length > 5)
        {
            bucketAngle[0] = Convert.ToInt32(values[4]);
            bucketAngle[1] = Convert.ToInt32(values[5]);

            ExcavatorData392.Instance.setBucket(convertBucket(bucketAngle[0], bucketAngle[1]));
        }

        ExcavatorController.UpdateAngleData(ExcavatorData392.Instance.getBoom(), ExcavatorData392.Instance.getArm(), ExcavatorData392.Instance.getBucket());
    }
コード例 #2
0
 // Use this for initialization
 void Start()
 {
     exController     = new ExcavatorController();
     ArmAHinge        = ArmA.GetComponent <HingeJoint>();
     ArmBHinge        = ArmB.GetComponent <HingeJoint>();
     BucketHinge      = BucketMain.GetComponent <HingeJoint>();
     Base1Hinge       = Base1.GetComponent <HingeJoint>();
     rotateArmA       = 0f;
     rotateArmB       = 0f;
     rotateBucketMain = 0f;
     rotateBase1      = 0f;
     rotationSpeed    = 0.5f;
     driveMode        = false;
 }