Quantcast
Viewing all articles
Browse latest Browse all 16

can someone tell me what is wrong with my build?

I'm not sure what it is saying in these two lines, can someone please help it's apparently game breaking but it shows no errors before i build it or in any of the scripts![alt text][1] [1]: /storage/temp/25890-wtf.png here is the script using UnityEngine; using System.Collections; public class MoveBobbyPin : MonoBehaviour { #region Editor Variables public LockPickManager LockPickManager = null; public bool EnableInput = false; public bool EnableUpInput = true; public bool EnableDownInput = true; public bool EnableLeftInput = true; public bool EnableRightInput = true; public float PinMovementSpeed = 1.0f; public float VertPinSpeedMultiplier = 1.0f; public float HorizontalPinSpeedMultiplier = 1.0f; public AudioClip PinContactSound = null; public AudioClip LockPickContactSound = null; private Vector3 OriginalPosition = Vector3.zero; #endregion #region Public Methods public void Start() { OriginalPosition = transform.position; } public void Update() { if(Input.GetKeyDown(KeyCode.E) && LockPickManager.LockPickCompleted == true) { ResetBobbyPinPosition(); } else if(Input.GetKeyDown(KeyCode.E) && LockPickManager.LockPickCompleted == false) { ResetBobbyPinPosition(); } CheckToSeeIfGameHasStarted (); if(EnableInput == true) { if(Input.GetKey("up") && EnableUpInput == true) { transform.Translate(Vector3.up * (PinMovementSpeed * VertPinSpeedMultiplier) * Time.deltaTime); } if(Input.GetKey("down") && EnableDownInput == true) { transform.Translate(Vector3.down * (PinMovementSpeed * VertPinSpeedMultiplier) * Time.deltaTime); } if(Input.GetKey("left") && EnableLeftInput == true) { transform.Translate(Vector3.left * (PinMovementSpeed * HorizontalPinSpeedMultiplier) * Time.deltaTime); } if(Input.GetKey("right") && EnableRightInput == true) { transform.Translate(Vector3.right * (PinMovementSpeed * HorizontalPinSpeedMultiplier) * Time.deltaTime); } } } public void OnCollisionEnter(Collision collidingObject) { if(collidingObject.gameObject.tag == "KeySection" && PinContactSound != null) { audio.Stop(); audio.clip = PinContactSound; audio.loop = false; audio.Play(); } } #endregion #region Private Methods private void ResetBobbyPinPosition() { transform.position = OriginalPosition; } private void CheckToSeeIfGameHasStarted() { if(LockPickManager.LockPickGameActive == true && LockPickManager != null) { EnableInput = true; } else if(LockPickManager.LockPickGameActive == false && LockPickManager != null) { EnableInput = false; } } #endregion }

Viewing all articles
Browse latest Browse all 16

Trending Articles