Unity2Dのゲームを作っています。
一つのアニメーション(cahara@came)が終わってから、
chara@errorとchara@standupを指定しているスクリプトを再生させたいの
ですが一つ目のアニメーションで止まってしまいます。
一つ目のアニメーションcahara@cameを再生しその後に
スクリプトで指定した1秒から7秒でクリックすれば成功(アニメーション再生chara@error)
そのほかは失敗。(アニメーション再生chara@standup)
という風にしたいです。
やり方がわかりません。
よろしくお願いします。
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Chara: MonoBehaviour { Animation anim; float timer; void Start () { anim = this.gameObject.GetComponent<Animation> (); } void Update () { timer += Time.deltaTime; if (Input.GetMouseButtonDown (0)) if (timer >= 1.0f && timer <= 7.0) { anim.Play ("chara@standup"); } else { anim.Play ("chara@Error"); } if (Input.GetMouseButtonDown (0)) if (timer >= 1.0f && timer <= 7.0) { FindObjectOfType<Score> ().AddPoint (10); } else { Debug.Log ("失敗"); } } }
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/01/25 09:50
2019/01/26 10:52