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.

210 lines
4.6 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 float screenAnimationTime;
  13. private thirdPersonController movementP1;
  14. private thirdPersonController movementP2;
  15. private bool activeP1 = true;
  16. private bool activeP2 = false;
  17. private string playerSwapInput = "playerSwap";
  18. // Call PlayerSound script to allow sounds upon button presses
  19. // NOTE: Make sure the SceneController's inspector has the PlayerAvatar
  20. // attached as an element under its script component.
  21. public PlayerSounds _playerSoundScript;
  22. // Use this for initialization
  23. void Start () {
  24. //Physics.IgnoreCollision(player1.GetComponent<Collider>(), player2.GetComponent<Collider>(),true);
  25. movementP1 = player1.GetComponent<thirdPersonController> ();
  26. movementP2 = player2.GetComponent<thirdPersonController> ();
  27. movementP2.active = false;
  28. crossHairPlayer2.SetActive (false);
  29. Component[] p1Colliders = player1.GetComponentsInChildren<Collider> ();
  30. Component[] p2Colliders = player2.GetComponentsInChildren<Collider> ();
  31. foreach (Collider p1Col in p1Colliders){
  32. foreach (Collider p2Col in p2Colliders){
  33. Physics.IgnoreCollision(p1Col, p2Col);
  34. }
  35. }
  36. }
  37. // Update is called once per frame
  38. void Update () {
  39. swapCharacters ();
  40. pointAtOther ();
  41. if (Input.GetKeyDown (KeyCode.R))
  42. Application.LoadLevel(Application.loadedLevel);
  43. }
  44. private void swapCharacters(){
  45. Camera newCamera;
  46. Camera oldCamera;
  47. if (Input.GetButtonDown(playerSwapInput)) {
  48. Debug.Log("swappy Swap");
  49. activeP1 = !activeP1;
  50. activeP2 = !activeP2;
  51. _playerSoundScript.PlaySwitch(); //Play "Switch Character" sound function
  52. if (activeP1){
  53. newCamera = cameraPlayer1;
  54. oldCamera = cameraPlayer2;
  55. crossHairPlayer1.SetActive(true);
  56. crossHairPlayer2.SetActive(false);
  57. }else{
  58. newCamera = cameraPlayer2;
  59. oldCamera = cameraPlayer1;
  60. crossHairPlayer1.SetActive(false);
  61. crossHairPlayer2.SetActive(true);
  62. }
  63. movementP1.active = activeP1;
  64. movementP2.active = activeP2;
  65. newCamera.depth = 0;
  66. oldCamera.depth = 1;
  67. StartCoroutine(swapCameras (newCamera, oldCamera, screenAnimationTime));
  68. //newCamera.rect = new Rect (0.0f,0.0f,1.0f,1.0f);
  69. //oldCamera.rect = new Rect (0.84f, 0.74f, 0.155f, 0.25f);
  70. }
  71. }
  72. private void pointAtOther(){
  73. Transform target;
  74. Camera curCamera;
  75. if (movementP1.enabled) {
  76. target = player2.transform;
  77. curCamera = cameraPlayer1;
  78. } else {
  79. target = player1.transform;
  80. curCamera = cameraPlayer2;
  81. }
  82. Vector3 screenPos = curCamera.WorldToViewportPoint(target.position);
  83. Vector3 guiPos;
  84. //Debug.Log (screenPos);
  85. if (screenPos.x >= 0.0f && screenPos.x <= 1.0f && screenPos.y >= 0.0f && screenPos.y <= 1.0f) {
  86. guiPos = new Vector3 (screenPos.x * Screen.width, screenPos.y * Screen.height, 0.0f);
  87. playerPointer.transform.position = guiPos;
  88. return; // Object center is visible
  89. }
  90. //Debug.Log (screenPos);
  91. if (Mathf.Abs(screenPos.x-0.5f) > Mathf.Abs(screenPos.y-0.5f)) {
  92. screenPos.y = Mathf.Abs((screenPos.y));
  93. if (screenPos.x > 0.0f)
  94. screenPos.x = 1.0f;
  95. else
  96. screenPos.x = 0.0f;
  97. } else {
  98. screenPos.x = Mathf.Abs((screenPos.x));
  99. if (screenPos.y > 0.0f)
  100. screenPos.y = 1.0f;
  101. else
  102. screenPos.y = 0.0f;
  103. }
  104. guiPos = new Vector3 (screenPos.x * Screen.width, screenPos.y * Screen.height, 0.0f);
  105. //guiPos.x = Mathf.Clamp (guiPos.x, 0.0f, Screen.width);
  106. //guiPos.y = Mathf.Clamp (guiPos.y, 0.0f, Screen.height);
  107. playerPointer.transform.position = guiPos;
  108. }
  109. IEnumerator swapCameras (Camera newCamera, Camera oldCamera, float inTime){
  110. Rect tempNewRect = newCamera.rect;
  111. Rect tempOldRect = oldCamera.rect;
  112. for (float i = 0; i < 1; i+=Time.deltaTime/inTime) {
  113. tempNewRect.x = Mathf.Lerp (0.84f, 0.0f, i);
  114. tempNewRect.y = Mathf.Lerp (0.74f, 0.0f, i);
  115. tempNewRect.width = Mathf.Lerp (0.155f, 1.0f, i);
  116. tempNewRect.height = Mathf.Lerp (0.25f, 1.0f, i);
  117. tempOldRect.x = Mathf.Lerp (0.0f, 0.84f, i);
  118. tempOldRect.y = Mathf.Lerp (0.0f, 0.74f, i);
  119. tempOldRect.width = Mathf.Lerp (1.0f, 0.155f, i);
  120. tempOldRect.height = Mathf.Lerp (1.0f, 0.25f, i);
  121. newCamera.rect = tempNewRect;
  122. oldCamera.rect = tempOldRect;
  123. yield return null;
  124. }
  125. Debug.Log ("new rect: " + tempNewRect);
  126. newCamera.rect = new Rect (0.0f,0.0f,1.0f,1.0f);
  127. oldCamera.rect = new Rect (0.84f, 0.74f, 0.155f, 0.25f);
  128. }
  129. }