blob: d32d67d765921cda965defbc41d93128362a51f9 (
plain)
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
|
using Rigging.Camera;
using Rigging.Data;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
namespace Rigging.Inputs
{
public class InputHandler : MonoBehaviour
{
public Vector3 inputMovementDirection;
public Vector3 lastInputDirection;
public bool allowStrafe = true;
private MovementDataHandler movementData;
public bool isSpringting = false;
private void Start()
{
movementData = GetComponentInChildren<MovementDataHandler>();
}
private void Update()
{
inputMovementDirection = Vector3.zero;
if (Input.GetKey(KeyCode.W))
{
inputMovementDirection += movementData.groundedForward;
}
if (Input.GetKey(KeyCode.S))
{
inputMovementDirection += movementData.groundedBack;
}
if (Input.GetKey(KeyCode.D) && allowStrafe)
{
inputMovementDirection += movementData.right;
}
if (Input.GetKey(KeyCode.A) && allowStrafe)
{
inputMovementDirection += movementData.left;
}
//if (Input.GetKey(KeyCode.LeftShift) && (!cameraMovement || !cameraMovement.ADS))
//{
// isSpringting = true;
//}
if (inputMovementDirection != Vector3.zero)
{
lastInputDirection = inputMovementDirection;
}
}
}
}
|