|
|
|
@ -1,6 +1,7 @@ |
|
|
|
using System.Collections; |
|
|
|
using System.Collections; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.Generic; |
|
|
|
using UnityEngine; |
|
|
|
using UnityEngine; |
|
|
|
|
|
|
|
using UnityEngine.UI; |
|
|
|
|
|
|
|
|
|
|
|
public class SnowFlakeBehaviour : MonoBehaviour |
|
|
|
public class SnowFlakeBehaviour : MonoBehaviour |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -11,6 +12,15 @@ public class SnowFlakeBehaviour : MonoBehaviour |
|
|
|
|
|
|
|
|
|
|
|
[AutoUI] public float DisappearTimeRandomRange = 2; |
|
|
|
[AutoUI] public float DisappearTimeRandomRange = 2; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[AutoUI] public bool ViewCollider = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[AutoUI] public Vector2 ColliderPosition = new Vector2(460, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[AutoUI] public Vector2 ColliderSize = new Vector2(400, 400); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[SerializeField] private RectTransform _colliderRectTransform; |
|
|
|
|
|
|
|
private RawImage _colliderImage; |
|
|
|
|
|
|
|
|
|
|
|
public SnowFlake[] SnowFlakes; |
|
|
|
public SnowFlake[] SnowFlakes; |
|
|
|
|
|
|
|
|
|
|
|
[SerializeField] private SnowFlake _currentFlake; |
|
|
|
[SerializeField] private SnowFlake _currentFlake; |
|
|
|
@ -24,6 +34,7 @@ public class SnowFlakeBehaviour : MonoBehaviour |
|
|
|
flake._snowFlakeBehaviour = this; |
|
|
|
flake._snowFlakeBehaviour = this; |
|
|
|
} |
|
|
|
} |
|
|
|
Play(); |
|
|
|
Play(); |
|
|
|
|
|
|
|
_colliderImage = _colliderRectTransform.GetComponent<RawImage>(); |
|
|
|
_rectTransform = GetComponent<RectTransform>(); |
|
|
|
_rectTransform = GetComponent<RectTransform>(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -31,7 +42,17 @@ public class SnowFlakeBehaviour : MonoBehaviour |
|
|
|
void Update() |
|
|
|
void Update() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if((Time.frameCount & 0x19) == 0) |
|
|
|
if((Time.frameCount & 0x19) == 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
_colliderImage.color = ViewCollider ? Color.white : new Color(1,1,1,0); |
|
|
|
_rectTransform.anchoredPosition = Position; |
|
|
|
_rectTransform.anchoredPosition = Position; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(ViewCollider) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
_colliderRectTransform.anchoredPosition = ColliderPosition; |
|
|
|
|
|
|
|
_colliderRectTransform.sizeDelta = ColliderSize; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
IEnumerator WaitToPlay() |
|
|
|
IEnumerator WaitToPlay() |
|
|
|
|