Advertisement
Th3NiKo

Przyklad c#

May 27th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.45 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. /*
  5. playerIndex to 10, 20 lub 30 w zaleznosci ktorego chcesz ruszyc plejera. Caly slownik co jaki ma numerek jest w GameManager.cs
  6. Funkcje publiczne (do użytku):
  7.  
  8. Wszystkie te funkcje sa dostepne z pozycju gameManager czyli np: gameManager.RotateClockwise(20);
  9. RotateClockwise(int playerIndex) //obrot w prawo
  10. RotateCounterClockwise(int playerIndex) //obrot w lewo
  11. MoveForward(int playerIndex) //idzie prosto
  12. PlaceBomb(int playerIndex) //kladzie bombe
  13. CheckHp(int playerIndex) //Zwraca hp danego gracza
  14. GetMap() //Zwraca cala mape w array intow
  15. GameFinished() //Zwraca numer gracza ktory wygral jezeli gra sie zakonczyla. Jezeli gra nadal trwa zwraca -1
  16. GetTurnTime() //Zwraca ile trwa runda
  17. */
  18.  
  19.  
  20. public class TwojaNazwa : MonoBehaviour {
  21.  
  22.     GameManager gameManager;
  23.     public int playerIndex = 10;
  24.  
  25.     //Timers
  26.     float timer = 0.0f;
  27.     float turnTime;
  28.  
  29.     //Tutaj deklarujesz swoje zmienne
  30.    
  31.     void Start () {
  32.         gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
  33.         turnTime = gameManager.GetTurnTime();
  34.        
  35.         //Tutaj swoim zmiennym mozesz dac wartosc startowa
  36.     }
  37.    
  38.    
  39.     void Update () {
  40.         if(timer > turnTime){
  41.             //Tutaj pojedyncza runda sie rozgrywa
  42.             /*
  43.                 Mozesz dac tutaj np, czyli dopoki gra sie nie skonczy
  44.                 while(gameManager.GameFinished() == -1){
  45.                    
  46.                 }
  47.             */
  48.  
  49.  
  50.             timer = 0.0f;
  51.         }
  52.         timer += Time.deltaTime;
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement