Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. void Update()
  2. {
  3. /* TODO : TO BE REWORKED, may not use a Raycast in the future, need to be discussed with GDs */
  4. Transform cam = Camera.main.transform;
  5. RaycastHit hit;
  6. if (Physics.Raycast(cam.position , cam.forward , out hit) && hit.collider.tag == "BrokenRobot")
  7. AddPlayer(hit.collider.gameObject);
  8. /**************************************************************************************/
  9.  
  10. if (player.GetButton("Switch")) {
  11. Debug.Log("switch");
  12. if ((currentPlayerIndex + 1) == playerArray.Count && playerArray.Count == 1) {
  13. return;
  14. } else if(timer < switchTime) {
  15. timer += 1 * Time.deltaTime;
  16. Debug.Log(timer);
  17. } else if ((currentPlayerIndex + 1) != playerArray.Count) {
  18. Activate(currentPlayerIndex + 1);
  19. resetTimer();
  20. }
  21. else if ((currentPlayerIndex + 1) == playerArray.Count && playerArray.Count != 1) {
  22. Activate(0);
  23. resetTimer();
  24. }
  25. }
  26.  
  27. if (player.GetButtonUp("Switch")) {
  28. resetTimer();
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement