public override void OnStartLocalPlayer() { base.OnStartLocalPlayer(); _clientContext = LobbyManager.Instance.battleClientContext; LocalClientController = this; cam = PlayerCamera.instance; cam.SetFollowTransform(cameraPlaceHolder); LineOfSights.gameObject.SetActive(true); LineOfSights.IgnoreTarget = _selfTargetable; LineOfSights.VisibilityLineOfSight.MaxAngle = rpgParams.RangeOfView; LineOfSights.VisibilityLineOfSight.MaxDistance = rpgParams.ViewDistance; SetWeaponById(rpgParams.StartWeapon.WeaponId, rpgParams.StartWeapon.ClipSize, rpgParams.StartWeapon.MaxAmmo); _interactSystem.enabled = true; _clientContext.gameHUD.LocalPlayer = this; _clientContext.gameHUD.SwitchToLive(); _clientContext.gameHUD.SetHP(_currentHealth, rpgParams.MaxHealth); _isInited = true; }
/// <summary> /// Create client context only from battle scene /// </summary> /// <param name="state"></param> /// <returns></returns> public BattleClientContext CreateBattleClientContext(BattleState state, bool force = false) { if (battleClientContext == null) { battleClientContext = new BattleClientContext(HUD, ClientScene.localPlayers[0].playerControllerId); } battleClientContext.SetBattleState(state); return(battleClientContext); }
public override void OnStartClient() { base.OnStartClient(); _clientContext = LobbyManager.Instance.battleClientContext; var clientStartTime = _clientContext.battleState.SetverTimeToLocal(_startStageTime); var clientEndTime = _clientContext.battleState.SetverTimeToLocal(_endStageTime); _clientContext.gameHUDProvider.SetZoneStageData(clientStartTime, clientEndTime, _stageState); }
public override void OnLobbyClientSceneChanged(NetworkConnection conn) { if (SceneManager.GetSceneAt(0).name == lobbyScene) { HUD.Reset(); battleClientContext = null; if (topPanel.isInGame) { ChangeTo(lobbyPanel); if (_isMatchmaking) { if (conn.playerControllers[0].unetView.isServer) { backDelegate = StopHostClbk; } else { backDelegate = StopClientClbk; } } else { if (conn.playerControllers[0].unetView.isClient) { backDelegate = StopHostClbk; } else { backDelegate = StopClientClbk; } } } else { ChangeTo(mainMenuPanel); } topPanel.ToggleVisibility(true); topPanel.isInGame = false; } else { ChangeTo(null); Destroy(GameObject.Find("MainMenuUI(Clone)")); //backDelegate = StopGameClbk; topPanel.isInGame = true; topPanel.ToggleVisibility(false); } }
public override void OnStartClient() { base.OnStartClient(); _clientContext = LobbyManager.Instance.battleClientContext; LineOfSights.gameObject.SetActive(false); _interactSystem.enabled = false; SetWeaponById(rpgParams.StartWeapon.WeaponId, rpgParams.StartWeapon.ClipSize, rpgParams.StartWeapon.MaxAmmo);//wierd call before local player inited OnSetPlayerName(_playerName); }