void AnnouncerChecks() { if (timer.timeLeft < 11 && !tenSecondsTimerFired && PhotonNetwork.IsMasterClient) { announcerManager.PlayAnnouncerLine(announcerManager.announcerShouts.tenSecondCountdown); tenSecondsTimerFired = true; thirtySecondsTimerFired = true; oneMinTimerFired = true; twoMinTimerFired = true; } else if (timer.timeLeft < 30 && !thirtySecondsTimerFired && PhotonNetwork.IsMasterClient) { announcerManager.PlayAnnouncerLine(announcerManager.announcerShouts.thirtySeconds); thirtySecondsTimerFired = true; oneMinTimerFired = true; twoMinTimerFired = true; } else if (timer.timeLeft < 60 && !oneMinTimerFired && PhotonNetwork.IsMasterClient) { announcerManager.PlayAnnouncerLine(announcerManager.announcerShouts.oneMinute); oneMinTimerFired = true; twoMinTimerFired = true; } else if (timer.timeLeft < 120 && !twoMinTimerFired && PhotonNetwork.IsMasterClient) { announcerManager.PlayAnnouncerLine(announcerManager.announcerShouts.twoMinutes); twoMinTimerFired = true; } }
void Start() { announcerManager = FindObjectOfType <AnnouncerManager>(); if (PhotonNetwork.IsMasterClient) { announcerManager.PlayAnnouncerLine(announcerManager.announcerShouts.matchStart); } prepare.Play(); Invoke(nameof(playThree), 1f); Invoke(nameof(playTwo), 2f); Invoke(nameof(playOne), 3f); Invoke(nameof(playFight), 4f); Destroy(gameObject, 5f); }
// Die is a LOCAL function that is only called by the driver when they get dead. protected void Die(bool updateDeath, bool updateKill) { // Update gamestate networkManager.CallRespawnVehicle(5f, teamId); TeamEntry team = gamestateTracker.teams.Get((short)teamId); myPhotonView.RPC(nameof(SetGunnerHealth_RPC), RpcTarget.All, 0f); bool hadPotato = hpm.removePotato(); if (!hadPotato) { announcerManager.PlayAnnouncerLine(announcerManager.announcerShouts.onKilled, npv.GetDriverID(), npv.GetGunnerID()); } team.Release(); // update my deaths if (updateDeath) { /*GamestateTracker.TeamDetails myRecord = gamestateTracker.getTeamDetails(teamId); * myRecord.deaths += 1; * myRecord.isDead = true; * gamestateTrackerPhotonView.RPC(nameof(GamestateTracker.UpdateTeamWithNewRecord), RpcTarget.All, teamId, * JsonUtility.ToJson(myRecord));*/ TeamEntry teamEntry = gamestateTracker.teams.Get((short)teamId); teamEntry.deaths += 1; teamEntry.isDead = true; teamEntry.Increment(); } if (updateKill) { // update their kills /*GamestateTracker.TeamDetails theirRecord = gamestateTracker.getTeamDetails(lastHitDetails.sourceTeamId); * theirRecord.kills += 1; * gamestateTrackerPhotonView.RPC(nameof(GamestateTracker.UpdateTeamWithNewRecord), RpcTarget.All, * lastHitDetails.sourceTeamId, JsonUtility.ToJson(theirRecord));*/ TeamEntry teamEntry = gamestateTracker.teams.Get((short)lastHitDetails.sourceTeamId); teamEntry.kills += 1; teamEntry.Increment(); } }
public void pickupPotato() { NetworkPlayerVehicle npv = GetComponent <NetworkPlayerVehicle>(); myDriverId = npv.GetDriverID(); myGunnerId = npv.GetGunnerID(); isPotato = true; canPickupPotato = false; InvokeRepeating("buffs", 2f, 2f); GetComponent <PhotonView>().RPC(nameof(PickupPotatoEffects), RpcTarget.All); // telecastManager.PickupPotato(npv); AnnouncerManager a = FindObjectOfType <AnnouncerManager>(); a.PlayAnnouncerLine(a.announcerShouts.potatoPickup, myDriverId, myGunnerId); }
public bool removePotato() { if (isPotato) { AnnouncerManager a = FindObjectOfType <AnnouncerManager>(); a.PlayAnnouncerLine(a.announcerShouts.potatoDrop, myDriverId, myGunnerId); isPotato = false; canPickupPotato = false; Invoke(nameof(ReactivatePickupPotato), 5f); GetComponent <PhotonView>().RPC(nameof(RemovePotato_RPC), RpcTarget.AllBuffered); CancelInvoke("buffs"); Vector3 pos = gameObject.transform.position + new Vector3(0.0f, 1.5f, 0.0f); GameObject potato = PhotonNetwork.Instantiate("HotPotatoGO", pos, Quaternion.identity, 0); dropTelecast(); return(true); } return(false); }