[TASK] Spawn collectable ducks on the map when in range

This commit is contained in:
2019-08-19 00:36:56 +02:00
parent 98219ecfef
commit 279c5fbbbe
2270 changed files with 6269477 additions and 182 deletions

View File

@@ -0,0 +1,33 @@
using UnityEngine;
using System.Collections;
namespace MagicArsenal {
public class MagicLoopScript : MonoBehaviour {
public GameObject chosenEffect;
public float loopTimeLimit = 2.0f;
void Start ()
{
PlayEffect();
}
public void PlayEffect()
{
StartCoroutine("EffectLoop");
}
IEnumerator EffectLoop()
{
GameObject effectPlayer = (GameObject) Instantiate(chosenEffect, transform.position, transform.rotation);
yield return new WaitForSeconds(loopTimeLimit);
Destroy (effectPlayer);
PlayEffect();
}
}
}