PCでの入力を受け取る
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Zenject;
/// <summary>
/// PCでの入力を受け取る
/// </summary>
public class PronamaInput : MonoBehaviour, IDestroyable, IStageClear, IGameOver
{
[Inject] IInputRun iInputRun = null;
[Inject] IInputJump iInputJump = null;
private void Update ()
{
InputRun ();
InputJump ();
}
private void InputRun ()
=> iInputRun.OnInputRun ( Input.GetAxis ( "Horizontal" ) );
private void InputJump ()
{
if ( Input.GetButtonDown ( "Jump" ) || Input.GetButtonDown ( "Fire1" ) )
{
iInputJump.OnInputJump ();
}
}
public void OnStageClear () => DestroySelf ();
public void OnGameOver () => DestroySelf ();
public void DestroySelf () => Destroy ( this );
}