You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

214 lines
4.7 KiB

ADDED: + Script: PlayerSounds + Texture: Magnet Rods (Pull & Push) + GUI Image: Game Logo (not yet implemented in UI) + Unity Scene: Title Screen + SFX: Footsteps (sand), test beep, switch-player sound, wind ambience + BGM: Just Dessert (2nd Part) (This was cut from previous facebook mp3 upload) Purely for testing purposes. + Audio Source for wind ambience sounds CHANGED: > A duplicate of "Cycle Run" was made so that sound events can be keyframed into the running animation (FBX-animations were initially read-only) > Added "PlayFootstep" sound event to running animation. > Changed invisible wall positions near the starting point area > Slightly lowered the first concrete platform's position near the long metal beam and small crates > Slightly increased the height of the first fences > Added small bits of terrain hills to create "distant cliff illusion" > SceneController script now has connection with PlayerSound script to allow switch-player sound > MagnetGun script (Player 1) now has connection with PlayerSound script to allow object-rotation sound > Added an Audio Source to the Player 1 Avatar object. All player sounds are assigned to this component. NOTE: > Only Player 1 has some sounds. Player 2 will have sounds once Player 1 has 100% sounds. > Cutscene management will need to be discussed. Unsure whether single-scene camera changes are possible and easy to implement due to script structure. Having a cutscene in a seperate scene will be demanding, processor-wise, but can be done. > Still have not received updated movable object textures at this time. Way past its deadline. KNOWN ISSUES: - On my Gaming PC, playing the game for an extended amount of time can cause the frame rate to flacuate from 30 to 60fps at set intervals of approximatelly every 5sec. - The above issue can be mitigated via restarting your PC. FPS issues could possibly be caused by junk metadata build-up. - The above issue has also been found in week #8 playtest build.
9 years ago
ADDED: + Script: PlayerSounds + Texture: Magnet Rods (Pull & Push) + GUI Image: Game Logo (not yet implemented in UI) + Unity Scene: Title Screen + SFX: Footsteps (sand), test beep, switch-player sound, wind ambience + BGM: Just Dessert (2nd Part) (This was cut from previous facebook mp3 upload) Purely for testing purposes. + Audio Source for wind ambience sounds CHANGED: > A duplicate of "Cycle Run" was made so that sound events can be keyframed into the running animation (FBX-animations were initially read-only) > Added "PlayFootstep" sound event to running animation. > Changed invisible wall positions near the starting point area > Slightly lowered the first concrete platform's position near the long metal beam and small crates > Slightly increased the height of the first fences > Added small bits of terrain hills to create "distant cliff illusion" > SceneController script now has connection with PlayerSound script to allow switch-player sound > MagnetGun script (Player 1) now has connection with PlayerSound script to allow object-rotation sound > Added an Audio Source to the Player 1 Avatar object. All player sounds are assigned to this component. NOTE: > Only Player 1 has some sounds. Player 2 will have sounds once Player 1 has 100% sounds. > Cutscene management will need to be discussed. Unsure whether single-scene camera changes are possible and easy to implement due to script structure. Having a cutscene in a seperate scene will be demanding, processor-wise, but can be done. > Still have not received updated movable object textures at this time. Way past its deadline. KNOWN ISSUES: - On my Gaming PC, playing the game for an extended amount of time can cause the frame rate to flacuate from 30 to 60fps at set intervals of approximatelly every 5sec. - The above issue can be mitigated via restarting your PC. FPS issues could possibly be caused by junk metadata build-up. - The above issue has also been found in week #8 playtest build.
9 years ago
ADDED: + Script: PlayerSounds + Texture: Magnet Rods (Pull & Push) + GUI Image: Game Logo (not yet implemented in UI) + Unity Scene: Title Screen + SFX: Footsteps (sand), test beep, switch-player sound, wind ambience + BGM: Just Dessert (2nd Part) (This was cut from previous facebook mp3 upload) Purely for testing purposes. + Audio Source for wind ambience sounds CHANGED: > A duplicate of "Cycle Run" was made so that sound events can be keyframed into the running animation (FBX-animations were initially read-only) > Added "PlayFootstep" sound event to running animation. > Changed invisible wall positions near the starting point area > Slightly lowered the first concrete platform's position near the long metal beam and small crates > Slightly increased the height of the first fences > Added small bits of terrain hills to create "distant cliff illusion" > SceneController script now has connection with PlayerSound script to allow switch-player sound > MagnetGun script (Player 1) now has connection with PlayerSound script to allow object-rotation sound > Added an Audio Source to the Player 1 Avatar object. All player sounds are assigned to this component. NOTE: > Only Player 1 has some sounds. Player 2 will have sounds once Player 1 has 100% sounds. > Cutscene management will need to be discussed. Unsure whether single-scene camera changes are possible and easy to implement due to script structure. Having a cutscene in a seperate scene will be demanding, processor-wise, but can be done. > Still have not received updated movable object textures at this time. Way past its deadline. KNOWN ISSUES: - On my Gaming PC, playing the game for an extended amount of time can cause the frame rate to flacuate from 30 to 60fps at set intervals of approximatelly every 5sec. - The above issue can be mitigated via restarting your PC. FPS issues could possibly be caused by junk metadata build-up. - The above issue has also been found in week #8 playtest build.
9 years ago
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4. public class sceneController : MonoBehaviour {
  5. public GameObject player1;
  6. public GameObject player2;
  7. public Camera cameraPlayer1;
  8. public Camera cameraPlayer2;
  9. public GameObject crossHairPlayer1;
  10. public GameObject crossHairPlayer2;
  11. public GameObject playerPointer;
  12. //public Animator push;
  13. public Animator icon;
  14. public float screenAnimationTime;
  15. private thirdPersonController movementP1;
  16. private thirdPersonController movementP2;
  17. private bool activeP1 = true;
  18. private bool activeP2 = false;
  19. private string playerSwapInput = "playerSwap";
  20. // Call PlayerSound script to allow sounds upon button presses
  21. // NOTE: Make sure the SceneController's inspector has the PlayerAvatar
  22. // attached as an element under its script component.
  23. public PlayerSounds _playerSoundScript;
  24. // Use this for initialization
  25. void Start () {
  26. //Physics.IgnoreCollision(player1.GetComponent<Collider>(), player2.GetComponent<Collider>(),true);
  27. movementP1 = player1.GetComponent<thirdPersonController> ();
  28. movementP2 = player2.GetComponent<thirdPersonController> ();
  29. movementP2.active = false;
  30. crossHairPlayer2.SetActive (false);
  31. Component[] p1Colliders = player1.GetComponentsInChildren<Collider> ();
  32. Component[] p2Colliders = player2.GetComponentsInChildren<Collider> ();
  33. foreach (Collider p1Col in p1Colliders){
  34. foreach (Collider p2Col in p2Colliders){
  35. Physics.IgnoreCollision(p1Col, p2Col);
  36. }
  37. }
  38. }
  39. // Update is called once per frame
  40. void Update () {
  41. swapCharacters ();
  42. pointAtOther ();
  43. if (Input.GetKeyDown (KeyCode.R))
  44. Application.LoadLevel(Application.loadedLevel);
  45. }
  46. private void swapCharacters(){
  47. Camera newCamera;
  48. Camera oldCamera;
  49. if (Input.GetButtonDown(playerSwapInput)) {
  50. Debug.Log("swappy Swap");
  51. activeP1 = !activeP1;
  52. activeP2 = !activeP2;
  53. //_playerSoundScript.PlaySwitch(); //Play "Switch Character" sound function
  54. if (activeP1){
  55. newCamera = cameraPlayer1;
  56. oldCamera = cameraPlayer2;
  57. crossHairPlayer1.SetActive(true);
  58. crossHairPlayer2.SetActive(false);
  59. icon.SetTrigger("p1");
  60. }else{
  61. newCamera = cameraPlayer2;
  62. oldCamera = cameraPlayer1;
  63. crossHairPlayer1.SetActive(false);
  64. crossHairPlayer2.SetActive(true);
  65. icon.SetTrigger("p2");
  66. }
  67. movementP1.active = activeP1;
  68. movementP2.active = activeP2;
  69. newCamera.depth = 0;
  70. oldCamera.depth = 1;
  71. StartCoroutine(swapCameras (newCamera, oldCamera, screenAnimationTime));
  72. //newCamera.rect = new Rect (0.0f,0.0f,1.0f,1.0f);
  73. //oldCamera.rect = new Rect (0.84f, 0.74f, 0.155f, 0.25f);
  74. }
  75. }
  76. private void pointAtOther(){
  77. Transform target;
  78. Camera curCamera;
  79. if (movementP1.enabled) {
  80. target = player2.transform;
  81. curCamera = cameraPlayer1;
  82. } else {
  83. target = player1.transform;
  84. curCamera = cameraPlayer2;
  85. }
  86. Vector3 screenPos = curCamera.WorldToViewportPoint(target.position);
  87. Vector3 guiPos;
  88. //Debug.Log (screenPos);
  89. if (screenPos.x >= 0.0f && screenPos.x <= 1.0f && screenPos.y >= 0.0f && screenPos.y <= 1.0f) {
  90. guiPos = new Vector3 (screenPos.x * Screen.width, screenPos.y * Screen.height, 0.0f);
  91. playerPointer.transform.position = guiPos;
  92. return; // Object center is visible
  93. }
  94. //Debug.Log (screenPos);
  95. if (Mathf.Abs(screenPos.x-0.5f) > Mathf.Abs(screenPos.y-0.5f)) {
  96. screenPos.y = Mathf.Abs((screenPos.y));
  97. if (screenPos.x > 0.0f)
  98. screenPos.x = 1.0f;
  99. else
  100. screenPos.x = 0.0f;
  101. } else {
  102. screenPos.x = Mathf.Abs((screenPos.x));
  103. if (screenPos.y > 0.0f)
  104. screenPos.y = 1.0f;
  105. else
  106. screenPos.y = 0.0f;
  107. }
  108. guiPos = new Vector3 (screenPos.x * Screen.width, screenPos.y * Screen.height, 0.0f);
  109. //guiPos.x = Mathf.Clamp (guiPos.x, 0.0f, Screen.width);
  110. //guiPos.y = Mathf.Clamp (guiPos.y, 0.0f, Screen.height);
  111. playerPointer.transform.position = guiPos;
  112. }
  113. IEnumerator swapCameras (Camera newCamera, Camera oldCamera, float inTime){
  114. Rect tempNewRect = newCamera.rect;
  115. Rect tempOldRect = oldCamera.rect;
  116. for (float i = 0; i < 1; i+=Time.deltaTime/inTime) {
  117. tempNewRect.x = Mathf.Lerp (0.84f, 0.0f, i);
  118. tempNewRect.y = Mathf.Lerp (0.74f, 0.0f, i);
  119. tempNewRect.width = Mathf.Lerp (0.155f, 1.0f, i);
  120. tempNewRect.height = Mathf.Lerp (0.25f, 1.0f, i);
  121. tempOldRect.x = Mathf.Lerp (0.0f, 0.84f, i);
  122. tempOldRect.y = Mathf.Lerp (0.0f, 0.74f, i);
  123. tempOldRect.width = Mathf.Lerp (1.0f, 0.155f, i);
  124. tempOldRect.height = Mathf.Lerp (1.0f, 0.25f, i);
  125. newCamera.rect = tempNewRect;
  126. oldCamera.rect = tempOldRect;
  127. yield return null;
  128. }
  129. Debug.Log ("new rect: " + tempNewRect);
  130. newCamera.rect = new Rect (0.0f,0.0f,1.0f,1.0f);
  131. oldCamera.rect = new Rect (0.84f, 0.74f, 0.155f, 0.25f);
  132. }
  133. }