public void Run() { Engine.Initialize(nameof(Controller_Bundle), 640, 480, new EngineOption()); var keyboard = new KeyboardController<MyAction>(); // KeyboardControllerクラスを作成 keyboard.BindKey(Keys.Up, MyAction.Plus); // 方向キーの上を"Plus"アクションに対応付け keyboard.BindKey(Keys.Down, MyAction.Minus); // 方向キーの下を"Minus"アクションに対応付け // SteppingControllerクラスを作成 var stepping = new SteppingController<MyAction>(keyboard); // "Plus"アクションを30Fの間押しっぱなしにしたら、2フレーム間隔で連続入力するよう設定 stepping.EnableSteppingHold(MyAction.Plus, 30, 2); // "Minus"アクションを30Fの間押しっぱなしにしたら、2フレーム間隔で連続入力するよう設定 stepping.EnableSteppingHold(MyAction.Minus, 30, 2); // アクションによって増減する値を表示するオブジェクトを作成する。 var font = Engine.Graphics.CreateDynamicFont("", 24, new Color(255, 255, 255, 255), 0, new Color()); int count = 10; var numText = new TextObject2D(); numText.Position = new Vector2DF(0, 0); numText.Text = $"↑\n{count}\n↓"; numText.Font = font; Engine.AddObject2D(numText); // メインループ while(Engine.DoEvents()) { if (stepping.GetState(MyAction.Plus) == InputState.Push) { count++; } else if (stepping.GetState(MyAction.Minus) == InputState.Push) { count--; } numText.Text = $"↑\n{count}\n↓"; stepping.Update(); // コントローラーの処理を進める Engine.Update(); Recorder.TakeScreenShot(nameof(Controller_Bundle), 60); } Engine.Terminate(); }
void OnTriggerEnter(Collider other) { AnimationController anim = playerObject.GetComponent <AnimationController>(); if (other.gameObject.CompareTag("Bead")) { other.gameObject.SetActive(false); audioSource.PlayOneShot(pickSound, audioVolume); beadCount += 1; panelScript.CubeController(beadCount); } else if (other.gameObject.CompareTag("SendingPoint")) { isOver = true; panelScript.OnClearPanel(beadCount, elapsedTime, HistoryManager.Instance.GetUsedNumOfScript()); Debug.Log("clear"); } else if (other.gameObject.CompareTag("LeftCar") || other.gameObject.CompareTag("RightCar") || other.gameObject.CompareTag("Train")) { //Time.timeScale = 0.6f; StartCoroutine("DeadDirection"); isOver = true; anim.DeadAnim(); audioSource.PlayOneShot(deadSound, audioVolume); Debug.Log("Game Over by Car"); } else if (other.gameObject.CompareTag("Trap")) { //Time.timeScale = 0.6f; StartCoroutine("DeadDirection"); trap_triggerd = other.transform.parent.GetChild(1); other.gameObject.SetActive(false); trap_triggerd.gameObject.SetActive(true); isOver = true; anim.TrapDeadAnim(); audioSource.PlayOneShot(deadSound, audioVolume); Debug.Log("Game Over by Trap"); } else if (other.gameObject.CompareTag("GasiOn")) { //Time.timeScale = 0.6f; StartCoroutine("DeadDirection"); isOver = true; anim.DeadAnim(); audioSource.PlayOneShot(deadSound, audioVolume); Debug.Log("Game Over by Gasi"); } else if (other.gameObject.CompareTag("Stepping")) { stepScript = other.GetComponent <SteppingController>(); } else if (other.gameObject.CompareTag("Arrow")) { //Time.timeScale = 0.6f; StartCoroutine("DeadDirection"); isOver = true; anim.TrapDeadAnim(); audioSource.PlayOneShot(deadSound, audioVolume); Debug.Log("Game Over by Arrow"); } }