コード例 #1
0
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     this.wheelBase     = base.part.FindModuleImplementing <ModuleWheelBase>();
     this.wheelSteering = base.part.FindModuleImplementing <ModuleWheelSteering>();
     this.wheelBrakes   = base.part.FindModuleImplementing <ModuleWheelBrakes>();
     this.wheelMotor    = base.part.FindModuleImplementing <ModuleWheelMotor>();
 }
コード例 #2
0
        //Trying to use animation to shorten/widen the wheelbase looks really wonky, so we'll do this in code by moving the transforms.
        //Sadly this doesn't work to well when we have stuff piled onto the chassis. I think this is basically the right approach but
        //shelved for now.
        private void setWheelbase()
        {
            if (!toggledAtLeastOnce)
            {
                return;
            }

            ModuleWheelBase wheelBase = this.part.FindModuleImplementing <ModuleWheelBase>();

            if (isNarrowWheelbase)
            {
                wheelBase.wheelColliderHost.Translate(0.185f, 0f, 0f);
                wheelPylon.Translate(0.185f, 0f, 0f);
            }
            else
            {
                wheelBase.wheelColliderHost.Translate(-0.185f, 0f, 0f);
                wheelPylon.Translate(-0.185f, 0f, 0f);
            }

            ModuleWheelSteering steering = this.part.FindModuleImplementing <ModuleWheelSteering>();
        }