Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unity weather parameters, weather HUD, and a visual effect for snow #2909

Merged
merged 10 commits into from
Mar 8, 2021
12 changes: 5 additions & 7 deletions Unity/UnityDemo/Assets/AirSimAssets/Scripts/HUD/WeatherHUD.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
using System;
using UnityEditor.VersionControl;
using UnityEngine;
using UnityEngine;
using UnityEngine.UI;

namespace AirSimUnity {
/// <summary>
/// HUD class that manage weather-related UI elements.
/// </summary>
/// </summary>x
zimmy87 marked this conversation as resolved.
Show resolved Hide resolved
public class WeatherHUD : MonoBehaviour {
[SerializeField] private RectTransform rootPanel;
[SerializeField] private Toggle weatherEnabledToggle;
[SerializeField] private WeatherHUDSlider snowSlider;
[SerializeField] private RectTransform rootPanel = default;
[SerializeField] private Toggle weatherEnabledToggle = default;
[SerializeField] private WeatherHUDSlider snowSlider = default;

private void Start() {
rootPanel.gameObject.SetActive(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
using System;
using UnityEditor.UI;
using UnityEditor.VersionControl;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine;
using UnityEngine.UI;

namespace AirSimUnity {
/// <summary>
/// HUD class that manage weather-related UI elements.
/// </summary>
public class WeatherHUDSlider : MonoBehaviour {
[SerializeField] private Slider slider;
[SerializeField] private InputField inputField;
[SerializeField] private Slider slider = default;
[SerializeField] private InputField inputField = default;

public Slider.SliderEvent OnValueChanged;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ public class AirSimCarController : MonoBehaviour {
[SerializeField] private CarDriveType m_CarDriveType = CarDriveType.FourWheelDrive;
[SerializeField] private WheelCollider[] m_WheelColliders = new WheelCollider[4];
[SerializeField] private GameObject[] m_WheelMeshes = new GameObject[4];
[SerializeField] private Vector3 m_CentreOfMassOffset;
[SerializeField] private float m_MaximumSteerAngle;
[Range(0, 1)] [SerializeField] private float m_SteerHelper; // 0 is raw physics , 1 the car will grip in the direction it is facing
[Range(0, 1)] [SerializeField] private float m_TractionControl; // 0 is no traction control, 1 is full interference
[SerializeField] private float m_FullTorqueOverAllWheels;
[SerializeField] private float m_ReverseTorque;
[SerializeField] private Vector3 m_CentreOfMassOffset = default;
[SerializeField] private float m_MaximumSteerAngle = default;
[Range(0, 1)] [SerializeField] private float m_SteerHelper = default; // 0 is raw physics , 1 the car will grip in the direction it is facing
[Range(0, 1)] [SerializeField] private float m_TractionControl = default; // 0 is no traction control, 1 is full interference
[SerializeField] private float m_FullTorqueOverAllWheels = default;
[SerializeField] private float m_ReverseTorque = default;
[SerializeField] private float m_MaxHandbrakeTorque;
[SerializeField] private float m_Downforce = 100f;
[SerializeField] private float m_Topspeed = 200;
[SerializeField] private int NoOfGears = 5;
[SerializeField] private float m_RevRangeBoundary = 1f;
[SerializeField] private float m_SlipLimit;
[SerializeField] private float m_BrakeTorque;
[SerializeField] private float m_SlipLimit = default;
[SerializeField] private float m_BrakeTorque = default;

private Quaternion[] m_WheelMeshLocalRotations;
private Vector3 m_Prevpos, m_Pos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public enum WeatherParamScalar {
}

[Tooltip("WeatherFX prefab that will be spawned as a child of each vehicle.")]
[SerializeField] private WeatherFX WeatherFXPrefab;
[SerializeField] private WeatherFX WeatherFXPrefab = default;

private bool isEnabled;
private float[] weatherParamScalars = new float[(int)WeatherParamScalar.Count];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using UnityEngine;

/// <summary>
/// Renders an instance of weather visual effects.
/// </summary>
namespace AirSimUnity
{
/// <summary>
/// Renders an instance of weather visual effects.
/// </summary>
public class WeatherFX : MonoBehaviour
{
[SerializeField] private ParticleSystem snowParticleSystem;
[SerializeField] private ParticleSystem snowParticleSystem = default;
private float snowParticleSystemMaximumRate;

private void OnValidate() {
Expand Down