Exemplo n.º 1
0
    public override void OnUDPEventReceived(GamePlayEvent gamePlayEvent)
    {
        base.OnUDPEventReceived(gamePlayEvent);

        if (gamePlayEvent.eventName == "Start")
        {
            //edgeManager.HandleWebSocketMessage("gameStart");
        }
    }
Exemplo n.º 2
0
        public void Execute()
        {
            var nextLevel = playerRepository.GetLevel() + 1;

            configuration.AllLevels.ElementAtOrDefault(nextLevel).ToMaybe()
            .Match(_ =>
            {
                playerRepository.SetLevel(nextLevel);
                startLevel.Execute();
            }, () => gamePlayEventObserver.OnNext(GamePlayEvent.GameOver()));
        }
Exemplo n.º 3
0
 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());
 }
Exemplo n.º 4
0
        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;
            }
        }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
 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>();
     })));
 }
Exemplo n.º 7
0
        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));
            }
        }
Exemplo n.º 8
0
 public void HandleUnitDeparted(GamePlayEvent ev)
 {
     this.SquadsInNode.Remove(GamePlayState.GetSquadById(ev.squadId));
 }
Exemplo n.º 9
0
 public void HandleUnitArrived(GamePlayEvent ev)
 {
     this.SquadsInNode.Add (GamePlayState.GetSquadById(ev.squadId));
 }
Exemplo n.º 10
0
 protected override void GamePlay(GamePlayEvent e)
 {
     OpenPanel(null);
 }
Exemplo n.º 11
0
 // 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);
 }
Exemplo n.º 12
0
 protected override void GamePlay(GamePlayEvent e)
 {
     Reset();
 }
Exemplo n.º 13
0
 protected override void GamePlay(GamePlayEvent e)
 {
     //OpenPanel(null);
     EventManager.Instance.Raise(new TimerBeforePlayEvent());
 }
Exemplo n.º 14
0
 protected override void GamePlay(GamePlayEvent e)
 {
     Debug.Log("Play");
     SpawnWaste();
 }
Exemplo n.º 15
0
    public void OnUnitArrived(GamePlayEvent eventInfo)
    {
        // new code
        IHousable arrivalHousing = this.Housables.Single( housing =>
                housing.ContainsNode(eventInfo.nodeId) );

        arrivalHousing.HandleUnitArrived(eventInfo);

        Debug.Log("unit arrived!!!!");
    }
Exemplo n.º 16
0
 public void HandleUnitArrived(GamePlayEvent ev)
 {
     this.unitsArrivedCount++;
     this.SquadsInBuilding.Add (GamePlayState.GetSquadById(ev.squadId));
 }
Exemplo n.º 17
0
 protected override void GamePlay(GamePlayEvent e)
 {
 }
Exemplo n.º 18
0
 //Game State Events
 protected override void GamePlay(GamePlayEvent e)
 {
     Debug.Log("GamePlay");
     ResetCamera();
 }
 protected virtual void GamePlay(GamePlayEvent e)
 {
 }
Exemplo n.º 20
0
 protected override void GamePlay(GamePlayEvent e)
 {
     Reset();
     EventManager.Instance.Raise(new GoToNextPatternEvent());
 }
Exemplo n.º 21
0
    public void OnUnitDeparted(GamePlayEvent eventInfo)
    {
        // refactored code
        IHousable departureHousing = this.Housables.Single( housing =>
                housing.ContainsNode(eventInfo.nodeId) );

        departureHousing.HandleUnitDeparted(eventInfo);

        Debug.Log("unit departed!!!!");
    }
Exemplo n.º 22
0
 public void OnTryAgainButtonPressed()
 {
     gamePlayEventObserver.OnNext(GamePlayEvent.TryAgain());
     view.DestroyView();
 }