|
|
@ -41,15 +41,15 @@ public class magnetGun : MonoBehaviour { |
|
|
|
private Color lastTargetColour; |
|
|
|
|
|
|
|
|
|
|
|
public GameObject magnetTipObject; |
|
|
|
|
|
|
|
|
|
|
|
//-----------------------
|
|
|
|
// Use PlayerSound script
|
|
|
|
// (specifically for object-rotation sounds for this MagnetGun script)
|
|
|
|
public PlayerSounds _playerSoundScript; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Use this for initialization
|
|
|
|
void Start () { |
|
|
|
if (topScreen) |
|
|
@ -114,7 +114,6 @@ public class magnetGun : MonoBehaviour { |
|
|
|
cameraRotateTest (GravityTarget); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -144,6 +143,8 @@ public class magnetGun : MonoBehaviour { |
|
|
|
private void pickUpItem(Collider item){ |
|
|
|
if (item != null) { |
|
|
|
|
|
|
|
_playerSoundScript.PlayPickUp(); |
|
|
|
|
|
|
|
if (item == otherPlayer.GravityTarget){ |
|
|
|
otherPlayer.dropItem(item); |
|
|
|
} |
|
|
@ -225,6 +226,7 @@ public class magnetGun : MonoBehaviour { |
|
|
|
|
|
|
|
if ((Vector3.Distance (gravityWell.transform.position, camera.transform.position) > minDistance && Vector3.Distance (gravityWell.transform.position, camera.transform.position) < magnetRange) || maxPullSpeed<1) { |
|
|
|
gravityWell.transform.position = Vector3.MoveTowards (gravityWell.transform.position, maxPull, step); |
|
|
|
//MagnetLaserShoot();
|
|
|
|
|
|
|
|
if ((Vector3.Distance (gravityWell.transform.position, camera.transform.position) > magnetRange) && !topScreen) |
|
|
|
dropItem (GravityTarget); |
|
|
@ -235,9 +237,11 @@ public class magnetGun : MonoBehaviour { |
|
|
|
private void rotateInput(Collider item){ |
|
|
|
if (item != null) { |
|
|
|
if (Input.GetButtonDown(L_BUTTON_INPUT)) |
|
|
|
//_playerSoundScript.PlayRotateL(); // Rotate-Object Sound. ERROR: Held object continuously rotates
|
|
|
|
StartCoroutine (rotateItem(item,new Vector3 (0,90,0),0.3f)); |
|
|
|
// _playerSoundScript.PlayRotate(); // Rotate-Object Sound. ERROR: Causes multiple sounds when object is held.
|
|
|
|
|
|
|
|
if (Input.GetButtonDown(R_BUTTON_INPUT)) |
|
|
|
//_playerSoundScript.PlayRotateR(); // Rotate-Object Sound. ERROR: Held object continuously rotates
|
|
|
|
StartCoroutine (rotateItem(item,new Vector3 (90,0,0),0.3f)); |
|
|
|
} |
|
|
|
} |
|
|
@ -309,5 +313,20 @@ public class magnetGun : MonoBehaviour { |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// FUNCTION: Shoot Magnet Ray
|
|
|
|
// void MagnetLaserShoot(){
|
|
|
|
// RaycastHit hit;
|
|
|
|
//
|
|
|
|
// if(Physics.Raycast(magnetTipObject.transform.position, magnetTipObject.transform.forward, out hit)){
|
|
|
|
// if(hit.collider.tag == "moveable"){
|
|
|
|
// Debug.Log("Magnet laser has collided" + hit.collider.gameObject.name);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |