Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityCoder.Utils;
- namespace GameOver.HouseEditor
- {
- public enum ETypeInput
- {
- Mouse,
- Keyboard,
- GamePad
- }
- public class InputManager : Singleton<InputManager>
- {
- private delegate float InputHandler();
- private InputHandler _horizontal;
- private InputHandler _vertical;
- private InputHandler _zoom;
- private ETypeInput _typeInput;
- public ETypeInput TypeInput
- {
- get { return _typeInput; }
- set {SetTypeInput(value);}
- }
- public float Horizontal()
- {
- return _horizontal();
- }
- public float Vertical()
- {
- return _vertical();
- }
- public float Zoom()
- {
- return _zoom();
- }
- private void Start()
- {
- SetTypeInput(ETypeInput.Mouse);
- }
- private void SetTypeInput(ETypeInput typeInput)
- {
- _typeInput = typeInput;
- switch(_typeInput)
- {
- case ETypeInput.Keyboard:
- break;
- case ETypeInput.Mouse:
- _horizontal = HorizontalMouse;
- _vertical = VerticalMouse;
- _zoom = ZoomMouse;
- break;
- case ETypeInput.GamePad:
- break;
- }
- }
- private float HorizontalMouse()
- {
- return Input.GetAxisRaw("Mouse X");
- }
- private float VerticalMouse()
- {
- return Input.GetAxisRaw("Mouse Y");
- }
- private float ZoomMouse()
- {
- return Input.GetAxisRaw("Horizontal");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement