-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomInputManager.cs
More file actions
97 lines (79 loc) · 2.35 KB
/
CustomInputManager.cs
File metadata and controls
97 lines (79 loc) · 2.35 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using UnityEngine;
using System.Collections;
public class CustomInputManager : MonoBehaviour {
private float scroll;
private static CustomInputManager instance;
public static CustomInputManager Instance {
get {
if(instance == null) {
instance = GameObject.FindObjectOfType<CustomInputManager>();
}
return instance;
}
}
void Update () {
if(GameSettings.PlayerBC != null){
if(Input.GetButtonDown("interact")) {
GameSettings.Interact();
}
if(Input.GetButtonDown("feed")) {
GameSettings.PlayerBC.Feed();
}
if(Input.GetButtonDown("phone")) {
UIManager.TogglePhone();
}
if(Input.GetButtonDown("Fire1")) {
GameSettings.PlayerBC.activeWeapon.GetComponent<Weapon>().Attack();
}
if(Input.GetButtonDown("Fire2")) {
GameSettings.PlayerBC.UseCurrentPower();
}
if(Input.GetButtonDown("crouch")){
GameSettings.PlayerBC.Crouch();
}
if(Input.GetButtonDown("switchView")){
CameraManager.Instance.SwitchPersonCamera();
}
float moveSides = Input.GetAxis ("Horizontal");
float moveForward = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveForward, 0.0f, moveSides);
GameSettings.PlayerBC.SetMoveSpeed(movement);
scroll = Input.GetAxis("Mouse ScrollWheel");
if(scroll > 0.01f) {
GameSettings.PlayerBC.NextPower(true);
}
if(scroll < -0.01f){
GameSettings.PlayerBC.NextPower(false);
}
// if(playerChar.weapons.Count > 1){
// scroll = Input.GetAxis("Mouse ScrollWheel");
// if(scroll > 0.01f) {
// if(playerChar.currentWeapon < playerChar.weapons.Count-1) {
// playerChar.currentWeapon++;
// if(GameSettings.Instance.debugInput)
// Debug.Log("[IM] next weapon");
// } else {
// playerChar.currentWeapon = 0;
// }
// playerChar.SwitchWeapon();
// } else if(scroll < -0.01f) {
// if(playerChar.currentWeapon > 0) {
// playerChar.currentWeapon--;
// } else {
// playerChar.currentWeapon = playerChar.weapons.Count-1;
// }
// playerChar.SwitchWeapon();
// }
// }
}
}
// public static void EnableControls(bool on) {
// if(Instance.playerChar == null)
// Instance.playerChar = GameSettings.Instance.player.GetComponent<BaseCharacter>();
//
// GameSettings.PlayerBC.EnableControls();
// if(Instance.playerChar != null){
// Instance.playerChar.EnableControls(on);
// }
// }
}