备份CatanBuilding瘦身独立工程
This commit is contained in:
39
Assets/Scripts/SandDig/GameScript/PropSparkItem.cs
Normal file
39
Assets/Scripts/SandDig/GameScript/PropSparkItem.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Script.RuntimeScript.GameLogic
|
||||
{
|
||||
public class PropSparkItem : MonoBehaviour
|
||||
{
|
||||
Transform fx_diggingitem_spark;
|
||||
private void Awake()
|
||||
{
|
||||
fx_diggingitem_spark = transform.Find("PositionRoot/AnimationRoot/fx_diggingitem_spark");
|
||||
}
|
||||
|
||||
public void Init(float ItemFxScale)
|
||||
{
|
||||
if (fx_diggingitem_spark)
|
||||
{
|
||||
fx_diggingitem_spark.localScale = Vector3.one * ItemFxScale;
|
||||
StartCoroutine(PlaySpark());
|
||||
}
|
||||
}
|
||||
IEnumerator PlaySpark()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
int seconds = Random.Range(2, 4);
|
||||
yield return new WaitForSeconds(seconds);
|
||||
fx_diggingitem_spark.gameObject.SetActive(true);
|
||||
seconds = Random.Range(2, 4);
|
||||
yield return new WaitForSeconds(seconds);
|
||||
fx_diggingitem_spark.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
private void OnDisable()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user