using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class SpiritJitter : MonoBehaviour {
|
|
|
|
Vector3 Target = new Vector3(0.0f, 0.0f, 0.0f);
|
|
public float distance = 1.0f;
|
|
public float time = 0.5f;
|
|
|
|
private void Start()
|
|
{
|
|
StartCoroutine("Jitter");
|
|
}
|
|
|
|
IEnumerator Jitter()
|
|
{
|
|
bool jittering = true;
|
|
while (jittering)
|
|
{
|
|
transform.localPosition = Target;
|
|
|
|
float randX = Random.Range(-1 * distance, distance);
|
|
float randY = Random.Range(-1 * distance, distance);
|
|
float randZ = Random.Range(-1 * distance, distance);
|
|
|
|
Target = new Vector3(randX, randY, randZ);
|
|
yield return new WaitForSeconds(time);
|
|
}
|
|
}
|
|
}
|