Пример #1
0
 private void OnDestroy()
 {
     SignalMachine.RemoveListener <SimpleTapSignal>(OnTap);
     SignalMachine.RemoveListener <DeathSignal>(OnDeath);
     SignalMachine.RemoveListener <PointScoredSignal>(OnPoint);
     SignalMachine.RemoveListener <RestartSignal>(OnRestartCalled);
 }
Пример #2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Bird")
     {
         SignalMachine.Call(new DeathSignal());
     }
 }
Пример #3
0
 private void Start()
 {
     SignalMachine.AddListener <SimpleTapSignal>(OnTap);
     SignalMachine.AddListener <DeathSignal>(OnDeath);
     SignalMachine.AddListener <PointScoredSignal>(OnPoint);
     SignalMachine.AddListener <RestartSignal>(OnRestartCalled);
 }
Пример #4
0
        private void Start()
        {
            SetMode(MovementMode.Idle);

            SignalMachine.AddListener <GameStartedSignal>(OnGameStarted);
            SignalMachine.AddListener <SimpleTapSignal>(OnTap);
            SignalMachine.AddListener <DeathSignal>(OnDeath);
        }
Пример #5
0
 public void Move(Vector3 delta)
 {
     transform.position += delta;
     if (!Scored && scorePoint.position.x < controller.ScoringPoint.x)
     {
         Scored = true;
         SignalMachine.Call(new PointScoredSignal(this));
     }
 }
Пример #6
0
 private void OnTap(SimpleTapSignal tap)
 {
     if (State == LoopState.PreGame)
     {
         State = LoopState.InGame;
         SignalMachine.Call(new GameStartedSignal());
         SignalMachine.Call(new NewScoreSignal(0));
     }
 }
Пример #7
0
        private void Start()
        {
            SignalMachine.AddListener <GameStartedSignal>(OnGameStart);
            SignalMachine.AddListener <DeathSignal>(OnGameEnd);

            for (int i = 0; i < 20; ++i)
            {
                var obst = Instantiate(obstaclePrefab, transform);
                obst.gameObject.SetActive(false);
                pipePool.Add(obst);
            }
        }
Пример #8
0
 private void OnDeath(DeathSignal arg)
 {
     if (State == LoopState.InGame)
     {
         State = LoopState.PostGame;
         if (LeaderboardService.TryAdd(new LeaderboardEntry(Score)))
         {
             SignalMachine.Call(new NewLeaderboardScoreSignal());
             Debug.Log("On leaderboard");
         }
     }
 }
Пример #9
0
        private void Explode()
        {
            if (Count == 0)
            {
                return;
            }

            --Count;
            SignalMachine.Call(new NewBombCountSignal(Count));

            var min = boundsCamera.ScreenToWorldPoint(new Vector3(0, 0, 0)).x;
            var max = boundsCamera.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x;

            obstacles.DestroyPipesBetween(min, max);
        }
Пример #10
0
 private void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         SignalMachine.Call(new SimpleTapSignal());
         if (timeSinceLastTap < 0.25f)
         {
             SignalMachine.Call(new DoubleTapSignal());
         }
         timeSinceLastTap = 0;
     }
     else
     {
         timeSinceLastTap += Time.deltaTime;
     }
 }
Пример #11
0
 private void OnPointScored(PointScoredSignal obj)
 {
     ++pointsCounted;
     if (pointsCounted >= PointsToBomb)
     {
         pointsCounted -= PointsToBomb;
         ++Count;
         if (Count > MaxBombs)
         {
             Count = MaxBombs;
         }
         else
         {
             SignalMachine.Call(new NewBombCountSignal(Count));
         }
     }
 }
Пример #12
0
 private void OnDestroy()
 {
     SignalMachine.RemoveListener <GameStartedSignal>(OnGameStart);
     SignalMachine.AddListener <DeathSignal>(OnGameEnd);
 }
Пример #13
0
 private void OnDestroy()
 {
     SignalMachine.RemoveListener <PointScoredSignal>(OnPointScored);
     SignalMachine.RemoveListener <DoubleTapSignal>(OnDoubleTap);
 }
Пример #14
0
 private void Awake()
 {
     SignalMachine.AddListener <PointScoredSignal>(OnPointScored);
     SignalMachine.AddListener <DoubleTapSignal>(OnDoubleTap);
 }
Пример #15
0
 private void OnPoint(PointScoredSignal obj)
 {
     ++Score;
     SignalMachine.Call(new NewScoreSignal(Score));
 }
Пример #16
0
 private void OnDestroy()
 {
     SignalMachine.RemoveListener <GameStartedSignal>(OnGameStarted);
     SignalMachine.RemoveListener <SimpleTapSignal>(OnTap);
     SignalMachine.RemoveListener <DeathSignal>(OnDeath);
 }
Пример #17
0
 private void Start()
 {
     SignalMachine.Call(new NewBombCountSignal(Count));
 }