Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class HarborDockingPlayerScript : MonoBehaviour {
  7.  
  8. public GameObject myBoat;
  9. public GameObject myPlayer;
  10. public GameObject myPlayerCamera;
  11. public GameObject myBoatCamera;
  12. public GameObject harborTrigger;
  13. public Button myDockButton;
  14. public Button myTakeOffButton;
  15.  
  16. public bool isDocked = false;
  17.  
  18. // Use this for initialization
  19. void Start () {
  20.  
  21.  
  22.  
  23. }
  24.  
  25. public void isDockedFunc(bool aDocking)
  26. {
  27. isDocked = true;
  28. }
  29.  
  30. public void isDockedFunc2(bool ass)
  31. {
  32. isDocked = false;
  33. }
  34.  
  35. // Update is called once per frame
  36. void Update () {
  37. Camera cam = myBoatCamera.GetComponent<Camera>();
  38. Camera playerCam = myPlayerCamera.GetComponent<Camera>();
  39.  
  40. if (isDocked == false)
  41. {
  42. GameObject.Find("Boat").GetComponent<BoatScript>().enabled = true;
  43. GameObject.Find("Player").SetActive(false);
  44. myBoat.transform.FindChild("MainCamera").gameObject.SetActive(true);
  45. myPlayer.transform.FindChild("MainCamera").gameObject.SetActive(false);
  46. cam.enabled = true;
  47. playerCam.enabled = false;
  48. }
  49. else if (isDocked == true)
  50. {
  51. GameObject.Find("Boat").GetComponent<BoatScript>().enabled = false;
  52. GameObject.Find("Player").SetActive(true);
  53. myBoat.transform.FindChild("MainCamera").gameObject.SetActive(false);
  54. myPlayer.transform.FindChild("MainCamera").gameObject.SetActive(true);
  55. cam.enabled = false;
  56. playerCam.enabled = true;
  57. }
  58.  
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement