// Start is called before the first frame update void Start() { foreach (Transform child in transform) { if (child.TryGetComponent(out EventCollider eventcollider)) { _event = eventcollider; break; } } _move = gameObject.GetComponent <CharController>(); _action = GetComponent <CharAction>(); _state = CharState.NOMAL; _action.Play(); }
// イベントがあるか確認 void CheckAction() { // アイテムの選択 if (Input.GetAxis("ItemSelectKey") != 0) { ItemManager.Instans.SelectItem(); } // アイテムの使用 if (Input.GetButtonDown("Fire3")) { ItemManager.Instans.UseItem(); } if (Input.GetButtonDown("Fire2") || Input.GetKeyDown(KeyCode.M)) { _action.Play(); } // スペースキーでイベント開始 if (Input.GetButtonDown("Jump")) { // イベントがあるか確認しあればデータのセットをしtrueになる if (_event.CheckEvent()) { // アイテム取得のイベント以外はUIアイテムUIを非表示にする if (_event.Event.tag != "Item") { // アイテムUIを非表示にする if (_itemCircle != null) { if (_itemCircle.gameObject.activeSelf == true) { StartCoroutine(_itemCircle.InactiveAnim()); } } } // イベント中 _state = CharState.IVENT; } } }