|
@ -10,6 +10,8 @@ public class Cloud : MonoBehaviour |
|
|
float _lightningTimeout = 0f; |
|
|
float _lightningTimeout = 0f; |
|
|
float _timeToRandomStrike; |
|
|
float _timeToRandomStrike; |
|
|
const bool DO_RANDOM_STRIKES = true; |
|
|
const bool DO_RANDOM_STRIKES = true; |
|
|
|
|
|
float _timeToFlip = 0f; |
|
|
|
|
|
[SerializeField] GameObject _rain; |
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
// Start is called before the first frame update
|
|
|
void Start() |
|
|
void Start() |
|
@ -28,6 +30,13 @@ public class Cloud : MonoBehaviour |
|
|
_lightningTimeout -= Time.deltaTime; |
|
|
_lightningTimeout -= Time.deltaTime; |
|
|
_timeToHideLightning -= Time.deltaTime; |
|
|
_timeToHideLightning -= Time.deltaTime; |
|
|
_timeToRandomStrike -= Time.deltaTime; |
|
|
_timeToRandomStrike -= Time.deltaTime; |
|
|
|
|
|
_timeToFlip -= Time.deltaTime; |
|
|
|
|
|
|
|
|
|
|
|
if (_timeToFlip < 0f) |
|
|
|
|
|
{ |
|
|
|
|
|
_rain.transform.localScale = new Vector3(_rain.transform.localScale.x * -1, _rain.transform.localScale.y, _rain.transform.localScale.z); |
|
|
|
|
|
_timeToFlip = 0.2f; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (_timeToHideLightning < 0f) |
|
|
if (_timeToHideLightning < 0f) |
|
|
{ |
|
|
{ |
|
@ -55,7 +64,7 @@ public class Cloud : MonoBehaviour |
|
|
public void ReInit() |
|
|
public void ReInit() |
|
|
{ |
|
|
{ |
|
|
float scale = Random.Range(1.5f, 2.5f); |
|
|
float scale = Random.Range(1.5f, 2.5f); |
|
|
float x = Random.Range(-100f, 100f); |
|
|
float x = Random.Range(-200f, 200f); |
|
|
float y = Random.Range(95f, 975f); |
|
|
float y = Random.Range(95f, 975f); |
|
|
transform.localScale = new Vector3(scale, scale, 2f); |
|
|
transform.localScale = new Vector3(scale, scale, 2f); |
|
|
transform.position = new Vector3(transform.position.x + x, y, transform.position.z); |
|
|
transform.position = new Vector3(transform.position.x + x, y, transform.position.z); |
|
|