반응형
코드 작성
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Example : MonoBehaviour
{
public float shakeAmount = 3.0f;
public float shakeTime = 1.0f;
private void Start()
{
StartCoroutine(Shake(shakeAmount, shakeTime));
}
IEnumerator Shake(float ShakeAmount, float ShakeTime)
{
float timer = 0;
while (timer <= ShakeTime)
{
Camera.main.transform.position =
(Vector3)UnityEngine.Random.insideUnitCircle * ShakeAmount;
timer += Time.deltaTime;
yield return null;
}
Camera.main.transform.position = new Vector3(0f, 0f, 0f);
}
}
참고할만한 글
반응형