using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// Sci-Fi Ship Controller. Copyright (c) 2018-2023 SCSM Pty Ltd. All rights reserved.
namespace SciFiShipController
{
///
/// Class containing ship input parameters.
///
public class ShipInput
{
#region Public Variables - Input Data
///
/// X-axis translational input. Range -1 to +1. Positive values result in rightward input, negative values result in leftward input.
///
public float horizontal;
///
/// Y-axis translational input. Range -1 to +1. Positive values result in upward input, negative values result in downward input.
///
public float vertical;
///
/// Z-axis translational input. Range -1 to +1. Positive values result in forward input, negative values result in backward input.
///
public float longitudinal;
///
/// X-axis rotational input. Range -1 to +1. Positive values result in downwards pitching input, negative values result in upwards pitching input.
///
public float pitch;
///
/// Y-axis rotational input. Range -1 to +1. Positive values result in rightwards turning input, negative values result in leftwards turning input.
///
public float yaw;
///
/// Z-axis rotational input. Range -1 to +1. Positive values result in rightwards rolling input, negative values result in leftwards rolling input.
///
public float roll;
///
/// Primary fire input. Boolean value.
///
public bool primaryFire;
///
/// Secondary fire input. Boolean value.
///
public bool secondaryFire;
///
/// Dock action input. Boolean value. Works when an initialised ShipDocking script is attached to an enabled ShipControlModule.
/// This will trigger a docking action which will depend on which DockingState the ship is already in.
///
public bool dock;
#endregion
#region Public Variables - Input Enablement (Advanced)
// Generally you'll leave these all enabled. When you want
// to update some axis in code while allowing the PlayerInputModule
// to control everything else, you can just enable the axis
// that you want to update and call shipControlModule.SendInput(shipInput).
///
/// Should we use or discard data in the horizontal field?
///
public bool isHorizontalDataEnabled;
///
/// Should we use or discard data in the vertical field?
///
public bool isVerticalDataEnabled;
///
/// Should we use or discard data in the longitudinal field?
///
public bool isLongitudinalDataEnabled;
///
/// Should we use or discard data in the pitch field?
///
public bool isPitchDataEnabled;
///
/// Should we use or discard data in the yaw field?
///
public bool isYawDataEnabled;
///
/// Should we use or discard data in the roll field?
///
public bool isRollDataEnabled;
///
/// Should we use or discard data in the primaryFire field?
///
public bool isPrimaryFireDataEnabled;
///
/// Should we use or discard data in the secondaryFire field?
///
public bool isSecondaryFireDataEnabled;
///
/// Should we use or discard data in the dock field?
///
public bool isDockDataEnabled;
#endregion
#region Class Constructor
public ShipInput()
{
// Input data fields
horizontal = 0f;
vertical = 0f;
longitudinal = 0f;
pitch = 0f;
yaw = 0f;
roll = 0f;
primaryFire = false;
secondaryFire = false;
dock = false;
// Update Enablement fields
EnableAllData();
}
#endregion
#region Public API Methods
///
/// A quick way to set all is[axisname]DataEnabled fields to true
///
public void EnableAllData()
{
isHorizontalDataEnabled = true;
isVerticalDataEnabled = true;
isLongitudinalDataEnabled = true;
isPitchDataEnabled = true;
isYawDataEnabled = true;
isRollDataEnabled = true;
isPrimaryFireDataEnabled = true;
isSecondaryFireDataEnabled = true;
isDockDataEnabled = true;
}
///
/// A quick way to set all is[axisname]DataEnabled fields to false
///
public void DisableAllData()
{
isHorizontalDataEnabled = false;
isVerticalDataEnabled = false;
isLongitudinalDataEnabled = false;
isPitchDataEnabled = false;
isYawDataEnabled = false;
isRollDataEnabled = false;
isPrimaryFireDataEnabled = false;
isSecondaryFireDataEnabled = false;
isDockDataEnabled = false;
}
#endregion
}
}