SHOW:
|
|
- or go back to the newest paste.
1 | using CodeStage.AntiCheat.ObscuredTypes; | |
2 | using System.Collections; | |
3 | using System.Collections.Generic; | |
4 | using UnityEngine; | |
5 | using UnityEngine.UI; | |
6 | ||
7 | public class ZS : bl_PhotonHelper { | |
8 | ||
9 | public bl_GameManager manager = null; | |
10 | public bl_ChatRoom chat = null; | |
11 | public bl_KillFeed killFeed = null; | |
12 | public GameObject countdown = null; | |
13 | public bl_RoundTime timeManager = null; | |
14 | protected int ZombiesCount = -1; | |
15 | protected List<PhotonPlayer> Zombies = null; | |
16 | ||
17 | protected bool IsGameInProgress = false; | |
18 | protected bool IsCountdownStarted = false; | |
19 | ||
20 | protected ObscuredInt TimeLeft = 60; | |
21 | // Use this for initialization | |
22 | void Start () { | |
23 | ||
24 | } | |
25 | ||
26 | // Update is called once per frame | |
27 | void Update () { | |
28 | Zombies = manager.GetPlayersInTeam("Recon"); | |
29 | ZombiesCount = Zombies.Count; | |
30 | ||
31 | if (ZombiesCount == 0 && manager.GetPlayersInTeam("Delta").Count > 1 && !IsCountdownStarted) | |
32 | { | |
33 | IsCountdownStarted = true; | |
34 | InvokeRepeating("TimeUpdate", 1, 1); | |
35 | countdown.SetActive(true); | |
36 | } | |
37 | } | |
38 | ||
39 | void TimeUpdate() | |
40 | { | |
41 | if(TimeLeft <= 0) | |
42 | { | |
43 | StartGame(); | |
44 | return; | |
45 | } | |
46 | TimeLeft--; | |
47 | countdown.GetComponentInChildren<Text>().text = TimeLeft.ToString(); | |
48 | } | |
49 | ||
50 | void StartGame() | |
51 | { | |
52 | countdown.SetActive(false); | |
53 | CancelInvoke("TimeUpdate"); | |
54 | IsCountdownStarted = false; | |
55 | IsGameInProgress = true; | |
56 | } | |
57 | ||
58 | void SelectNewZombie() | |
59 | { | |
60 | if (PhotonNetwork.isMasterClient) | |
61 | { | |
62 | List<PhotonPlayer> DeltaPlayers = manager.GetPlayersInTeam("Delta"); | |
63 | int index = Random.Range(0, DeltaPlayers.Count); | |
64 | ||
65 | PhotonPlayer newZombie = DeltaPlayers[index]; | |
66 | ||
67 | PhotonView photonView = this.gameObject.GetComponentInChildren<PhotonView>(); | |
68 | photonView.RPC("TransformToZombie", newZombie); ///??? | |
69 | } | |
70 | } | |
71 | } | |
72 | ||
73 | ||
74 | ////Client | |
75 | - | [PunRPC] |
75 | + | [PunRPC] |
76 | - | public void ExplodeShahid() |
76 | + | public void TransformToZombie() |
77 | { | |
78 | - | GameObject e = PhotonNetwork.Instantiate("Shahid", playerObj.transform.position, Quaternion.identity, 0, null); |
78 | + | SpawnPlayer(Team.Recon); |
79 | } |