일부 애니메이션이 포함 된 게임을 작성하고 사용자가 버튼을 클릭 할 때 해당 애니메이션을 사용합니다. 나는 사용자에게 애니메이션을 보여주고 싶습니다. Application.loadLevel로 새로운 레벨을 "그냥"호출하는 것이 아닙니다. onMouseUp 메서드에서 Time.DeltaTime을 사용하여 미리 정의 된 0f 값에 추가 한 다음 (예 : 1f)보다 큰지 확인하지만 onMouseUp 메서드가 "그것이 자신의 시간 "을 델타 시간으로 간주합니다.OnMouseUp 이벤트를 수행하기 전에 몇 초 동안 기다리는 방법
내 스크립트는이 지금과 같은 : 당신의 onMouseUp에에 Time.deltaTime을 사용하여 일을하려고 무엇을
public class ClickScriptAnim : MonoBehaviour {
public Sprite pressedBtn;
public Sprite btn;
public GameObject target;
public string message;
public Transform mesh;
private bool inAnim = true;
private Animator animator;
private float inGameTime = 0f;
// Use this for initialization
void Start() {
animator = mesh.GetComponent<Animator>();
}
// Update is called once per frame
void Update() {
}
void OnMouseDown() {
animator.SetBool("callAnim", true);
}
void OnMouseUp() {
animator.SetBool("callAnim", false);
animator.SetBool("callGoAway", true);
float animTime = Time.deltaTime;
Debug.Log(inGameTime.ToString());
// I would like to put here something to wait some seconds
target.SendMessage(message, SendMessageOptions.RequireReceiver);
}
}
}
Thread.Sleep (1000)은 잠시 기다려야 할 것입니다.이 줄을 따라 무엇인가 찾고 있습니까? – Bayeni
잠시 기다려 봤던 코드는 어디에 있습니까? – Reniuz
필자가 작성한 것처럼 onMameUp() 메서드에 inGameTime + = Time.deltaTime을 넣으려고했으나 OnMouseUp 메서드가 최소 deltaTime을 반환하기 때문에 의도 한대로 작동하지 않습니다. – Zwiebel