/// <summary> /// エントリー終了の操作 /// </summary> private void EFinishInput() { //登録し終わったプレイヤーを取得 var player = data.Where(it => it.registState == RegistState.End).ToArray(); //参加プレイヤー全員が準備を完了していなければ処理しない if (!player.All(it => it.registState == RegistState.End)) { return; } foreach (var it in player) { var input = MyInputManager.GetController(it.index); //キャラ選択に戻る if (input.B) { int index = (int)it.index - 1; it.registState = RegistState.Select; int modelNo = DataBase.GetPrefabID(it.id); EntryTextManager.Instance.StartCloseAndOpenVertical(index); EntryTextManager.Instance.SetSelectCharacterText(index); EntryTextManager.Instance.SetCharacterArrowActive(index, true); EntryTextManager.Instance.StartArrowCursol(index); ViewerManager.Instance.Create(it.index, modelNo); ViewerManager.Instance.SetRotationFlags(index, true); continue; } } }
private void Start() { PracticalPlayers = DebugModeGame.GetProperty().m_debugMode ? DebugModeGame.GetProperty().m_debugPlayerNum : MaxPlayers; GameObject ParentCursor = GameObject.Find("Cursors(Clone)"); for (int i = 0; i < MaxPlayers; i++) { if (i < PracticalPlayers) { targetCursor[i] = ParentCursor.transform.GetChild(i).GetComponent <Cursor>(); } else { ParentCursor.transform.GetChild(i).gameObject.SetActive(false); } } gameController = GameObject.FindObjectOfType <GameController>(); if (gameController == null) { Debug.LogError("Gamecontrollerがシーンにありません"); } myInputManager = GameObject.FindObjectOfType <MyInputManager>(); if (myInputManager == null) { Debug.LogError("MyInputManagerがシーンにありません"); } g_UI = GameObject.Find("GameUI"); _slider_Background = g_UI.transform.GetChild(0).transform.GetChild(3).transform.GetChild(0).gameObject; _slider_Fillarea = g_UI.transform.GetChild(0).transform.GetChild(3).transform.GetChild(1).gameObject; timer = GameObject.FindObjectOfType <StartTimer>(); }
/// <summary> /// 入力待ち処理 /// </summary> void WaitForInput() { //入力待ちプレイヤーを取得 var players = data.Where(it => it.state == State.Wait).ToArray(); foreach (var it in players) { if (it.id == PlayerManager.NOT_ENTRY) { continue; } int index = DataBase.GetControllerID(it.id) - 1; GamePad.Index gamePadIndex = (GamePad.Index)(index + 1); var input = MyInputManager.GetController(gamePadIndex); //入力終了の瞬間 if (input.START) { data[index].state = State.End; ResultTextManager.Instance.StartCloseAndOpenVertical(index); ResultTextManager.Instance.SetFinishedText(index); //効果音 SoundManager.Instance.PlayOnSE("Inputed"); } } }
// Update is called once per frame void Update() { if (tvButton.selected && MyInputManager.TriggerButtonPressed(tvButton.handIndicator)) { if (forward) { if (i >= materials.Length) { i = 0; } ChangePaint(materials[i++]); } else { if (i < 0) { i = materials.Length - 1; } ChangePaint(materials[i--]); } } else { calledBefore = false; } if (Vector3.Distance(cam.transform.position, MyInputManager.leftHandController.position) > 5) { cam.enabled = false; } else { cam.enabled = true; } }
/// <summary> /// 遊ぶのを止める /// </summary> private void PlayingCancel() { //非参加プレイヤーの取得 var player = data.Where(it => it.registState == RegistState.Entry).ToArray(); bool isInput = false; //Bボタンが押されているか判定 foreach (var it in player) { var input = MyInputManager.GetController(it.index); if (input.B_Hold) { isInput = true; break; } } //非参加プレイヤーの誰かがBボタンを長押ししている if (isInput) { RiseReturnValue(); } //誰も長押ししていない else { FallReturnValue(); } //蓄積値をUIのFill値としてセット ReturnTitleUI.Instance.SetFillAmountValue(returnValue); }
// Update is called once per frame void Update() { if (_tvButton.selected && MyInputManager.TriggerButtonPressed(_tvButton.handIndicator) && !isSelected) { isSelected = true; if (!isEnter && !isUndo && screenText.text.Length < 4) { screenText.text += value; } if (isEnter && !isUndo && vipArea) { vipArea.allowAccess(screenText.text, true); } if (!isEnter && isUndo && screenText.text.Length > 0) { screenText.text = screenText.text.Remove(screenText.text.Length - 1); } } if (!_tvButton.selected && isSelected) { isSelected = false; } }
void Update() { if (MyInputManager.GetButtonDown(MyInputManager.Button.Start)) { ChangeScene(); } }
// Update is called once per frame void Update() { leftHandControllerPosition = MyInputManager.leftHandController.position; rightHandControllerPosition = MyInputManager.rightHandController.position; if (MyInputManager.TriggerValue('r') > 0 && col.bounds.Contains(rightHandControllerPosition)) { transform.position = spline.WhereOnSpline(rightHandControllerPosition); outline.enabled = true; } else { outline.enabled = false; } for (int i = 0; i < transform.childCount; i++) { if (i == NearestToken()) { transform.GetChild(i).gameObject.SetActive(true); } else { transform.GetChild(i).gameObject.SetActive(false); } } }
void Update() { if (stateController.CurrentState == PlayerState.Dead) { return; } leftStick = MyInputManager.GetAxis(MyInputManager.Axis.LeftStick); movement.x = leftStick.x; //movement.z = leftStick.y; movement.y = 0.0f; //todo:z軸に勝手に移動? movement.z = 1.0f; movement *= moveSpeed * Time.deltaTime; //ジャンプ if (MyInputManager.GetButtonDown(MyInputManager.Button.A)) { if (stateController.CurrentState == PlayerState.OnGround) { ActionJump(); } } switch (stateController.CurrentState) { case PlayerState.Jump: movement *= 0.4f; inerVec *= 1.01f; m_body.velocity += inerVec * Time.deltaTime; if (m_transform.position.y - oldPosition.y < 0) { stateController.CurrentState = PlayerState.Fall; } break; case PlayerState.Fall: movement *= 0.4f; inerVec *= 1.01f; m_body.velocity += inerVec * Time.deltaTime; if (IsNearGround()) { AkSoundEngine.PostEvent("Footsteps", gameObject); m_animator.SetTrigger("Landing"); stateController.CurrentState = PlayerState.Land; } break; case PlayerState.Land: movement *= 0.8f; KKUtilities.Delay(landingTime, () => stateController.CurrentState = PlayerState.OnGround, this); break; } oldPosition = m_transform.position; }
// Use this for initialization void Start() { MyInput = FindObjectOfType <MyInputManager>(); for (int i = 0; i < 6; i++) { PlayerReadys[i] = false; } }
public static GamepadState GetState(Index controlIndex, bool raw = false) { state.LeftStickAxis = MyInputManager.GetAxis(MyInputManager.Axis.LeftStick, controlIndex); state.rightStickAxis = MyInputManager.GetAxis(MyInputManager.Axis.RightStick, controlIndex); state.LeftTrigger = MyInputManager.GetTrigger(MyInputManager.Trigger.LeftTrigger, controlIndex); state.RightTrigger = MyInputManager.GetTrigger(MyInputManager.Trigger.RightTrigger, controlIndex); return(state); }
void Update() { totalTime += Time.deltaTime; timeText.Second = (int)totalTime; //リザルトを完成させるまでは残しておく if (MyInputManager.GetButtonDown(MyInputManager.Button.Start)) { GameOver(false); } }
// Update is called once per frame void Update() { if (tvButton.selected && MyInputManager.TriggerButtonPressed(tvButton.handIndicator)) { ApplyPaint(currentMat); } if (!tvButton.selected || !MyInputManager.TriggerButtonPressed(tvButton.handIndicator)) { calledBefore = false; } }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(this.gameObject); } DontDestroyOnLoad(this.gameObject); }
// Update is called once per frame void Update() { if (_tvButton.selected && !fastForwarding && MyInputManager.TriggerButtonPressed('l')) { fastForwarding = true; _vp.playbackSpeed = 10; } if (!_tvButton.selected && fastForwarding) { fastForwarding = false; _vp.playbackSpeed = 1; } }
//private bool SlopeXFlg; //private bool SlopeYFlg; void Start() { pos = transform.position; //CenterPos = pos; fireflg = true; //SlopeXFlg = false; //SlopeYFlg = false; myInputManager = GameObject.FindObjectOfType <MyInputManager>(); if (myInputManager == null) { Debug.LogError("MyInputManagerがシーンにありません"); } }
// Use this for initialization void Start() { this.myRigidbody = this.GetComponent <Rigidbody2D>(); this.myCollider = this.GetComponent <CircleCollider2D>(); this.myInputManager = this.GetComponent <MyInputManager>(); this.nextVelocity = Vector2.zero; this.canSlice = true; this.holdingSlice = false; this.canJump = false; Slicer.theSlicer = this; }
// Use this for initialization void Start() { MyInput = FindObjectOfType <MyInputManager>(); InputName[0] = "Horizontal_Player"; InputName[1] = "Vertical_Player"; InputName[2] = "A_Player"; InputName[3] = "B_Player"; InputName[4] = "X_Player"; InputName[5] = "Y_Player"; InputName[6] = "ST_Player"; for (int i = 0; i < 6; i++) { PlayerReadys[i] = false; } }
void Update() { if (!showResult) { return; } if (MyInputManager.GetButtonDown(MyInputManager.Button.Start)) { if (isTransition) { return; } isTransition = true; LoadSceneManager.I.LoadScene(nextSceneName, true, 1.0f, 0.3f); } }
protected override void Update() { velocity.x = MyInputManager.GetAxis(MyInputManager.Axis.LeftStick).x; anim.SetFloat("MoveSpeed", Mathf.Abs(velocity.x)); cameraObj.transform.position = (transform.position - (Vector3.forward * cameraDistance)) + (Vector3.up); if (MyInputManager.GetButtonDown(MyInputManager.Button.A)) { if (currentState == CharacterState.Grounding || currentState == CharacterState.Landing) { ActionJump(); } } }
// Update is called once per frame void Update() { if (MyInputManager.TriggerButtonPressed('l')) { if (_tvButton.selected && !muteToggle) { muteToggle = true; _vp.SetDirectAudioMute(0, muted = !muted); } if (!_tvButton.selected && muteToggle) { muteToggle = false; } } }
/// <summary> /// 参加プレイヤーのエントリー /// </summary> private void Entry() { //非参加プレイヤーの取得 var player = data.Where(it => it.registState == RegistState.Entry).ToArray(); //非参加プレイヤーに対して入力を受け付ける foreach (var it in player) { //入力 var input = MyInputManager.GetController(it.index); //プレイヤー番号 int index = (int)it.index - 1; //登録時処理 if (input.START) { //テキスト変更 EntryTextManager.Instance.StartCloseAndOpenVertical(index); EntryTextManager.Instance.SetSelectCharacterText(index); //初期化 int id_i = (int)data[index].index * DataBase.ID_INDEX; //コントローラー番号 int id_m = (int)DataBase.MODEL.UTC_S * DataBase.ID_PREFAB; //モデル番号(初期はUTC_S) int id_c = (int)data[index].index * DataBase.ID_COLOR - 1; //色番号(初期はコントローラー番号に応じた色が設定) //ID決定 it.id = id_i + id_m + id_c; //矢印 EntryTextManager.Instance.SetCharacterArrowActive(index, true); EntryTextManager.Instance.StartArrowCursol(index); //一番最初のモデルビュー(UTC_S) int iModel = (int)DataBase.MODEL.UTC_S; ViewerManager.Instance.Create(it.index, iModel); //登録状況の更新 it.registState = RegistState.Select; //効果音 int channel = index + 1;//AudioSourceのインデックスを算出 SoundManager.Instance.Play("entry", channel); } } }
void FixedUpdate() { activated = MyInputManager.InRange(transform.position, 2) != '0'; offset = mat.mainTextureOffset; if (activated && offset.y >= 0) { offset = Vector2.Lerp(offset, new Vector2(0, 0), speed); } if (!activated && offset.y <= 0.5f) { offset = Vector2.Lerp(offset, new Vector2(0, 0.5f), speed); } mat.mainTextureOffset = offset; }
void Update() { if (transform.localPosition.x > 3 || transform.localPosition.y > 3 || transform.localPosition.z > 3 || transform.localPosition.x < -3 || transform.localPosition.y < -3 || transform.localPosition.z < -3) { transform.localPosition = Vector3.up; } var position = new Vector3(transform.position.x - 7.829586f, transform.position.y - 0.9757428f, transform.position.z + 3.546846f); //var position = transform.parent.localPosition; target.localPosition = new Vector3(position.x * 3 * 1.7f, position.y * 1.7f, -position.z * 3 * 1.7f); target.localEulerAngles = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z); handIndicator = MyInputManager.InRange(transform.position, 0.5f); if (handIndicator != '0') { if (!isGrabbed) { outline.enabled = true; } if (MyInputManager.GripValue(handIndicator) > 0 && !isGrabbed) { isGrabbed = true; outline.enabled = false; } if (MyInputManager.GripValue(handIndicator) > 0 && !isGrabbed) { isGrabbed = true; outline.enabled = false; } MoveClaws(MyInputManager.TriggerValue(handIndicator)); if (isGrabbed && MyInputManager.GripValue(handIndicator) <= 0) { isGrabbed = false; } } }
/// <summary> /// 更新 /// </summary> public void PlayerUpdate() { //コントローラー gamePad = MyInputManager.GetController(useControllerIndex); //攻撃 //Attack(); AttackTrgOn(); AttackUpdate(); //回転 Turn(); //移動 Move(); }
private void Update() { if (!DeviceLeft.isValid) { GetLeftDevice(); } if (!DeviceRight.isValid) { GetRightDevice(); } #if UNITY_ANDROID //Debug.Log("on android platform"); #endif #if !UNITY_ANDROID //Debug.Log("not on Android Platform"); #endif if (MyInputManager.GripValue('l') > 0) { for (int i = 0; i < leftDescriptions.Length; i++) { leftDescriptions[i].enabled = true; } for (int i = 0; i < rightDescriptions.Length; i++) { rightDescriptions[i].enabled = true; } } else { for (int i = 0; i < leftDescriptions.Length; i++) { leftDescriptions[i].enabled = false; } for (int i = 0; i < rightDescriptions.Length; i++) { rightDescriptions[i].enabled = false; } } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); MyInputManager myInputManager = target as MyInputManager; myInputManager.device = (MyInputManager.InputDevice)EditorGUILayout.EnumPopup(new GUIContent("InputDevice", "入力デバイスの種類"), myInputManager.device); /************************************************/ /* Popupでデバイスに対応した設定項目を表示する */ /************************************************/ switch (myInputManager.device) { //GamePadのプロパティ設定 case MyInputManager.InputDevice.GamePad: { myInputManager.gamePad_gravity = EditorGUILayout.FloatField(new GUIContent("Gravity", "入力(押したキー) がニュートラルに戻る速さ。"), myInputManager.gamePad_gravity); myInputManager.gamePad_dead = EditorGUILayout.FloatField(new GUIContent("Dead", "指定した数値未満の正や負の値は 0 として認識されます。"), myInputManager.gamePad_dead); myInputManager.gamePad_sensitivity = EditorGUILayout.FloatField(new GUIContent("Sensitivity", "キーボード入力の場合、この値を大きくすると、応答時間が速くなります。値が低いと、より滑らかになります。マウス移動の場合、この値によって実際のマウスの移動差分が拡大縮小されます。"), myInputManager.gamePad_sensitivity); myInputManager.joyStickX_invert = EditorGUILayout.Toggle(new GUIContent("Invert_X", "ジョイスティックの左右の逆転"), myInputManager.joyStickX_invert); myInputManager.joyStickY_invert = EditorGUILayout.Toggle(new GUIContent("Invert_Y", "ジョイスティックの上下の逆転"), myInputManager.joyStickY_invert); if (GUILayout.Button("Setting on GamePad")) { Debug.Log("InputManagerの設定をゲームパッド用に編集しました"); InputManagerSetter.ims.Clear(); GamePadProperty.PropertySet( myInputManager.gamePad_gravity, myInputManager.gamePad_dead, myInputManager.gamePad_sensitivity, myInputManager.joyStickX_invert, myInputManager.joyStickY_invert ); } break; } //Keyboardのプロパティ設定 case MyInputManager.InputDevice.Keyboard: { break; } } }
// Update is called once per frame void Update() { if (_tvButton.selected) { //Debug.Log("here"); if (MyInputManager.TriggerButtonPressed(_tvButton.handIndicator)) { if (isPlaying) { vp.Pause(); isPlaying = false; } else { vp.Play(); isPlaying = true; } StartCoroutine(WaitForMilliseconds(500)); } } }
// Update is called once per frame void Update() { handIndicator = MyInputManager.HoveredByRayInteractor(_col); if (handIndicator != '0') { _outline.enabled = true; _selected = true; if (MyInputManager.TriggerValue(handIndicator) <= 0) { _triggerPressed = false; } Debug.Log(!_triggerPressed + "," + (MyInputManager.TriggerValue(handIndicator) > 0) + "," + _selected); if (!_triggerPressed && (MyInputManager.TriggerValue(handIndicator) > 0) && _selected) { _triggerPressed = true; if (!_rotated) { _animator.Play(closeAnim); _rotated = true; } if (_rotated) { _animator.Play(openAnim); _rotated = false; } } } else { _outline.enabled = false; _selected = false; } }
/// <summary> /// 登録のキャンセル処理 /// </summary> /// <param name="index"></param> /// <param name="data"></param> private void EntryCancel(GamePad.Index index, EntryData data) { var input = MyInputManager.GetController(index); //参加登録をキャンセル if (input.B) { int textIndex = (int)index - 1; data.registState = RegistState.Entry; EntryTextManager.Instance.StartCloseAndOpenVertical(textIndex); EntryTextManager.Instance.SetWaitText(textIndex); ViewerManager.Instance.Destroy(index); EntryTextManager.Instance.SetCharacterName(textIndex, PlayerManager.NOT_ENTRY); EntryTextManager.Instance.SetCharacterArrowActive(textIndex, false); //効果音 int chanel = (int)index; SoundManager.Instance.Play("entryCancel", chanel); } }