-
Notifications
You must be signed in to change notification settings - Fork 0
/
Turret_Control.cs
34 lines (30 loc) · 842 Bytes
/
Turret_Control.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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Turret_Control : MonoBehaviour {
public int turnspeed = 30;
public GameObject head;
public GameObject cylinder;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKey(KeyCode.D))
{
cylinder.transform.Rotate(0,0,Time.deltaTime * turnspeed);
}
if (Input.GetKey(KeyCode.A))
{
cylinder.transform.Rotate(0, 0, -Time.deltaTime * turnspeed);
}
if (Input.GetKey(KeyCode.S))
{
head.transform.Rotate(0, -Time.deltaTime * turnspeed,0);
}
if (Input.GetKey(KeyCode.W))
{
head.transform.Rotate(0,Time.deltaTime * turnspeed, 0);
}
}
}