//--------------------------------------其它事件-------------------------------- public void OnPlayerDie(int playerId) { Debuger.Log("PVPGame", "OnPlayerDie {0}, _mainPlayerId = {1}", playerId, _mainPlayerId); if (_mainPlayerId == playerId) { GameInput.DisableInput(); // 可以观战 EventManager.Instance.SendEvent("OpenGodOfView"); } }
public void Stop() { _isStoped = true; GameInput.DisableInput(); m_context = null; Scheduler.RemoveFixedUpdateListener(FixedUpdate); BattleEngine.Instance.ExitBattle(); }
public void Start(object param) { _isStoped = false; GameParam gameParam = param as GameParam; _gameMode = gameParam.mode; RegisterPlayer(); BattleEngine.Instance.EnterBattle(gameParam, this); m_context = BattleEngine.Instance.Context; GameInput.onVKey = OnVKey; GameInput.DisableInput(); Scheduler.AddFixedUpdateListener(FixedUpdate); }
public void Start(object param) { _isStoped = false; PVPStartParam startParam = param as PVPStartParam; _gameMode = startParam.gameParam.mode; // 注册玩家 uint mainUserId = UserManager.Instance.UserData.id; var players = startParam.players; for (int i = 0; i < players.Count; i++) { if (players[i].userID == mainUserId) { _mainPlayerId = players[i].playerID; } //注册玩家数据,为在帧同步过程中创建玩家提供数据 //因为帧同步协议非常精简,不包含具体的玩家数据 BattleEngine.Instance.RegPlayerData(players[i]); } // 创建游戏 BattleEngine.Instance.EnterBattle(startParam.gameParam, this); m_context = BattleEngine.Instance.Context; // 帧同步 StartFSP(); // 接收输入 GameInput.onVKey = OnVKey; GameInput.DisableInput(); Scheduler.AddFixedUpdateListener(FixedUpdate); }
/// <summary> /// 暂停游戏 /// </summary> public void Pause() { m_pause = true; GameInput.DisableInput(); }