Advertisement
Guest User

BasicNavigation

a guest
May 6th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. using System.Collections;
  2.  
  3. public class Navigator : MonoBehaviour {
  4.  
  5.     void Start () {
  6.     }
  7.    
  8.     void Update () {
  9.  
  10.         if(Input.GetKeyDown(KeyCode.W)){    
  11.             transform.Translate(new Vector3(0,1,0));
  12.         }
  13.         if(Input.GetKeyDown(KeyCode.S)){    
  14.             transform.Translate(new Vector3(0,-1,0));
  15.         }
  16.         if(Input.GetKeyDown(KeyCode.A)){    
  17.             transform.Translate(new Vector3(-1,0,0));
  18.         }
  19.         if(Input.GetKeyDown(KeyCode.D)){    
  20.             transform.Translate(new Vector3(1,0,0));
  21.         }
  22.  
  23.     }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement