新增动态水物理插件

This commit is contained in:
Bob.Song
2026-02-27 17:44:21 +08:00
parent a6e061d9ce
commit 60744d113d
2218 changed files with 698551 additions and 189 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c980ccbb2a3afc841bf8b9b14df8618d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7824d7ed02bce1e479ff9e05523a3243
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,304 @@
- serializedVersion: 3
m_Name: Steering
descriptiveName:
descriptiveNegativeName:
negativeButton: a
positiveButton: d
altNegativeButton:
altPositiveButton: joystick button 1
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Throttle
descriptiveName:
descriptiveNegativeName:
negativeButton: s
positiveButton: w
altNegativeButton:
altPositiveButton: joystick button 1
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: EngineStartStop
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: r
altNegativeButton:
altPositiveButton: joystick button 1
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Anchor
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: t
altNegativeButton:
altPositiveButton: joystick button 1
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: SubmarineDepth
descriptiveName:
descriptiveNegativeName:
negativeButton: k
positiveButton: i
altNegativeButton:
altPositiveButton: joystick button 1
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: SternThruster
descriptiveName:
descriptiveNegativeName:
negativeButton: z
positiveButton: c
altNegativeButton:
altPositiveButton: joystick button 1
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: BowThruster
descriptiveName:
descriptiveNegativeName:
negativeButton: q
positiveButton: e
altNegativeButton:
altPositiveButton: joystick button 1
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: ChangeCamera
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: c
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: CameraRotationX
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: CameraRotationY
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 1
joyNum: 0
- serializedVersion: 3
m_Name: CameraPanningX
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: CameraPanningY
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 1
joyNum: 0
- serializedVersion: 3
m_Name: CameraRotationModifier
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: mouse 0
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: CameraPanningModifier
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: mouse 1
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: CameraZoom
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 2
joyNum: 0
- serializedVersion: 3
m_Name: ChangeVehicle
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: v
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: FPSMovementX
descriptiveName:
descriptiveNegativeName:
negativeButton: left
positiveButton: right
altNegativeButton: a
altPositiveButton: d
gravity: 3
dead: 0.001
sensitivity: 3
snap: 1
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: FPSMovementY
descriptiveName:
descriptiveNegativeName:
negativeButton: down
positiveButton: up
altNegativeButton: s
altPositiveButton: w
gravity: 3
dead: 0.001
sensitivity: 3
snap: 1
invert: 0
type: 0
axis: 1
joyNum: 0
- serializedVersion: 3
m_Name: ToggleGUI
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: tab
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c5ce635526cd2a84fbbece250b0df805
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,249 @@
// ╔════════════════════════════════════════════════════════════════╗
// ║ Copyright © 2025 NWH Coding d.o.o. All rights reserved. ║
// ║ Licensed under Unity Asset Store Terms of Service: ║
// ║ https://unity.com/legal/as-terms ║
// ║ Use permitted only in compliance with the License. ║
// ║ Distributed "AS IS", without warranty of any kind. ║
// ╚════════════════════════════════════════════════════════════════╝
#region
using UnityEngine;
#if UNITY_EDITOR
using NWH.NUI;
using NWH.DWP2.ShipController;
using UnityEditor;
#endif
#endregion
namespace NWH.DWP2.ShipController
{
/// <summary>
/// Ship input provider for Unity's legacy Input Manager.
/// Handles keyboard and gamepad input through Input.GetAxis and Input.GetButton.
/// Requires proper axis and button setup in Project Settings > Input Manager.
/// Falls back to hardcoded keys if input bindings are not configured.
/// </summary>
[DisallowMultipleComponent]
public class InputManagerShipInputProvider : ShipInputProvider
{
#if ENABLE_LEGACY_INPUT_MANAGER
private static int _warningCount;
public override float Steering()
{
return TryGetAxis("Steering");
}
public override float Throttle()
{
return TryGetAxis("Throttle");
}
public override float Throttle2()
{
return TryGetAxis("Throttle2");
}
public override float Throttle3()
{
return TryGetAxis("Throttle3");
}
public override float Throttle4()
{
return TryGetAxis("Throttle4");
}
public override float SternThruster()
{
return TryGetAxis("SternThruster");
}
public override float BowThruster()
{
return TryGetAxis("BowThruster");
}
public override float SubmarineDepth()
{
return TryGetAxis("SubmarineDepth");
}
public override bool EngineStartStop()
{
return TryGetButtonDown("EngineStartStop", KeyCode.E);
}
public override bool Anchor()
{
return TryGetButtonDown("Anchor", KeyCode.T);
}
public override Vector2 DragObjectPosition()
{
return new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"));
}
public override bool DragObjectModifier()
{
return TryGetButton("DragObjectModifier", KeyCode.LeftControl);
}
public override float RotateSail()
{
return TryGetAxis("RotateSail");
}
/// <summary>
/// Attempts to read button state from Input Manager, falling back to direct key check if binding is missing.
/// </summary>
/// <param name="buttonName">Name of the button binding in Input Manager.</param>
/// <param name="altKey">Fallback key to use if binding is not configured.</param>
/// <param name="showWarning">Whether to log a warning on missing binding.</param>
/// <returns>True if button is pressed.</returns>
private static bool TryGetButton(string buttonName, KeyCode altKey, bool showWarning = true)
{
try
{
return Input.GetButton(buttonName);
}
catch
{
// Make sure warning is not spammed as some users tend to ignore the warning and never set up the input,
// resulting in bad performance in editor.
if (_warningCount < 100 && showWarning)
{
Debug.LogWarning(buttonName +
" input binding missing, falling back to default. Check Input section in manual for more info.");
_warningCount++;
}
return Input.GetKey(altKey);
}
}
/// <summary>
/// Attempts to read button down state from Input Manager, falling back to direct key check if binding is missing.
/// </summary>
/// <param name="buttonName">Name of the button binding in Input Manager.</param>
/// <param name="altKey">Fallback key to use if binding is not configured.</param>
/// <param name="showWarning">Whether to log a warning on missing binding.</param>
/// <returns>True if button was pressed this frame.</returns>
private static bool TryGetButtonDown(string buttonName, KeyCode altKey, bool showWarning = true)
{
try
{
return Input.GetButtonDown(buttonName);
}
catch
{
if (_warningCount < 100 && showWarning)
{
Debug.LogWarning(buttonName +
" input binding missing, falling back to default. Check Input section in manual for more info.");
_warningCount++;
}
return Input.GetKeyDown(altKey);
}
}
/// <summary>
/// Attempts to read axis value from Input Manager, returning 0 if binding is missing.
/// </summary>
/// <param name="axisName">Name of the axis binding in Input Manager.</param>
/// <param name="showWarning">Whether to log a warning on missing binding.</param>
/// <returns>Axis value between -1 and 1, or 0 if binding is missing.</returns>
private static float TryGetAxis(string axisName, bool showWarning = true)
{
try
{
return Input.GetAxis(axisName);
}
catch
{
if (_warningCount < 100 && showWarning)
{
Debug.LogWarning(axisName +
" input binding missing. Check Input section in manual for more info.");
_warningCount++;
}
}
return 0;
}
/// <summary>
/// Attempts to read raw axis value from Input Manager, returning 0 if binding is missing.
/// Raw values are unsmoothed and return -1, 0, or 1 immediately.
/// </summary>
/// <param name="axisName">Name of the axis binding in Input Manager.</param>
/// <param name="showWarning">Whether to log a warning on missing binding.</param>
/// <returns>Raw axis value, or 0 if binding is missing.</returns>
private static float TryGetAxisRaw(string axisName, bool showWarning = true)
{
try
{
return Input.GetAxisRaw(axisName);
}
catch
{
if (_warningCount < 100 && showWarning)
{
Debug.LogWarning(axisName +
" input binding missing. Check Input section in manual for more info.");
_warningCount++;
}
}
return 0;
}
#endif
}
}
#if UNITY_EDITOR
namespace NWH.DWP2.ShipController
{
[CustomEditor(typeof(InputManagerShipInputProvider))]
public class InputManagerShipInputProviderEditor : DWP2NUIEditor
{
public override bool OnInspectorNUI()
{
if (!base.OnInspectorNUI())
{
return false;
}
drawer.EndEditor(this);
return true;
}
public override bool UseDefaultMargins()
{
return false;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0bd6872030b3f8f408d790b9447fff05
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 91b5cb9977b3a804698a70a88d0b2955
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,176 @@
// ╔════════════════════════════════════════════════════════════════╗
// ║ Copyright © 2025 NWH Coding d.o.o. All rights reserved. ║
// ║ Licensed under Unity Asset Store Terms of Service: ║
// ║ https://unity.com/legal/as-terms ║
// ║ Use permitted only in compliance with the License. ║
// ║ Distributed "AS IS", without warranty of any kind. ║
// ╚════════════════════════════════════════════════════════════════╝
#region
using UnityEngine;
#if UNITY_EDITOR
using NWH.NUI;
using NWH.DWP2.ShipController;
using UnityEditor;
#endif
#endregion
namespace NWH.DWP2.ShipController
{
/// <summary>
/// Ship input provider for Unity's new Input System.
/// Uses ShipInputActions asset for input binding configuration.
/// Supports keyboard, gamepad, and custom input devices through the Input System.
/// Input bindings can be modified by editing the ShipInputActions asset.
/// </summary>
public class InputSystemShipInputProvider : ShipInputProvider
{
/// <summary>
/// Input action asset containing all ship control bindings.
/// </summary>
public ShipInputActions shipInputActions;
private float _bowThruster;
private float _rotateSail;
private float _steering;
private float _sternThruster;
private float _submarineDepth;
private float _throttle;
private float _throttle2;
private float _throttle3;
private float _throttle4;
public new void Awake()
{
base.Awake();
shipInputActions = new ShipInputActions();
shipInputActions.Enable();
}
public void Update()
{
_steering = shipInputActions.ShipControls.Steering.ReadValue<float>();
_throttle = shipInputActions.ShipControls.Throttle.ReadValue<float>();
_throttle2 = shipInputActions.ShipControls.Throttle2.ReadValue<float>();
_throttle3 = shipInputActions.ShipControls.Throttle3.ReadValue<float>();
_throttle4 = shipInputActions.ShipControls.Throttle4.ReadValue<float>();
_bowThruster = shipInputActions.ShipControls.BowThruster.ReadValue<float>();
_sternThruster = shipInputActions.ShipControls.SternThruster.ReadValue<float>();
_rotateSail = shipInputActions.ShipControls.RotateSail.ReadValue<float>();
_submarineDepth = shipInputActions.ShipControls.SubmarineDepth.ReadValue<float>();
}
// Ship bindings
public override float Throttle()
{
return _throttle;
}
public override float Throttle2()
{
return _throttle2;
}
public override float Throttle3()
{
return _throttle3;
}
public override float Throttle4()
{
return _throttle4;
}
public override float Steering()
{
return _steering;
}
public override float BowThruster()
{
return _bowThruster;
}
public override float SternThruster()
{
return _sternThruster;
}
public override float SubmarineDepth()
{
return _submarineDepth;
}
public override bool EngineStartStop()
{
return shipInputActions.ShipControls.EngineStartStop.triggered;
}
public override bool Anchor()
{
return shipInputActions.ShipControls.Anchor.triggered;
}
public override float RotateSail()
{
return _rotateSail;
}
public override Vector2 DragObjectPosition()
{
return Vector2.zero;
}
public override bool DragObjectModifier()
{
return false;
}
}
}
#if UNITY_EDITOR
namespace NWH.DWP2.ShipController
{
[CustomEditor(typeof(InputSystemShipInputProvider))]
public class InputSystemShipInputProviderEditor : DWP2NUIEditor
{
public override bool OnInspectorNUI()
{
if (!base.OnInspectorNUI())
{
return false;
}
drawer.Info("Input settings for Unity's new input system can be changed by modifying 'ShipInputActions' " +
"file (double click on it to open).");
drawer.EndEditor(this);
return true;
}
public override bool UseDefaultMargins()
{
return false;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 977b3558370da85488b8199c446577a0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1 @@
Check http://nwhvehiclephysics.com/doku.php/NWH/VehiclePhysics2/Input/InputSystemProvider for setup instructions.

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c06bcaa1e7d879646a2983e73eb5574e
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6306a7aa4e66cb24aa90836f583b6d4e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,531 @@
{
"name": "ShipInputActions",
"maps": [
{
"name": "ShipControls",
"id": "200a0048-834b-4c46-8e58-cb0180a3f09b",
"actions": [
{
"name": "Steering",
"type": "Value",
"id": "4c14d84a-48f6-429e-9111-d009cff86527",
"expectedControlType": "Axis",
"processors": "",
"interactions": "",
"initialStateCheck": true
},
{
"name": "Throttle",
"type": "Value",
"id": "067e3728-8c0e-4c68-8b07-765ef5a0b2ff",
"expectedControlType": "Axis",
"processors": "",
"interactions": "",
"initialStateCheck": true
},
{
"name": "Throttle2",
"type": "Value",
"id": "ec48226f-41c5-4f41-addf-d89dc4fe9489",
"expectedControlType": "Axis",
"processors": "",
"interactions": "",
"initialStateCheck": true
},
{
"name": "Throttle3",
"type": "Value",
"id": "adb1ee87-c871-44cb-9536-be9a29269bd3",
"expectedControlType": "Axis",
"processors": "",
"interactions": "",
"initialStateCheck": true
},
{
"name": "Throttle4",
"type": "Value",
"id": "09912318-ce4d-4f0b-8336-e581f237a903",
"expectedControlType": "Axis",
"processors": "",
"interactions": "",
"initialStateCheck": true
},
{
"name": "BowThruster",
"type": "Value",
"id": "a09cdc8f-5c97-4068-8e2c-f72377d022f2",
"expectedControlType": "Axis",
"processors": "",
"interactions": "",
"initialStateCheck": true
},
{
"name": "SternThruster",
"type": "Value",
"id": "61f34607-04fc-4263-b801-6bb95dda9649",
"expectedControlType": "Axis",
"processors": "",
"interactions": "",
"initialStateCheck": true
},
{
"name": "SubmarineDepth",
"type": "Value",
"id": "c2a3958c-d006-4c67-8425-3635c0303de7",
"expectedControlType": "Axis",
"processors": "",
"interactions": "",
"initialStateCheck": true
},
{
"name": "EngineStartStop",
"type": "Button",
"id": "83764afd-1cc4-4537-9658-82bb7f635f32",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Anchor",
"type": "Button",
"id": "0050fc1b-a233-4284-b206-2e5254c3fc79",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "RotateSail",
"type": "Button",
"id": "6834f9a6-3f72-4ce7-9272-4c08d28e2f6c",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
{
"name": "Keyboard",
"id": "1bff6693-e128-4d74-ad2f-ad4e229608a8",
"path": "1DAxis",
"interactions": "",
"processors": "",
"groups": "",
"action": "Steering",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "Negative",
"id": "6a4beedd-9d33-48f8-ab0b-2fa4835b56d5",
"path": "<Keyboard>/a",
"interactions": "",
"processors": "",
"groups": "",
"action": "Steering",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "Positive",
"id": "3ce20f4e-6e04-4810-b8c6-829ced054390",
"path": "<Keyboard>/d",
"interactions": "",
"processors": "",
"groups": "",
"action": "Steering",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "Gamepad",
"id": "acf664f4-dde0-4367-8e3a-7fbdf293bc0c",
"path": "1DAxis",
"interactions": "",
"processors": "AxisDeadzone",
"groups": "",
"action": "Steering",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "negative",
"id": "0332ccc4-b818-41e6-8455-330ec56c13de",
"path": "<Gamepad>/leftStick/left",
"interactions": "",
"processors": "",
"groups": "",
"action": "Steering",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "positive",
"id": "89725913-86df-4c0b-893e-7dab71609463",
"path": "<Gamepad>/leftStick/right",
"interactions": "",
"processors": "",
"groups": "",
"action": "Steering",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "Keyboard",
"id": "4b4d086e-45c1-4efd-8515-ae86f80a90b1",
"path": "1DAxis",
"interactions": "",
"processors": "",
"groups": "",
"action": "Throttle",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "Negative",
"id": "6f9e3d4b-0428-4529-8135-15a721c1c69c",
"path": "<Keyboard>/s",
"interactions": "",
"processors": "",
"groups": "",
"action": "Throttle",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "Positive",
"id": "6da65c4c-15f8-4e4d-9560-05883d18ce16",
"path": "<Keyboard>/w",
"interactions": "",
"processors": "",
"groups": "",
"action": "Throttle",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "Gamepad",
"id": "405ba6f9-74dd-4b74-8687-7dda1bc905d3",
"path": "1DAxis",
"interactions": "",
"processors": "",
"groups": "",
"action": "Throttle",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "positive",
"id": "7d163169-2e04-49bb-8dad-3fa803f4201e",
"path": "<Gamepad>/rightTrigger",
"interactions": "",
"processors": "",
"groups": "",
"action": "Throttle",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "Negative",
"id": "64d90bc6-be37-4aab-ae3e-418884101999",
"path": "<Gamepad>/leftTrigger",
"interactions": "",
"processors": "",
"groups": "",
"action": "Throttle",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "Keyboard",
"id": "72d84049-f629-4a9e-bcfc-28b9c25ab184",
"path": "1DAxis",
"interactions": "",
"processors": "",
"groups": "",
"action": "SternThruster",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "Negative",
"id": "518e635c-d6f9-4b2c-927c-ef61e6ab41d2",
"path": "<Keyboard>/z",
"interactions": "",
"processors": "",
"groups": "",
"action": "SternThruster",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "Positive",
"id": "0f31564a-814a-4fb0-b549-e2c7e3e93935",
"path": "<Keyboard>/c",
"interactions": "",
"processors": "",
"groups": "",
"action": "SternThruster",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "Keyboard",
"id": "e04c0968-0501-4c7c-8326-dc8e845631aa",
"path": "1DAxis",
"interactions": "",
"processors": "",
"groups": "",
"action": "BowThruster",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "Negative",
"id": "1d34dc63-cb94-4628-8a5d-f1b5b5c553de",
"path": "<Keyboard>/q",
"interactions": "",
"processors": "",
"groups": "",
"action": "BowThruster",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "Positive",
"id": "7d4e3e8a-9ffe-40e0-b96e-b7b1f94a90cb",
"path": "<Keyboard>/e",
"interactions": "",
"processors": "",
"groups": "",
"action": "BowThruster",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "",
"id": "d62bb2c8-9196-4156-8dcb-6880975b400b",
"path": "<Keyboard>/e",
"interactions": "",
"processors": "",
"groups": "",
"action": "EngineStartStop",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "41b26daf-b33a-44aa-914f-71aa6d3e1e60",
"path": "<Keyboard>/t",
"interactions": "",
"processors": "",
"groups": "",
"action": "Anchor",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "Keyboard",
"id": "b228703a-0571-41de-9716-c9193a6cb635",
"path": "1DAxis",
"interactions": "",
"processors": "",
"groups": "",
"action": "SubmarineDepth",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "Negative",
"id": "92ec8857-35e5-49fd-9008-80f3f4a5704b",
"path": "<Keyboard>/k",
"interactions": "",
"processors": "",
"groups": "",
"action": "SubmarineDepth",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "Positive",
"id": "511c38f0-ff55-41b6-b29c-968ae5d0bdca",
"path": "<Keyboard>/i",
"interactions": "",
"processors": "",
"groups": "",
"action": "SubmarineDepth",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "Keyboard",
"id": "425eb718-41ba-4046-b5e1-c0765b18a0d6",
"path": "1DAxis",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateSail",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "negative",
"id": "665b2de9-54c1-49b9-8c09-b09d51986004",
"path": "<Keyboard>/1",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateSail",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "positive",
"id": "77c6e8da-423b-4a61-81b3-307ee0885fb3",
"path": "<Keyboard>/3",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateSail",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "Gamepad",
"id": "784000ff-cd57-4a8b-b566-5c9ecfd49072",
"path": "1DAxis",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateSail",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "negative",
"id": "dd4ceb8f-8255-48b1-a653-b20d0d032ea0",
"path": "<Gamepad>/leftShoulder",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateSail",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "positive",
"id": "fea1ff3f-958e-4d51-8989-92f1ff0353c3",
"path": "<Gamepad>/rightShoulder",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateSail",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "1D Axis",
"id": "d1628076-9f91-4ba6-ae90-d8b036e48da9",
"path": "1DAxis",
"interactions": "",
"processors": "",
"groups": "",
"action": "Throttle2",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "negative",
"id": "12f1d965-9170-49b1-b790-087f826b2012",
"path": "<Keyboard>/5",
"interactions": "",
"processors": "",
"groups": "",
"action": "Throttle2",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "positive",
"id": "1cf7ddc0-61ae-454c-aaaa-2748a687d422",
"path": "<Keyboard>/6",
"interactions": "",
"processors": "",
"groups": "",
"action": "Throttle2",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "1D Axis",
"id": "1025eb1c-b1c4-4e27-a4d8-93a170474157",
"path": "1DAxis",
"interactions": "",
"processors": "",
"groups": "",
"action": "Throttle3",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "negative",
"id": "951136f0-6456-4b40-98c5-bb2d65454e30",
"path": "<Keyboard>/7",
"interactions": "",
"processors": "",
"groups": "",
"action": "Throttle3",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "positive",
"id": "bfa74b17-341e-4959-83e9-4066379cdee9",
"path": "<Keyboard>/8",
"interactions": "",
"processors": "",
"groups": "",
"action": "Throttle3",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "1D Axis",
"id": "6670e901-cc41-42dd-accd-f9066c43566b",
"path": "1DAxis",
"interactions": "",
"processors": "",
"groups": "",
"action": "Throttle4",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "negative",
"id": "06a71ebf-f276-45a2-a2a4-d106ecb64eca",
"path": "<Keyboard>/9",
"interactions": "",
"processors": "",
"groups": "",
"action": "Throttle4",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "positive",
"id": "f677e629-0758-4bf2-8ab6-0d5cccf465a3",
"path": "<Keyboard>/0",
"interactions": "",
"processors": "",
"groups": "",
"action": "Throttle4",
"isComposite": false,
"isPartOfComposite": true
}
]
}
],
"controlSchemes": []
}

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 5f84ad71b5cafbd4fb9486bd51506173
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
generateWrapperCode: 1
wrapperCodePath:
wrapperClassName: ShipInputActions
wrapperCodeNamespace: NWH.DWP2.ShipController

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0b76ad1bb7ca5cb4385fabbf1b4a1684
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,252 @@
// ╔════════════════════════════════════════════════════════════════╗
// ║ Copyright © 2025 NWH Coding d.o.o. All rights reserved. ║
// ║ Licensed under Unity Asset Store Terms of Service: ║
// ║ https://unity.com/legal/as-terms ║
// ║ Use permitted only in compliance with the License. ║
// ║ Distributed "AS IS", without warranty of any kind. ║
// ╚════════════════════════════════════════════════════════════════╝
#region
using NWH.Common.Input;
using UnityEngine.UI;
#if UNITY_EDITOR
using NWH.NUI;
using NWH.DWP2.ShipController;
using UnityEditor;
#endif
#endregion
namespace NWH.DWP2.ShipController
{
/// <summary>
/// Ship input provider for mobile devices using on-screen UI controls.
/// Reads input from Unity UI Sliders and MobileInputButtons placed in the scene.
/// All control assignments are optional - assign only the controls you need for your ship.
/// </summary>
public class MobileShipInputProvider : ShipInputProvider
{
/// <summary>
/// Button for toggling anchor.
/// </summary>
public MobileInputButton anchorButton;
/// <summary>
/// Slider for bow thruster control.
/// </summary>
public Slider bowThrusterSlider;
/// <summary>
/// Button for changing camera in demo scenes.
/// </summary>
public MobileInputButton changeCameraButton;
/// <summary>
/// Button for changing ship in demo scenes.
/// </summary>
public MobileInputButton changeShipButton;
/// <summary>
/// Button for starting/stopping engines.
/// </summary>
public MobileInputButton engineStartStopButton;
/// <summary>
/// Slider for steering control.
/// </summary>
public Slider steeringSlider;
/// <summary>
/// Slider for stern thruster control.
/// </summary>
public Slider sternThrusterSlider;
/// <summary>
/// Slider for submarine depth control.
/// </summary>
public Slider submarineDepthSlider;
/// <summary>
/// Slider for primary throttle control.
/// </summary>
public Slider throttleSlider;
/// <summary>
/// Slider for secondary throttle control.
/// </summary>
public Slider throttleSlider2;
/// <summary>
/// Slider for tertiary throttle control.
/// </summary>
public Slider throttleSlider3;
/// <summary>
/// Slider for quaternary throttle control.
/// </summary>
public Slider throttleSlider4;
public override float Steering()
{
if (steeringSlider != null)
{
return steeringSlider.value;
}
return 0;
}
public override float Throttle()
{
if (throttleSlider != null)
{
return throttleSlider.value;
}
return 0;
}
public override float Throttle2()
{
if (throttleSlider2 != null)
{
return throttleSlider2.value;
}
return 0;
}
public override float Throttle3()
{
if (throttleSlider3 != null)
{
return throttleSlider3.value;
}
return 0;
}
public override float Throttle4()
{
if (throttleSlider4 != null)
{
return throttleSlider4.value;
}
return 0;
}
public override float SternThruster()
{
if (sternThrusterSlider != null)
{
return sternThrusterSlider.value;
}
return 0;
}
public override float BowThruster()
{
if (bowThrusterSlider != null)
{
return bowThrusterSlider.value;
}
return 0;
}
public override float SubmarineDepth()
{
if (submarineDepthSlider != null)
{
return submarineDepthSlider.value;
}
return 0;
}
public override bool EngineStartStop()
{
if (engineStartStopButton != null)
{
return engineStartStopButton.hasBeenClicked;
}
return false;
}
public override bool Anchor()
{
if (anchorButton != null)
{
return anchorButton.hasBeenClicked;
}
return false;
}
}
}
#if UNITY_EDITOR
namespace NWH.DWP2.WaterObjects
{
/// <summary>
/// Editor for MobileInputProvider.
/// </summary>
[CustomEditor(typeof(MobileShipInputProvider))]
public class MobileShipInputProviderEditor : DWP2NUIEditor
{
public override bool OnInspectorNUI()
{
if (!base.OnInspectorNUI())
{
return false;
}
drawer.Info("None of the buttons are mandatory. If you do not wish to use an input leave the field empty.");
MobileShipInputProvider mip = target as MobileShipInputProvider;
if (mip == null)
{
drawer.EndEditor(this);
return false;
}
drawer.BeginSubsection("Vehicle");
drawer.Field("steeringSlider");
drawer.Field("throttleSlider");
drawer.Field("throttleSlider2");
drawer.Field("throttleSlider3");
drawer.Field("throttleSlider4");
drawer.Field("bowThrusterSlider");
drawer.Field("sternThrusterSlider");
drawer.Field("submarineDepthSlider");
drawer.Field("engineStartStopButton");
drawer.Field("anchorButton");
drawer.EndSubsection();
drawer.EndEditor(this);
return true;
}
public override bool UseDefaultMargins()
{
return false;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e6484d5b83c996246bec2ae86dc967f0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,143 @@
// ╔════════════════════════════════════════════════════════════════╗
// ║ Copyright © 2025 NWH Coding d.o.o. All rights reserved. ║
// ║ Licensed under Unity Asset Store Terms of Service: ║
// ║ https://unity.com/legal/as-terms ║
// ║ Use permitted only in compliance with the License. ║
// ║ Distributed "AS IS", without warranty of any kind. ║
// ╚════════════════════════════════════════════════════════════════╝
#region
using NWH.Common.Input;
using UnityEngine;
#endregion
namespace NWH.DWP2.ShipController
{
/// <summary>
/// Base class for all ship input providers.
/// Inherit from this to create custom input systems for ship controls.
/// Provides virtual methods for all ship control inputs including throttle, steering, thrusters, and submarine depth control.
/// </summary>
public abstract class ShipInputProvider : InputProvider
{
/// <summary>
/// Horizontal steering input from -1 (port/left) to 1 (starboard/right).
/// </summary>
/// <returns>Steering input value.</returns>
public virtual float Steering()
{
return 0f;
}
/// <summary>
/// Primary throttle input from -1 (full reverse) to 1 (full forward).
/// </summary>
/// <returns>Throttle input value.</returns>
public virtual float Throttle()
{
return 0f;
}
/// <summary>
/// Secondary throttle input for independent engine control.
/// </summary>
/// <returns>Throttle2 input value.</returns>
public virtual float Throttle2()
{
return 0f;
}
/// <summary>
/// Tertiary throttle input for independent engine control.
/// </summary>
/// <returns>Throttle3 input value.</returns>
public virtual float Throttle3()
{
return 0f;
}
/// <summary>
/// Quaternary throttle input for independent engine control.
/// </summary>
/// <returns>Throttle4 input value.</returns>
public virtual float Throttle4()
{
return 0f;
}
/// <summary>
/// Stern thruster input from -1 to 1 for lateral movement at the rear.
/// </summary>
/// <returns>Stern thruster input value.</returns>
public virtual float SternThruster()
{
return 0f;
}
/// <summary>
/// Bow thruster input from -1 to 1 for lateral movement at the front.
/// </summary>
/// <returns>Bow thruster input value.</returns>
public virtual float BowThruster()
{
return 0f;
}
/// <summary>
/// Submarine depth control from -1 (surface) to 1 (dive).
/// </summary>
/// <returns>Submarine depth input value.</returns>
public virtual float SubmarineDepth()
{
return 0f;
}
/// <summary>
/// Toggle engine start/stop state.
/// </summary>
/// <returns>True if engine start/stop was triggered this frame.</returns>
public virtual bool EngineStartStop()
{
return false;
}
/// <summary>
/// Toggle anchor drop/weigh state.
/// </summary>
/// <returns>True if anchor toggle was triggered this frame.</returns>
public virtual bool Anchor()
{
return false;
}
/// <summary>
/// Sail rotation input for sailing vessels.
/// </summary>
/// <returns>Sail rotation input value.</returns>
public virtual float RotateSail()
{
return 0f;
}
/// <summary>
/// Mouse or touch position for object dragging in demo scenes.
/// </summary>
/// <returns>Drag position delta.</returns>
public virtual Vector2 DragObjectPosition()
{
return Vector2.zero;
}
/// <summary>
/// Modifier key for object dragging.
/// </summary>
/// <returns>True if drag modifier is held.</returns>
public virtual bool DragObjectModifier()
{
return false;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 60c083b84fa146bf9eaa1e02e353b07a
timeCreated: 1593348064

View File

@@ -0,0 +1,208 @@
// ╔════════════════════════════════════════════════════════════════╗
// ║ Copyright © 2025 NWH Coding d.o.o. All rights reserved. ║
// ║ Licensed under Unity Asset Store Terms of Service: ║
// ║ https://unity.com/legal/as-terms ║
// ║ Use permitted only in compliance with the License. ║
// ║ Distributed "AS IS", without warranty of any kind. ║
// ╚════════════════════════════════════════════════════════════════╝
#region
using System;
using NWH.Common.Input;
using UnityEngine;
using UnityEngine.Events;
#if UNITY_EDITOR
using NWH.NUI;
using NWH.DWP2.ShipController;
using UnityEditor;
#endif
#endregion
namespace NWH.DWP2.ShipController
{
/// <summary>
/// Manages ship input by retrieving values from active ShipInputProviders and storing them in ShipInputStates.
/// Automatically polls all registered input providers and combines their inputs.
/// Can be disabled for manual input control via scripting or AI.
/// </summary>
[Serializable]
public class ShipInputHandler
{
/// <summary>
/// When enabled input will be auto-retrieved from the InputProviders present in the scene.
/// Disable to manualy set the input through external scripts, i.e. AI controller.
/// </summary>
[Tooltip(
"When enabled input will be auto-retrieved from the InputProviders present in the scene.\r\nDisable to manualy set the input through external scripts, i.e. AI controller.")]
public bool autoSetInput = true;
/// <summary>
/// Callback invoked after input is processed each frame.
/// Use this to modify input values programmatically before they are used.
/// </summary>
public UnityEvent modifyInputCallback = new();
/// <summary>
/// All the input states of the vehicle. Can be used to set input through scripting or copy the inputs
/// over from other vehicle, such as truck to trailer.
/// </summary>
[Tooltip(
"All the input states of the vehicle. Can be used to set input through scripting or copy the inputs\r\nover from other vehicle, such as truck to trailer.")]
public ShipInputStates states;
/// <summary>
/// Primary throttle input from -1 (full reverse) to 1 (full forward).
/// </summary>
public float Throttle
{
get { return states.throttle; }
set { states.throttle = Mathf.Clamp(value, -1f, 1f); }
}
/// <summary>
/// Secondary throttle for independent engine control.
/// </summary>
public float Throttle2
{
get { return states.throttle2; }
set { states.throttle2 = Mathf.Clamp(value, -1f, 1f); }
}
/// <summary>
/// Tertiary throttle for independent engine control.
/// </summary>
public float Throttle3
{
get { return states.throttle3; }
set { states.throttle3 = Mathf.Clamp(value, -1f, 1f); }
}
/// <summary>
/// Quaternary throttle for independent engine control.
/// </summary>
public float Throttle4
{
get { return states.throttle4; }
set { states.throttle4 = Mathf.Clamp(value, -1f, 1f); }
}
/// <summary>
/// Steering input from -1 (port/left) to 1 (starboard/right).
/// </summary>
public float Steering
{
get { return states.steering; }
set { states.steering = Mathf.Clamp(value, -1f, 1f); }
}
/// <summary>
/// Stern thruster input from -1 to 1.
/// </summary>
public float SternThruster
{
get { return states.sternThruster; }
set { states.sternThruster = Mathf.Clamp(value, -1f, 1f); }
}
/// <summary>
/// Bow thruster input from -1 to 1.
/// </summary>
public float BowThruster
{
get { return states.bowThruster; }
set { states.bowThruster = Mathf.Clamp(value, -1f, 1f); }
}
/// <summary>
/// Submarine depth control from -1 (surface) to 1 (dive).
/// </summary>
public float SubmarineDepth
{
get { return states.submarineDepth; }
set { states.submarineDepth = Mathf.Clamp01(value); }
}
/// <summary>
/// Anchor toggle state. True for one frame when anchor input is pressed.
/// </summary>
public bool Anchor
{
get { return states.anchor; }
set { states.anchor = value; }
}
/// <summary>
/// Engine start/stop toggle state. True for one frame when toggle input is pressed.
/// </summary>
public bool EngineStartStop
{
get { return states.engineStartStop; }
set { states.engineStartStop = value; }
}
/// <summary>
/// Sail rotation input for sailing vessels.
/// </summary>
public float RotateSail
{
get { return states.rotateSail; }
set { states.rotateSail = value; }
}
/// <summary>
/// Updates all input values from registered input providers.
/// Called automatically by AdvancedShipController.
/// </summary>
public void Update()
{
if (!autoSetInput)
{
return;
}
Steering = InputProvider.CombinedInput<ShipInputProvider>(i => i.Steering());
Throttle = InputProvider.CombinedInput<ShipInputProvider>(i => i.Throttle());
Throttle2 = InputProvider.CombinedInput<ShipInputProvider>(i => i.Throttle2());
Throttle3 = InputProvider.CombinedInput<ShipInputProvider>(i => i.Throttle3());
Throttle4 = InputProvider.CombinedInput<ShipInputProvider>(i => i.Throttle4());
BowThruster = InputProvider.CombinedInput<ShipInputProvider>(i => i.BowThruster());
SternThruster = InputProvider.CombinedInput<ShipInputProvider>(i => i.SternThruster());
SubmarineDepth = InputProvider.CombinedInput<ShipInputProvider>(i => i.SubmarineDepth());
RotateSail = InputProvider.CombinedInput<ShipInputProvider>(i => i.RotateSail());
EngineStartStop |= InputProvider.CombinedInput<ShipInputProvider>(i => i.EngineStartStop());
Anchor |= InputProvider.CombinedInput<ShipInputProvider>(i => i.Anchor());
modifyInputCallback.Invoke();
}
}
}
#if UNITY_EDITOR
namespace NWH.DWP2.WaterObjects
{
/// <summary>
/// Property drawer for Input.
/// </summary>
[CustomPropertyDrawer(typeof(ShipInputHandler))]
public class ShipInputHandlerDrawer : NUIPropertyDrawer
{
public override bool OnNUI(Rect position, SerializedProperty property, GUIContent label)
{
if (!base.OnNUI(position, property, label))
{
return false;
}
drawer.Field("autoSetInput");
drawer.Field("states");
drawer.EndProperty();
return true;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1683a5329131f194bb712f61279af852
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,157 @@
// ╔════════════════════════════════════════════════════════════════╗
// ║ Copyright © 2025 NWH Coding d.o.o. All rights reserved. ║
// ║ Licensed under Unity Asset Store Terms of Service: ║
// ║ https://unity.com/legal/as-terms ║
// ║ Use permitted only in compliance with the License. ║
// ║ Distributed "AS IS", without warranty of any kind. ║
// ╚════════════════════════════════════════════════════════════════╝
#region
using System;
using UnityEngine;
#if UNITY_EDITOR
using NWH.NUI;
using NWH.DWP2.ShipController;
using UnityEditor;
#endif
#endregion
namespace NWH.DWP2.ShipController
{
/// <summary>
/// Container for all ship input states.
/// Stores current values for all ship controls including throttle, steering, thrusters, and special inputs.
/// </summary>
[Serializable]
public struct ShipInputStates
{
/// <summary>
/// Steering input from -1 (port/left) to 1 (starboard/right).
/// </summary>
[Range(-1, 1)]
public float steering;
/// <summary>
/// Primary throttle from -1 (full reverse) to 1 (full forward).
/// </summary>
[Range(-1, 1)]
public float throttle;
/// <summary>
/// Secondary throttle for independent engine control.
/// </summary>
[Range(-1, 1)]
public float throttle2;
/// <summary>
/// Tertiary throttle for independent engine control.
/// </summary>
[Range(-1, 1)]
public float throttle3;
/// <summary>
/// Quaternary throttle for independent engine control.
/// </summary>
[Range(-1, 1)]
public float throttle4;
/// <summary>
/// Stern thruster input from -1 to 1.
/// </summary>
[Range(-1, 1)]
public float sternThruster;
/// <summary>
/// Bow thruster input from -1 to 1.
/// </summary>
[Range(-1, 1)]
public float bowThruster;
/// <summary>
/// Submarine depth control from 0 (surface) to 1 (dive).
/// </summary>
[Range(0, 1)]
public float submarineDepth;
/// <summary>
/// Sail rotation input for sailing vessels.
/// </summary>
[Range(-1, 1)]
public float rotateSail;
/// <summary>
/// Engine start/stop toggle state.
/// </summary>
public bool engineStartStop;
/// <summary>
/// Anchor drop/weigh toggle state.
/// </summary>
public bool anchor;
/// <summary>
/// Change ship input for demo scenes.
/// </summary>
public bool changeShip;
/// <summary>
/// Change camera input for demo scenes.
/// </summary>
public bool changeCamera;
/// <summary>
/// Resets all input states to default values.
/// </summary>
public void Reset()
{
throttle = 0;
throttle2 = 0;
throttle3 = 0;
throttle4 = 0;
sternThruster = 0;
bowThruster = 0;
submarineDepth = 0;
engineStartStop = false;
anchor = false;
}
}
}
#if UNITY_EDITOR
namespace NWH.DWP2.WaterObjects
{
/// <summary>
/// Property drawer for InputStates.
/// </summary>
[CustomPropertyDrawer(typeof(ShipInputStates))]
public class ShipInputStatesDrawer : NUIPropertyDrawer
{
public override bool OnNUI(Rect position, SerializedProperty property, GUIContent label)
{
if (!base.OnNUI(position, property, label))
{
return false;
}
drawer.Field("steering");
drawer.Field("throttle");
drawer.Field("throttle2");
drawer.Field("throttle3");
drawer.Field("throttle4");
drawer.Field("bowThruster");
drawer.Field("sternThruster");
drawer.Field("submarineDepth");
drawer.Field("rotateSail");
drawer.Field("engineStartStop");
drawer.Field("anchor");
drawer.EndProperty();
return true;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a35ed19c737863945865ce770eeb311a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: