public virtual void CmdPlayActor(System.Guid _assetId, Vector3Int _cellSize, Vector3Int[] _cellIndex) { //set up actor in server GardenActor actor = GardenPool.instance.GetFromPool(_assetId).GetComponent <GardenActor>(); // spawn actor on client, custom spawn handler is called NetworkServer.Spawn(actor.gameObject, connectionToClient); actor.cellSize = _cellSize; actor.cellIndex.AddRange(_cellIndex); //add actor to player list if (!(actor as BootyBox)) { ownedActorsList.Add(actor.GetComponent <NetworkIdentity>()); } }
IEnumerator LaunchRoundResultsPhase() { state = MatchState.ROUND_RESULTS_PHASE; //force players switch view to side foreach (GardenPlayer player in players) { player.view = PlayerView.RESULTS; } //starting delay yield return(new WaitForSeconds(1f)); //TODO: Check and wait for results updates in clients foreach (GardenPlayer player in players) { var actorsToClear = new List <NetworkIdentity>(); foreach (NetworkIdentity actorNetIdentity in player.ownedActorsList) { GardenActor actor = actorNetIdentity.GetComponent <GardenActor>(); //launch bomb if (actor as Bomb) { yield return(LaunchBomb(actor as Bomb, player.GetComponent <NetworkIdentity>())); } //check actor rounds left actor.roundsLeft--; if (actor.roundsLeft == 0) { actorsToClear.Add(actorNetIdentity); actor.GetComponent <GardenActor>().Die(); } } //clear actors foreach (NetworkIdentity clearingActor in actorsToClear) { player.ownedActorsList.Remove(clearingActor); } yield return(null); } //player gains booty currency dependeing on their in-game booty foreach (GardenPlayer player in players) { round++; player.RpcStartNewRound(round); } yield return(null); //end phase phaseTime = 0f; state = MatchState.ROUND_PHASE; phaseProcess = null; }