Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Player : MonoBehaviour {
- public GameObject PlyObj;
- public GameObject Bullet;
- public GameObject PlyGun;
- public Rigidbody2D PlyBody;
- public GameObject PlyCam;
- public float MoveThrust = 2f;
- public AudioClip AllahHuAkbar;
- public AudioClip Pew;
- public AudioSource AudioSrc;
- // For fucks sake unity!
- Vector3 MousePos;
- Rect cHairRect;
- void Start () {
- cHairRect = new Rect (0, 0, 0, 0);
- PlyGun = GameObject.FindGameObjectWithTag ("PewThing");
- PlyCam = GameObject.FindGameObjectWithTag ("MainCamera");
- }
- void Update () {
- // FUCKING CAMERA
- PlyCam.transform.position = new Vector3(this.gameObject.transform.position.x, PlyCam.transform.position.y, PlyCam.transform.position.z);
- // GUN REALISMZ
- PlyGun.transform.position = new Vector3 (PlyBody.transform.position.x + 0.128f, PlyBody.transform.position.y, 0f);
- //PlyGun.transform.LookAt(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0));
- // INPUT RAZIZZLE
- if (Input.GetKey (KeyCode.W)) {
- PlyObj.transform.Translate(Vector3.up * Time.deltaTime * MoveThrust * 4);
- }
- if (Input.GetKey (KeyCode.D)) {
- PlyObj.transform.Translate(Vector3.right * Time.deltaTime * MoveThrust);
- }
- if (Input.GetKey (KeyCode.A)) {
- PlyObj.transform.Translate(Vector3.left * Time.deltaTime * MoveThrust);
- }
- if (Input.GetKeyDown (KeyCode.Space)) {
- // ALLAH HU AKBAAAAR
- AudioSrc.PlayOneShot(AllahHuAkbar);
- }
- // PEW PEW PEW!
- if (Input.GetMouseButtonDown (0)) {
- Instantiate (Bullet);
- AudioSrc.PlayOneShot(Pew);
- Debug.Log ("Pew?");
- }
- // DONT YOU FUCKING TIP OVER ON ME!
- PlyBody.transform.rotation = new Quaternion(0, 0, 0, 0);
- // CROSSHAIR
- MousePos = Input.mousePosition;
- // Ehmm... wat?
- cHairRect = new Rect (MousePos.x, Screen.height - MousePos.y, 2, 2);
- }
- void OnGUI() {
- GUI.Box (cHairRect, "");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment