private void Start() { // Score ManagerScore.I.Initialize(this); // A little of UI if (UIGameOver != null) { UIGameOver.SetActive(false); } else { Debug.LogWarning("UIGameOver is missing, please set", this); } if (TetrominoListForMatch.Count < 1) { Debug.LogError("TetraminoPrefabs for a match wasn't set", this); } if (GridData != null) { GridWidth = GridData.GridWidth; GridHeight = GridData.GridHeight; } Grid = new Transform[GridWidth, GridHeight]; if (TetrominoSpawnedTraced.Count == 0) { GameStarted?.Invoke(); SpawnTetromino(); } }
public void GameStarted_Invoke(ServerCore server) { if (GameStarted != null) { GameStarted.Invoke(server); } }
protected void OnGameStarted(EventArgs e) { if (GameStarted != null) { GameStarted.Invoke(this, e); } }
IEnumerator GameStart() { yield return(StartCoroutine(LoadLevel())); yield return(StartCoroutine(BattlePrepare())); yield return(StartCoroutine(FocusTeamMember())); gameEnded = false; if (GameStarted != null) { GameStarted.Invoke(this, new EventArgs()); } //角色加入忽略层 Units.ForEach(u => u.gameObject.layer = 2); yield return(new WaitForSeconds(gameStartTime)); foreach (var unit in Units) { unit.UnitClicked += OnUnitClicked; unit.UnitDestroyed += OnUnitDestroyed; //设置同盟列表。 } Units.ForEach(u => { u.Initialize(); }); //战斗场景角色初始化。 StartCoroutine(RoundStart()); }
/// <summary> /// Handles the notification. /// </summary> /// <param name="n">The n.</param> private void HandleNotification(Notification n) { switch (n.NotificationType) { case Notification.Type.GameStarted: // if game already started if (Maze != null) { return; } Maze = Maze.FromJSON(n.Data); GameStarted?.Invoke(); break; case Notification.Type.GameOver: GameOver?.Invoke(n.Data); break; case Notification.Type.PlayerMoved: MoveUpdate mu = MoveUpdate.FromJSON(n.Data); OtherPosition = GetEstimatedPosition(OtherPosition, mu.Direction); break; default: break; } }
void GameListPanel_Inputed(IFocusable sender, InputEventArgs args) { if (args.InputInfo.IsPressed(ButtonType.Circle)) { if (GameStarted != null) { sound.Play(PPDSetting.DefaultSounds[1], -1000); GameStarted.Invoke(this, new GameEventArgs(gameList.List[currentIndex])); } } else if (args.InputInfo.IsPressed(ButtonType.Down)) { currentIndex++; if (currentIndex >= gameList.List.Length) { currentIndex = 0; } sound.Play(PPDSetting.DefaultSounds[0], -1000); } else if (args.InputInfo.IsPressed(ButtonType.Up)) { currentIndex--; if (currentIndex < 0) { currentIndex = gameList.List.Length - 1; } sound.Play(PPDSetting.DefaultSounds[0], -1000); } scrollIndex = currentIndex - scrollIndex >= 5 ? scrollIndex + 1 : scrollIndex; scrollIndex = scrollIndex > currentIndex ? currentIndex : scrollIndex; }
private void OnPlayerPressed() { player.Pressed -= OnPlayerPressed; ScoreManager.StartCount(); GameStarted?.Invoke(); }
private void StartGameProcessMonitoring() { var dispatcher = Dispatcher.CurrentDispatcher; ThreadPool.QueueUserWorkItem(_ => { while (gameProcessMonitoring.Wait(1000) == false) { bool localIsRunGameLocked = dispatcher.Invoke(() => IsRunGameLocked); var processes = Process.GetProcessesByName(Constants.ProcessName); if (processes.Length > 0 && IsRunGameLocked == false) { dispatcher.Invoke(() => { IsRunGameLocked = true; Status = "Dark Souls 3 is running..."; GameStarted?.Invoke(this, EventArgs.Empty); }); } else if (processes.Length == 0 && IsRunGameLocked) { dispatcher.Invoke(() => { IsRunGameLocked = false; Status = "Dark Souls 3 has stopped..."; GameStopped?.Invoke(this, EventArgs.Empty); }); } } gameProcessMonitoring.Reset(); }); }
// Update is called once per frame void Update() { if (Input.GetButtonDown("Jump")) { GameStarted?.Invoke(); this.enabled = false; } }
/// <summary> /// Method is called once, at the beggining of the game. /// </summary> public void StartGame() { GameStarted?.Invoke(this); Units.FindAll(u => u.PlayerNumber.Equals(CurrentPlayerNumber)).ForEach(u => u.OnTurnStart()); Players.Find(p => p.PlayerNumber.Equals(CurrentPlayerNumber)).Play(this); Debug.Log("Game started"); }
private void StartGame() { gameStartedTime = Time.time; UpdateAsteroidEventTime(); StartNextWave(); isGameInProgress = true; GameStarted?.Invoke(); }
public void Start() { Clear(); NextPolyomino = new Tetromono(); Place(currentPolyomino); scoreBoard.Reset(); IsStarted = true; GameStarted?.Invoke(); }
public void StartGame() { if (_isPlaying == false) { _isPlaying = true; } GameStarted?.Invoke(); }
private void Start() { GameStarted?.Invoke(this, EventArgs.Empty); IList <string> letterPairs = _letterPairGenerator.GetLetterPairList(4); // TODO: use numPairs from settings LetterPairsGenerated?.Invoke(this, new LetterPairsEventArgs(letterPairs)); _timer.StartAsync(45 * letterPairs.Count); // TODO: use time from settings }
internal void StartGame() { if (Players.Count >= MinPlayerCount) { _gameStarted = true; InitRoom(); GameStarted.Invoke(this); } }
public void StartGame() { if (GameStarted != null) { GameStarted.Invoke(this, new EventArgs()); } Units.FindAll(u => u.PlayerNumber.Equals(CurrentPlayerNumber)).ForEach(u => { u.OnTurnStart(); }); Players.Find(p => p.PlayerNumber.Equals(CurrentPlayerNumber)).Play(this); Debug.Log("Game Started"); }
public void StartGame(CellState firstPlayerColor) { this.firstPlayerColor = firstPlayerColor; currentPlayerColor = firstPlayerColor; secondPlayerColor = Field.GetOppositeColor(firstPlayerColor); GameStarted?.Invoke(field.Cells); GetAvailableCells(); }
private void TriggerEvents(bool recursive) { int originalCount = eventQueue.Count; // Do not use foreach as eventQueue might change for (int i = 0; i < (recursive ? eventQueue.Count : originalCount); i++) { // Performance is not a problem since events are rare! var arg = eventQueue[i]; if (arg is GamerJoinedEventArgs) { if (GamerJoined != null) { GamerJoined.Invoke(this, arg as GamerJoinedEventArgs); } } else if (arg is GamerLeftEventArgs) { if (GamerLeft != null) { GamerLeft.Invoke(this, arg as GamerLeftEventArgs); } } else if (arg is GameStartedEventArgs) { if (GameStarted != null) { GameStarted.Invoke(this, arg as GameStartedEventArgs); } } else if (arg is GameEndedEventArgs) { if (GameEnded != null) { GameEnded.Invoke(this, arg as GameEndedEventArgs); } } else if (arg is NetworkSessionEndedEventArgs) { if (SessionEnded != null) { SessionEnded.Invoke(this, arg as NetworkSessionEndedEventArgs); } } } if (recursive) { eventQueue.Clear(); } else { eventQueue.RemoveRange(0, originalCount); } }
private void Update() { if (!_gameStarted) { if (Input.GetMouseButtonDown(0)) { GameStarted?.Invoke(); _gameStarted = true; } } }
public void StartGame(Tuple <int, int> blackHoleCoords) { currentPlayerColor = firstPlayerColor; board.SetBlackHole(blackHoleCoords); GameStarted?.Invoke(board.Points); var availablePoints = GetAvailablePoints(); AvailablePointsCalculated?.Invoke(availablePoints); }
public void Connect(string endpoint, int port) { if (manager != null) { throw new InvalidOperationException(); } var listener = new EventBasedNetListener(); manager = new NetManager(listener); manager.Start(); manager.Connect(endpoint, port, nameof(MultiplayerTest)); listener.PeerConnectedEvent += peer => server = peer; var processor = new NetPacketProcessor(); processor.RegisterNestedType <Order>(() => new Order()); processor.SubscribeReusable <OrderPacket>(packet => { foreach (var order in packet.Orders) { OrderReceived?.Invoke(order); } }); listener.NetworkReceiveEvent += (fromPeer, dataReader, deliveryMethod) => { var type = (PacketType)dataReader.GetByte(); switch (type) { case PacketType.StartGame: var players = dataReader.GetInt(); GameStarted?.Invoke(players); break; case PacketType.Orders: processor.ReadAllPackets(dataReader); break; } dataReader.Recycle(); }; writer = new NetDataWriter(); thread = new Thread(Run) { IsBackground = true }; thread.Start(); }
// Method is called once, at the beginning of the game. public void StartGame() { if (GameStarted != null) { GameStarted.Invoke(this, new EventArgs()); } InitTracker[0].OnTurnStart(); Players.Find(p => p.PlayerNumber.Equals(CurrentPlayerNumber)).Play(this); // Select unit with a short delay StartCoroutine(StartGameSelect()); }
public float turnStartTime = 2f; //状态持续时间。 IEnumerator GameStart() { if (GameStarted != null) { GameStarted.Invoke(this, new EventArgs()); } //角色加入忽略层 Units.ForEach(u => u.gameObject.layer = 2); yield return(new WaitForSeconds(gameStartTime)); StartCoroutine(RoundStart()); }
public void StartGame() { CurrentPlayerColor = _firstPlayerColor; _board.SetBlackHole(GenerateBlackHoleCoords()); GameStarted?.Invoke(_board.Cells); var availableCells = GetAvailableCells(); AvailableCellsCalculated?.Invoke(availableCells); }
/// <summary> /// Method is called once, at the beggining of the game. /// </summary> public void StartGame() { if (GameStarted != null) { GameStarted.Invoke(this, new EventArgs()); } UnitNumber = 0; ClockTick(); //Units.FindAll(u => u.PlayerNumber.Equals(CurrentPlayerNumber)).ForEach(u => { u.OnTurnStart(); }); //Players.Find(p => p.PlayerNumber.Equals(CurrentPlayerNumber)).Play(this); }
private void OnLobbyNetworkReceived(NetPeer peer, NetDataReader dataReader) { NetMessage instruction = (NetMessage)dataReader.GetInt(); switch (instruction) { case NetMessage.ServerClosed: OnServerClosed(); break; case NetMessage.ClientsCount: int count = dataReader.GetInt(); OnClientsCount(count); break; case NetMessage.AddPlayer: PlayerAdded?.Invoke(this, new LobbyPlayerEventArgs() { PlayerID = dataReader.GetString(), ControllerIndex = (PlayerControllerIndex)dataReader.GetInt() }); break; case NetMessage.RemovePlayer: PlayerRemoved?.Invoke(this, new LobbyPlayerEventArgs() { PlayerID = dataReader.GetString() }); break; case NetMessage.PrepareToStartGame: PreparingGameToStart?.Invoke(this, new LobbyOptionsArgs { PlayersCount = dataReader.GetInt(), Map = dataReader.GetInt(), Biome = dataReader.GetInt(), }); break; case NetMessage.InstantiateCharacter: InstantiateCharacter?.Invoke(this, new LobbyPlayerEventArgs { PlayerID = dataReader.GetString(), ControllerIndex = (PlayerControllerIndex)dataReader.GetInt(), Type = (Pj.Type)dataReader.GetInt(), X = dataReader.GetFloat(), Y = dataReader.GetFloat() }); break; case NetMessage.StartGame: this.SetGameplay(); GameStarted?.Invoke(this, EventArgs.Empty); break; } }
/// <summary> /// Method is called once, at the beggining of the game. /// </summary> public void StartGame() { if (GameStarted != null) { GameStarted.Invoke(this, new EventArgs()); } // Added Skill event so the skills can turn themselves off when a turn starts. Skills.ForEach(u => { u.OnTurnStart(); }); Units.FindAll(u => u.PlayerNumber.Equals(CurrentPlayerNumber)).ForEach(u => { u.OnTurnStart(); }); Players.Find(p => p.PlayerNumber.Equals(CurrentPlayerNumber)).Play(this); }
private void PrepareLevel() { CurrentLevel = new GameObject("TileMap").AddComponent <HexagonLevelBehaviour>(); CurrentLevel.Initiliaze(_gridSizeX, _gridSizeY); GameStarted?.Invoke(); ViewController.Instance.InGameView.Open(new InGameViewParameters()); TileMapSystem.HexagonBlowed += OnHexagonBlowed; TileMapSystem.OutOfMove += OnOutOfMove; BombHexagonBehaviour.Exploded += OnBombExploded; }
/// <summary> /// Method is called once, at the beggining of the game. /// </summary> public void StartGame() { if (GameStarted != null) { GameStarted.Invoke(this, new EventArgs()); } Units.FindAll(u => u.PlayerNumber.Equals(CurrentPlayerNumber)).ForEach(u => { u.OnTurnStart(); }); Players.Find(p => p.PlayerNumber.Equals(CurrentPlayerNumber)).Play(this); if (NetManager.playerCount == 1) { } }
public void SwapMap() { menuMap.SetActive(false); gameMap.SetActive(true); GameStarted?.Invoke(); /* * StartCoroutine(_fm.FadeOut(callback => * { * if(callback.Equals(true)) * LoadLevel(sceneName); * })); */ }