public override void OnUDPEventReceived(GamePlayEvent gamePlayEvent) { base.OnUDPEventReceived(gamePlayEvent); if (gamePlayEvent.eventName == "Start") { //edgeManager.HandleWebSocketMessage("gameStart"); } }
public void Execute() { var nextLevel = playerRepository.GetLevel() + 1; configuration.AllLevels.ElementAtOrDefault(nextLevel).ToMaybe() .Match(_ => { playerRepository.SetLevel(nextLevel); startLevel.Execute(); }, () => gamePlayEventObserver.OnNext(GamePlayEvent.GameOver())); }
public IDisposable Start() { return(gamePlayEventSubject .Where(@event => @event.IsLastRoundEvent()) .SelectMany(_ => collisionObservable) .Where(@event => @event.IsARemoveCollision()) .Where(@event => @event.EnemiesCount.Equals(0)) .Do(_ => gamePlayEventSubject.OnNext(GamePlayEvent.LevelWon())) .First() .Subscribe()); }
public override void OnMessageReceived(GamePlayEvent gameEvent) { switch (gameEvent.eventName) { case "restart": StartCoroutine(gameManager.RestartGame()); break; case "score": gameManager.UpdateScore(gameEvent.integerData[0], gameEvent.integerData[1]); break; } }
protected override void GamePlay(GamePlayEvent e) { var trackPrefab = Resources.Load("Prefabs/Tracks/" + e.track); currentTrack = Instantiate(trackPrefab, new Vector3(0, 0, 0), Quaternion.identity); GameObject go = (GameObject)trackPrefab; Track t = (Track)go.GetComponent <Track>(); Vector3 pos = t.getFirstSegment(); Vector3 rot = t.getRotateSegment(); m_Car.transform.position = new Vector3(pos.x, pos.y + 2, pos.z); m_Car.transform.eulerAngles = rot; m_Car.GetComponent <Rigidbody>().useGravity = true; m_Car.GetComponent <Rigidbody>().isKinematic = false; }
private IObservable <long> Cycle(LevelDefinition levelDefinition, EnemiesDefinition currentEnemies) { return(Observable.Start(() => currentEnemies) .SelectMany(def => def.Delay.Equals(0) ? InstantiateEnemies(def) : Observable.Timer(TimeSpan.FromSeconds(def.Delay)) .SelectMany(_ => InstantiateEnemies(def))) .SelectMany(_ => levelDefinition.EnemiesList.Next(currentEnemies).SelectOrElse(next => Cycle(levelDefinition, next), () => { gamePlayEventObserver.OnNext(GamePlayEvent.LastRound()); return Observable.Empty <long>(); }))); }
public void Execute(PlayerView playerView, int damage) { var health = playerRepository.GetHealth(); var newhealth = Mathf.Max(health - damage, 0); playerRepository.SetHealth(newhealth); if (newhealth.Equals(0)) { var lives = playerRepository.GetLives() - 1; playerRepository.SetLives(lives); playerRepository.SetHealth(configuration.Player.Health); playerView.Explote(); gamePlayEventObserver.OnNext(lives.Equals(0) ? GamePlayEvent.GameOver() : GamePlayEvent.LostLife()); } else { playerView.Hit().Subscribe(_ => collisionRepository.Put(playerView)); } }
public void HandleUnitDeparted(GamePlayEvent ev) { this.SquadsInNode.Remove(GamePlayState.GetSquadById(ev.squadId)); }
public void HandleUnitArrived(GamePlayEvent ev) { this.SquadsInNode.Add (GamePlayState.GetSquadById(ev.squadId)); }
protected override void GamePlay(GamePlayEvent e) { OpenPanel(null); }
// Called once a GamePlay Event is received from the server public override void OnMessageReceived(GamePlayEvent gamePlayEvent) { print("GamePlayEvent received from server, event name: " + gamePlayEvent.eventName); }
protected override void GamePlay(GamePlayEvent e) { Reset(); }
protected override void GamePlay(GamePlayEvent e) { //OpenPanel(null); EventManager.Instance.Raise(new TimerBeforePlayEvent()); }
protected override void GamePlay(GamePlayEvent e) { Debug.Log("Play"); SpawnWaste(); }
public void OnUnitArrived(GamePlayEvent eventInfo) { // new code IHousable arrivalHousing = this.Housables.Single( housing => housing.ContainsNode(eventInfo.nodeId) ); arrivalHousing.HandleUnitArrived(eventInfo); Debug.Log("unit arrived!!!!"); }
public void HandleUnitArrived(GamePlayEvent ev) { this.unitsArrivedCount++; this.SquadsInBuilding.Add (GamePlayState.GetSquadById(ev.squadId)); }
protected override void GamePlay(GamePlayEvent e) { }
//Game State Events protected override void GamePlay(GamePlayEvent e) { Debug.Log("GamePlay"); ResetCamera(); }
protected virtual void GamePlay(GamePlayEvent e) { }
protected override void GamePlay(GamePlayEvent e) { Reset(); EventManager.Instance.Raise(new GoToNextPatternEvent()); }
public void OnUnitDeparted(GamePlayEvent eventInfo) { // refactored code IHousable departureHousing = this.Housables.Single( housing => housing.ContainsNode(eventInfo.nodeId) ); departureHousing.HandleUnitDeparted(eventInfo); Debug.Log("unit departed!!!!"); }
public void OnTryAgainButtonPressed() { gamePlayEventObserver.OnNext(GamePlayEvent.TryAgain()); view.DestroyView(); }