void Start() { _controller = Pongstar.Get<GameController>(); var model = _controller.UI(); var sm = _controller.Score(); if (sm != null) _score = sm.As<Score>(); /* Fudge score for tests */ else { _score = new Score(); _score.Update(53223 + nRand.Int(100, 50), "Lucky"); _score.Winner = WinState.PLAYER; } /* Add to high scores? */ _controller.UpdateScore(_score.Points); _highscores = _controller.HighScores().Scores; /* Win noise~ */ model.Game.Audio = new nAudio(this.gameObject); Ps.Model.Actions.Game.SetupAudio(model.Game.Audio); if (_score.Winner == WinState.AI) model.Game.Audio.Play(Ps.Model.Actions.Game.WIN_LOSE_CHANNEL, Ps.Model.Actions.Game.LOSE_SOUND, 1f); else model.Game.Audio.Play(Ps.Model.Actions.Game.WIN_LOSE_CHANNEL, Ps.Model.Actions.Game.WIN_SOUND, 1f); /* Background~ */ _f = new Field(null, model.Camera); /* setup camera */ if (_pipe == null) { model.Camera.Active = true; _pipe = model.Camera.Pipe; _pipe.Drawables.Add(_f.Display); _c = new Collectables(model.Game); _pipe.Drawables.Add(_c.Display); } _ready = true; }
void Start() { _controller = Pongstar.Get<GameController>(); var model = _controller.Start(this.gameObject); /* setup camera */ if (_pipe == null) { model.Camera.Active = true; _pipe = model.Camera.Pipe; } /* setup drawables */ _pipe.Drawables.Clear(); foreach (var c in model.Items) { _pipe.Drawables.Add(c); } }