public void StartingGame() { CountdownAnimation.enabled = true; print(StartCounterInteger); //if(CounterText.text.Contains) CounterText.text = StartCounterInteger.ToString(); if (StartCounterInteger > 0) { if (AudioManager.Instance != null) { AudioManager.Instance.PlaySFX(CountingDownSFX, 1f); } CountdownAnimation.Play("CountDownTimer", -1, 0); StartCounterInteger--; // animation plays first when we enable it, then this function is called which is why we shift this variable by one. } else if (StartCounterInteger == 0) { if (AudioManager.Instance != null) { AudioManager.Instance.PlaySFX(StartedSFX, 1f); } CounterText.text = "GO!!"; CountdownAnimation.Play("StartGame"); StartCoroutine(ShakeText()); if (AudioManager.Instance != null) { AudioManager.Instance.PlayMusicwithCrossFade(BattleMusic, 2f); } if (BoltNetwork.IsServer) { GameManager.instance.Game_State = GameManager.e_GamePhases.StandBy; Invoke("DisableCountdown", 5f); var evnt = StartGame.Create(); evnt.Message = "Game Has Started!!!"; evnt.Send(); // teleport players here } } }
private void OnSyncVersionAns(byte[] packet, Channel channel) { if (!_gameStarted) { var answer = Serialize <SynchVersionAns>(packet); //Log.Write("Setting up for game mode: {0}", answer.GameMode); _isOdin = answer.GameMode.Equals("ODIN"); // yay linq! var player = answer.players.ToList().Find(p => p.userId == _mySummonerId); _isOrder = player.teamId == 0x64; Send(Deserialize <PacketHeader>(PacketHeader.Create(PacketCommand.C2S_ClientReady, 0)), Channel.LoadingScreen); var ping = PingLoadInfo.Create(100, 2, _mySummonerId); Send(Deserialize <PingLoadInfo>(ping)); Send(Deserialize <PacketHeader>(PacketHeader.Create(PacketCommand.C2S_CharLoaded, 0))); Send(Deserialize <StartGame>(StartGame.Create())); } }