Created
March 8, 2017 18:13
-
-
Save uruskan/842816e67eccf90be65c14dcfd63afd8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment