NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Class FuelModuleWrapper

    MonoBehaviour wrapper for the Fuel module.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    ModuleWrapper
    FuelModuleWrapper
    Namespace: NWH.VehiclePhysics2.Modules.Fuel
    Assembly: NWH.VehiclePhysics2.dll
    Syntax
    [Serializable]
    [DisallowMultipleComponent]
    public class FuelModuleWrapper : ModuleWrapper
    Remarks

    Required component wrapper that allows the FuelModule to be attached to a GameObject with a VehicleController. The wrapper handles Unity's MonoBehaviour lifecycle and serialization while delegating the actual fuel simulation logic to the contained module.

    Add this component to a vehicle GameObject through: - Unity Editor: Add Component > NWH > Vehicle Physics 2 > Modules > Fuel Module - Script: gameObject.AddComponent<FuelModuleWrapper>()

    The module can be accessed at runtime through the module field for dynamic fuel management, refueling operations, or consumption monitoring.

    Fields

    module

    The FuelModule instance managed by this wrapper.

    Declaration
    public FuelModule module
    Field Value
    Type Description
    FuelModule
    Remarks

    Access this field to manage fuel levels, monitor consumption, or adjust efficiency settings at runtime. All module settings are serialized and can be adjusted in the Unity Inspector.

    Methods

    GetModule()

    Returns the contained FuelModule as a VehicleComponent.

    Declaration
    public override VehicleComponent GetModule()
    Returns
    Type Description
    VehicleComponent

    The FuelModule instance cast to VehicleComponent.

    Overrides
    ModuleWrapper.GetModule()

    SetModule(VehicleComponent)

    Sets the contained module from a VehicleComponent reference.

    Declaration
    public override void SetModule(VehicleComponent module)
    Parameters
    Type Name Description
    VehicleComponent module

    The VehicleComponent to set, must be a FuelModule instance.

    Overrides
    ModuleWrapper.SetModule(VehicleComponent)
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics