/// <summary> /// Sent by client starting their game /// Received by Server /// Spawns everything needed to start game by client, gives control to the event sender /// </summary> /// <param name="evnt"></param> public override void OnEvent(GameplayStartedEvent evnt) { if (BoltNetwork.isServer) { //BoltEntity wizard = GameManager.Instance.SpawnWizard(evnt.CredentialsToken as CredentialToken); //Debug.Log(evnt.RaisedBy.ConnectToken); //wizard.AssignControl(evnt.RaisedBy); //GameManager.Instance.WizardSpawned(newWizard); } }
/// <summary> /// Called when a local scene change finishes. /// </summary> /// <param name="map"></param> /// <param name="token"></param> public override void SceneLoadLocalDone(string map, Bolt.IProtocolToken token) { SceneChangeToken sceneChange = (SceneChangeToken)token; if (sceneChange != null) { Debug.Log("loading from scene: " + sceneChange.SceneFrom); Debug.Log("loading to scene: " + sceneChange.SceneTo); Debug.Log("reason: " + sceneChange.Reason); if (sceneChange.Reason == "StartGame") { if (BoltNetwork.isClient) { GameplayStartedEvent evnt = GameplayStartedEvent.Create(Bolt.GlobalTargets.OnlyServer); CredentialToken credentials = ClientManager.Instance.Credentials; evnt.CredentialsToken = credentials; evnt.Send(); } else { // we're the server /* * BoltEntity wizard = GameManager.Instance.SpawnWizard(ClientManager.Instance.Credentials); * wizard.GetComponent<WizardController>().Init(); * wizard.TakeControl(); * * BoltEntity entropyManager = GameManager.Instance.SpawnEntropyManager(); * * entropyManager.TakeControl(); */ // enable the start of setup for the game GameManager.Instance.StartSetup(); } ServerManager.Instance.InitUserStats(); //GameTypeManager.Instance.RoundStart(); //StartMenuGUIManager.Instance.FSM.Transition("Init"); GameGUIManager.Instance.BoltLoadGameScene(); } } }