-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathS_31072012_ShooterControls_Camera_KBM.cs
105 lines (77 loc) · 2.79 KB
/
S_31072012_ShooterControls_Camera_KBM.cs
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
98
99
100
101
102
103
104
105
//---------------------------------------------
// Dan Welsh - 2012
// Danveria Acrade Control scrpts
// Shooter - Camera ver 0.02
//---------------------------------------------
using UnityEngine;
using System.Collections;
public class S_31072012_ShooterControls_Camera_KBM : MonoBehaviour
{
#region DataStore
#endregion
#region States
enum State
{
Adventure,
Aiming,
AimDownScope
}
private State state = State.Adventure;
#endregion
#region Functions
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
//We need to set a default camera position
//we will need to talk to the camera position and set it to this deafult
//position
//here we will set camera controls that will be used for the demo
//these may well need to made into on/off style switches
//As this is a 3 way switch we will need to check what state the camera is in
//and if it is already in the Aiming State then we will need move the camera to
//its default psoition/state
//move camera to and back from aiming position - will default to right hand stance
if (Input.GetKeyDown("mouse 1"))
{
//logic check to see where camera should be
Debug.Log("Camera should be in Aiming state");
//move camera Aiming location
transform.Translate(1.5f, -0.75f, 4.5f);
//we now need to change the cameras state to Aiming
state = State.Aiming;
}
if (Input.GetKeyUp("mouse 1"))
{
//logic check to see where camera should be
Debug.Log("Camera should be out of Aiming state");
//move camera Aiming location
transform.Translate(-1.5f, 0.75f, -4.5f);
//we now need to change the cameras state to Aiming
state = State.Adventure;
}
//Ads
if (Input.GetKeyDown("left shift"))
{
//logic check to see where camera should be
Debug.Log("Camera should be in ADS state");
//move camera to the ADS
transform.Translate(0.0f, -0.7f, 7.5f);
//we now need to change the cameras state to ADS
state = State.AimDownScope;
}
if (Input.GetKeyUp("left shift"))
{
//logic check to see where camera should be
Debug.Log("Camera should be out of ADS state");
//move camera to the ADS
transform.Translate(0.0f, 0.7f, -7.5f);
//we now need to change the cameras state to ADS
state = State.AimDownScope;
}
}
#endregion
}