forked from nhathuy7996/ReUseScript_Unity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInputManager.cs
More file actions
34 lines (27 loc) · 758 Bytes
/
Copy pathInputManager.cs
File metadata and controls
34 lines (27 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class InputManager : Singleton<InputManager>
{
[SerializeField]
List<string> Pressed = new List<string>();
public float GetAxis(string name){
return Input.GetAxis(name);
}
public float GetAxisRaw(string name){
return Input.GetAxisRaw(name);
}
public bool GetAxisPressed(string name){
if(Pressed.IndexOf(name) >= 0){
if(Input.GetAxisRaw(name) == 0)
Pressed.Remove(name);
return false;
}
if(Input.GetAxisRaw(name) != 0){
Pressed.Add(name);
return true;
}else{
return false;
}
}
}