Some conflicts resolved
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
@@ -10,6 +11,23 @@ public class WindController : MonoBehaviour, ITask
|
||||
public float maxWindTorque = 8f;
|
||||
public float windChangeSpeed = 0.6f;
|
||||
public float gustInterval = 4f;
|
||||
=======
|
||||
using UnityEngine;
|
||||
|
||||
public class WindController : MonoBehaviour
|
||||
{
|
||||
[Header("settings větru")]
|
||||
[Tooltip("Maximální síla větru (kladná i záporná)")]
|
||||
public float maxWindTorque = 8f;
|
||||
|
||||
[Tooltip("Jak rychle se větr mění směrem/sílou")]
|
||||
public float windChangeSpeed = 0.6f;
|
||||
|
||||
[Tooltip("Jak často se objeví silnější vichřice (v sekundách)")]
|
||||
public float gustInterval = 4f;
|
||||
|
||||
[Tooltip("Multiplier pro sílu vichřice")]
|
||||
>>>>>>> origin/main
|
||||
public float gustMultiplier = 2.0f;
|
||||
|
||||
public float CurrentWindTorque { get; private set; }
|
||||
@@ -17,6 +35,7 @@ public class WindController : MonoBehaviour, ITask
|
||||
private float targetTorque;
|
||||
private float gustTimer;
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
private Action<ITask> _onCompleted;
|
||||
private Action<ITask> _onExit;
|
||||
@@ -27,6 +46,8 @@ public class WindController : MonoBehaviour, ITask
|
||||
public Position TaskLocation { get; set; }
|
||||
public bool IsCompleted { get; private set; }
|
||||
|
||||
=======
|
||||
>>>>>>> origin/main
|
||||
void Start()
|
||||
{
|
||||
PickNewTargetTorque();
|
||||
@@ -35,6 +56,7 @@ public class WindController : MonoBehaviour, ITask
|
||||
|
||||
void Update()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
CurrentWindTorque = Mathf.Lerp(CurrentWindTorque, targetTorque, Time.deltaTime * windChangeSpeed);
|
||||
|
||||
gustTimer -= Time.deltaTime;
|
||||
@@ -45,11 +67,27 @@ public class WindController : MonoBehaviour, ITask
|
||||
|
||||
gustTimer = gustInterval;
|
||||
Invoke(nameof(PickNewTargetTorque), 0.8f);
|
||||
=======
|
||||
// Smoothly move wind toward target torque
|
||||
CurrentWindTorque = Mathf.Lerp(CurrentWindTorque, targetTorque, Time.deltaTime * windChangeSpeed);
|
||||
|
||||
// Occasional gusts
|
||||
gustTimer -= Time.deltaTime;
|
||||
if (gustTimer <= 0f)
|
||||
{
|
||||
// Apply a short gust by shifting target torque more aggressively
|
||||
float gust = Random.Range(-maxWindTorque, maxWindTorque) * gustMultiplier;
|
||||
targetTorque = Mathf.Clamp(gust, -maxWindTorque * gustMultiplier, maxWindTorque * gustMultiplier);
|
||||
|
||||
gustTimer = gustInterval;
|
||||
Invoke(nameof(PickNewTargetTorque), 0.8f); // gust lasts ~0.8s
|
||||
>>>>>>> origin/main
|
||||
}
|
||||
}
|
||||
|
||||
private void PickNewTargetTorque()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
targetTorque = UnityEngine.Random.Range(-maxWindTorque, maxWindTorque);
|
||||
}
|
||||
|
||||
@@ -74,4 +112,9 @@ public class WindController : MonoBehaviour, ITask
|
||||
_onExit = onExit;
|
||||
_onExit?.Invoke(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
=======
|
||||
targetTorque = Random.Range(-maxWindTorque, maxWindTorque);
|
||||
}
|
||||
}
|
||||
>>>>>>> origin/main
|
||||
|
||||
Reference in New Issue
Block a user