private void OnDestroy() { SignalMachine.RemoveListener <SimpleTapSignal>(OnTap); SignalMachine.RemoveListener <DeathSignal>(OnDeath); SignalMachine.RemoveListener <PointScoredSignal>(OnPoint); SignalMachine.RemoveListener <RestartSignal>(OnRestartCalled); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Bird") { SignalMachine.Call(new DeathSignal()); } }
private void Start() { SignalMachine.AddListener <SimpleTapSignal>(OnTap); SignalMachine.AddListener <DeathSignal>(OnDeath); SignalMachine.AddListener <PointScoredSignal>(OnPoint); SignalMachine.AddListener <RestartSignal>(OnRestartCalled); }
private void Start() { SetMode(MovementMode.Idle); SignalMachine.AddListener <GameStartedSignal>(OnGameStarted); SignalMachine.AddListener <SimpleTapSignal>(OnTap); SignalMachine.AddListener <DeathSignal>(OnDeath); }
public void Move(Vector3 delta) { transform.position += delta; if (!Scored && scorePoint.position.x < controller.ScoringPoint.x) { Scored = true; SignalMachine.Call(new PointScoredSignal(this)); } }
private void OnTap(SimpleTapSignal tap) { if (State == LoopState.PreGame) { State = LoopState.InGame; SignalMachine.Call(new GameStartedSignal()); SignalMachine.Call(new NewScoreSignal(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); } }
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"); } } }
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); }
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; } }
private void OnPointScored(PointScoredSignal obj) { ++pointsCounted; if (pointsCounted >= PointsToBomb) { pointsCounted -= PointsToBomb; ++Count; if (Count > MaxBombs) { Count = MaxBombs; } else { SignalMachine.Call(new NewBombCountSignal(Count)); } } }
private void OnDestroy() { SignalMachine.RemoveListener <GameStartedSignal>(OnGameStart); SignalMachine.AddListener <DeathSignal>(OnGameEnd); }
private void OnDestroy() { SignalMachine.RemoveListener <PointScoredSignal>(OnPointScored); SignalMachine.RemoveListener <DoubleTapSignal>(OnDoubleTap); }
private void Awake() { SignalMachine.AddListener <PointScoredSignal>(OnPointScored); SignalMachine.AddListener <DoubleTapSignal>(OnDoubleTap); }
private void OnPoint(PointScoredSignal obj) { ++Score; SignalMachine.Call(new NewScoreSignal(Score)); }
private void OnDestroy() { SignalMachine.RemoveListener <GameStartedSignal>(OnGameStarted); SignalMachine.RemoveListener <SimpleTapSignal>(OnTap); SignalMachine.RemoveListener <DeathSignal>(OnDeath); }
private void Start() { SignalMachine.Call(new NewBombCountSignal(Count)); }