// Use this for initialization void Start() { ballcolor = new BallColor(Material1, Material2, renderer); scoreboard = new Scoreboard(); gameControl = new GameControl(); startPos = transform.position; }
// Start is called before the first frame update void Awake() { cam = GameObject.Find("Main Camera"); canvas = GameObject.Find("Canvas"); scoreboard = canvas.GetComponent <Scoreboard>(); DataCharge(); }
private Game(Clock clock, Scoreboard scoreboard, TextIO io, IRandom random) { _clock = clock; _scoreboard = scoreboard; _io = io; _random = random; }
/// <summary> /// Get all scoreboards /// </summary> /// <returns>scoreboards list</returns> public List <ScoreboardInfo> GetAll() { // Create a list for the scoreboards List <ScoreboardInfo> scoreboards = new List <ScoreboardInfo>(); // Loop through the JSON files in the contact scoreboard directory foreach (string filename in Directory.GetFiles(ScoreboardPath, "*.json")) { // Read the JSON from the file string json = File.ReadAllText(filename); // Deserialize the scoreboard Scoreboard scoreboard = JsonConvert.DeserializeObject <Scoreboard>(json); // Add the scoreboard to the results list scoreboards.Add(new ScoreboardInfo() { Id = scoreboard.Id, Title = scoreboard.Title }); } // Return the list with scoreboards return(scoreboards); }
private static void AssertActualIsSumOf(List <Scoreboard.PinsFloored> throws, List <int> expectedScores) { var expected = expectedScores.Sum(t => t); var actual = new Scoreboard(throws).Score; Assert.AreEqual(expected, actual); }
public virtual void EndRound() { Scoreboard scoreboard = WinningPlayer.GetComponent <Player>().Scoreboard; if (WinningPlayer.GetComponent <Player>().Scoreboard) { if (scoreboard) { scoreboard.DeActivate(); } } m_Rounds--; m_RoundOver = true; WinningPlayer.GetComponent <HoverCarControl>().BearCamera.DORect(WinningPlayer.GetComponent <HoverCarControl>().cameraRect, 1.0f); WinningPlayer.GetComponent <HoverCarControl>().BearCamera.GetComponent <HoverFollowCam>().enabled = true; LevelManager.FadeScreen(); if (m_Rounds == 0) { OnArenaExit(); } }
public async Task <IActionResult> PutScoreboard(int id, Scoreboard scoreboard) { if (id != scoreboard.scoreboardId) { return(BadRequest()); } _context.Entry(scoreboard).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ScoreboardExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Scoreboard> > PostScoreboard(Scoreboard scoreboard) { _context.Scoreboard.Add(scoreboard); await _context.SaveChangesAsync(); return(CreatedAtAction("GetScoreboard", new { id = scoreboard.scoreboardId }, scoreboard)); }
//============================================================ // Public Methods: //============================================================ public static void SaveScoreboard(Scoreboard scoreboard) { // turn the scoreboard into json, then save it to disk string scoreboardJson = JsonUtility.ToJson(scoreboard); File.WriteAllText(scoresFilePath, scoreboardJson); }
public void ThreePerfectGamesFinishedOneBad_ContainsOnlyTop3() { Config.ConnectionString = System.Reflection.MethodBase.GetCurrentMethod().Name; var hallOfFame = new BowlingKata.HallOfFame.HallOfFame(); var scoreBoard = new Scoreboard(); scoreBoard.GameFinished += hallOfFame.GameFinishedHappened; var game4 = Game.NewGameWithPlayer("bad 1 :)"); game4.RollHappened += scoreBoard.RollHappened; 20.Times(() => game4.Roll(1)); var game5 = Game.NewGameWithPlayer("bad 2 :)"); game5.RollHappened += scoreBoard.RollHappened; 20.Times(() => game5.Roll(1)); var game6 = Game.NewGameWithPlayer("bad 3 :)"); game6.RollHappened += scoreBoard.RollHappened; 20.Times(() => game6.Roll(1)); var game7 = Game.NewGameWithPlayer("bad 4 :)"); game7.RollHappened += scoreBoard.RollHappened; 20.Times(() => game7.Roll(1)); // These top 3 should show up in the hall of fame var game = Game.NewGameWithPlayer("1"); game.RollHappened += scoreBoard.RollHappened; 12.Times(() => game.Roll(10)); var game1 = Game.NewGameWithPlayer("2"); game1.RollHappened += scoreBoard.RollHappened; 12.Times(() => game1.Roll(10)); var game2 = Game.NewGameWithPlayer("3"); game2.RollHappened += scoreBoard.RollHappened; 12.Times(() => game2.Roll(10)); var game3 = Game.NewGameWithPlayer("4"); game3.RollHappened += scoreBoard.RollHappened; 12.Times(() => game3.Roll(10)); hallOfFame[0].Score.Should().Be(300); hallOfFame[1].Score.Should().Be(300); hallOfFame[2].Score.Should().Be(300); hallOfFame[0].PlayerName.Should().Be("1"); hallOfFame[1].PlayerName.Should().Be("2"); hallOfFame[2].PlayerName.Should().Be("3"); hallOfFame.Length.Should().Be(3); }
public StartUpWindow() { InitializeComponent(); main = new MainWindow(); controller = new Controller(main, new Game()); controller.Run(); scoreboard = new Scoreboard(controller); }
public void RePlay() { window.SetActive(true); Scoreboard.SetActive(false); GameObject pl = GameObject.FindWithTag("Player"); pl.GetComponent <ActorController>().RePlay(); }
private void Start() { if (updateScoreboard) { score = FindObjectOfType <Scoreboard>(); } StartCoroutine(SpawnWave()); }
public ActionResult DeleteConfirmed(int id) { Scoreboard scoreboard = db.scoreboard.Find(id); db.scoreboard.Remove(scoreboard); db.SaveChanges(); return(RedirectToAction("Index")); }
public void ShouldReturnZeroWhenHaveEmptyList() { this.scoreboard = new Scoreboard(); var actual = this.scoreboard.Players.Count; var expected = 0; Assert.AreEqual(expected, actual); }
internal bool Resolve(Scoreboard scoreboard) { var winner = _random.NextFloat() <= _probability ? scoreboard.Home : scoreboard.Visitors; scoreboard.Offense = winner; _io.WriteLine(_messageFormat, winner); return(false); }
public async Task <bool> UpdateFirebaseScoreboard(Scoreboard scoreboard) { var firebasePath = string.Format("scoreboard"); var response = await _firebaseClient.SetAsync(firebasePath, scoreboard); return(response.StatusCode == HttpStatusCode.OK); }
void Start() { var collider = gameObject.AddComponent <BoxCollider>(); collider.isTrigger = false; scoreboard = FindObjectOfType <Scoreboard>(); }
void Awake() { pc = FindObjectOfType <PlayerController>(); gm = FindObjectOfType <GameManager>(); am = FindObjectOfType <AudioManager>(); sc = FindObjectOfType <Scoreboard>(); an = FindObjectOfType <RopeController>().GetComponent <Animator>(); }
//////////////////////////////////////////////////////////////// // Unity Methods //////////////////////////////////////////////////////////////// protected override void Awake() { base.Awake(); this.defaultActive = false; // Find the single Scoreboard object by tag instance = GameObject.FindGameObjectsWithTag("Scoreboard")[0].GetComponent <Scoreboard>(); }
public static void SaveScoreboard(Scoreboard scoreboard) { string json = JsonConvert.SerializeObject(scoreboard); Debug.Log("Saving: " + json); PlayerPrefs.SetString(SCOREBOARD_KEY, json); PlayerPrefs.Save(); }
public static void AddScoreboard(Scoreboard scoreboard) { if (!Data.All.Contains(scoreboard)) { Data.All.Add(scoreboard); Instance.WriteData(Data); } }
public void KillAndRespawn() { NeuralNetController.staticRef.GrindMusic(); SoundCatalog.PlayGenerationSound(); Scoreboard.AddGeneration(); UpdateWeightAndRespawn(winners [0].index, winners [1].index, winners [2].index); ResetWinners(); }
public void Init() { storage = new StorageDisk(FolderPath); scoreboard = new Scoreboard(storage); storageMock = new StorageMock(); scoreboardMocked = new Scoreboard(storageMock); }
public void TestStartGameBothTeamsAreSame() { var scoreboard = new Scoreboard(); Team canadaTeam = new Team("Canada"); Assert.Throws <ArgumentException>(() => scoreboard.StartGame(canadaTeam, canadaTeam)); }
public void TwoNormalRolls() { Scoreboard scoreboard = new Scoreboard(); var game = scoreboard["1stGame"]; RollAndAssert(game, 3, 3); RollAndAssert(game, 4, 7); }
public void TestGetSummary() { var scoreboard = new Scoreboard(); Team mexicoTeam = new Team("Mexico"); Team canadaTeam = new Team("Canada"); var gameMexicoCanada = scoreboard.StartGame(mexicoTeam, canadaTeam); gameMexicoCanada.UpdateScore(2, 1); Assert.Equal("Mexico - Canada: 2 - 1", scoreboard.GetSummary().Trim()); Team spainTeam = new Team("Spain"); Team brazilTeam = new Team("Brazil"); var gameSpainBrazil = scoreboard.StartGame(spainTeam, brazilTeam); gameSpainBrazil.UpdateScore(4, 4); Assert.Equal( "Spain - Brazil: 4 - 4" + Environment.NewLine + "Mexico - Canada: 2 - 1", scoreboard.GetSummary().Trim()); Team germanyTeam = new Team("Germany"); Team franceTeam = new Team("France"); var gameGermanyFrance = scoreboard.StartGame(germanyTeam, franceTeam); gameGermanyFrance.UpdateScore(5, 3); Assert.Equal( "Spain - Brazil: 4 - 4" + Environment.NewLine + "Germany - France: 5 - 3" + Environment.NewLine + "Mexico - Canada: 2 - 1", scoreboard.GetSummary().Trim()); gameGermanyFrance.UpdateScore(5, 4); Assert.Equal( "Germany - France: 5 - 4" + Environment.NewLine + "Spain - Brazil: 4 - 4" + Environment.NewLine + "Mexico - Canada: 2 - 1", scoreboard.GetSummary().Trim()); gameSpainBrazil.FinishGame(); Assert.Equal( "Germany - France: 5 - 4" + Environment.NewLine + "Mexico - Canada: 2 - 1", scoreboard.GetSummary().Trim()); }
public static void DeleteScoreboardDataInHolder() { for (int i = 0; i < infoHolder.Length; i++) { infoHolder[i] = null; } info = null; }
public void RollingMoreThen21TimesShouldThrowException() { Scoreboard scoreboard = new Scoreboard(); var game = scoreboard["1stGame"]; Action act = () => 22.Times(() => game.Roll(5)); act.Should().Throw <IndexOutOfRangeException>(); }
public void StrikesOnly_ShouldReturn300() { Scoreboard scoreboard = new Scoreboard(); var game = scoreboard["1stGame"]; 12.Times(() => game.Roll(10)); game.CurrentScore().Should().Be(300); }
public void FivesOnlyShouldReturn150() { Scoreboard scoreboard = new Scoreboard(); var game = scoreboard["1stGame"]; 21.Times(() => game.Roll(5)); game.CurrentScore().Should().Be(150); }
public CommandProcessor(GameBoard board, Scoreboard score, IOInterface userIteractor, CommandParser commandParser) { this.gameBoard = board; this.scoreBoard = score; this.userIteractor = userIteractor; this.currentBoardState = new GameBoardMemory(); this.currentBoardState.Memento = board.SaveMemento(); this.commandParser = commandParser; this.remainingLives = INITIAL_LIVES; }
/// <summary> /// Initializes a new instance of the <see cref="StandartGameFifteenEngine"/> class. /// </summary> /// <param name="renderer">Object to print.</param> /// <param name="userInterface">Interacting with user.</param> /// <param name="gameInitializer">Initializing the game.</param> /// <param name="player">The player.</param> /// <param name="grid">Grid with tiles.</param> public StandartGameFifteenEngine(IRenderer renderer, IUserInterface userInterface, IGameInitializater gameInitializer, IPlayer player, IGrid grid) : base(gameInitializer) { this.renderer = renderer; this.userInterface = userInterface; this.player = player; this.scoreBoard = Scoreboard.Instance; this.grid = grid; this.gridMemory = new GridMemory(); }
public void ScoreboardShouldAddNewScoresWhenBoardIsNotFull() { var mockSerializer = new Mock<IScoreSerializer>(); mockSerializer.Setup(s => s.Load()).Returns(this.scores); mockSerializer.Setup(s => s.Save(It.Is<IList<Score>>(l => l.Count == 4))).Verifiable(); this.serializer = mockSerializer.Object; var scoreBoard = new Scoreboard(notifier, serializer, actionsReader); scoreBoard.AddToScoreboard(4, 5); mockSerializer.Verify(); }
public void ScoreboardPrintScores_WhenNoScores_ShouldPrint1Message() { var printer = new Mock<IPrinter>(); var messagesCount = 0; printer.Setup(p => p.PrintLine(It.IsAny<string>())) .Callback(() => ++messagesCount); var sorter = new SelectionSorter(); var scoreDataManager = new TextFileScoreboardDataManager<Dictionary<string, int>>("../../test-score.txt"); var scoreboard = new Scoreboard(printer.Object, sorter, scoreDataManager); scoreboard.PrintScore(); // check printer.Messages // assert Assert.AreEqual(1, messagesCount); }
public void ScoreboardShouldAddIfScoreIsHighAndBoardIsFull() { this.scores.Add(new Score(1, "Score1", 5)); this.scores.Add(new Score(2, "Score2", 6)); this.scores.Add(new Score(3, "Score3", 7)); this.scores.Add(new Score(1, "Score1", 5)); this.scores.Add(new Score(2, "Score2", 6)); this.scores.Add(new Score(3, "Score3", 7)); this.scores.Add(new Score(3, "Score3", 7)); var mockSerializer = new Mock<IScoreSerializer>(); mockSerializer.Setup(s => s.Load()).Returns(this.scores); mockSerializer.Setup(s => s.Save(It.IsAny<IList<Score>>())); this.serializer = mockSerializer.Object; var scoreBoard = new Scoreboard(notifier, serializer, actionsReader); scoreBoard.AddToScoreboard(2, 5); mockSerializer.Verify(s => s.Save(It.IsAny<IList<Score>>()), Times.Once); }
public void RenderScoreboard(Scoreboard scoreboard) { List<IPlayer> players = scoreboard.GetPlayers; this.RenderMessage(); if (players.Count == 0) { this.RenderMessage(Messages.ScoreboardEmptyMessage); } else { this.RenderMessage("Top 5: \n"); foreach (var player in players) { int scoreNumber = players.IndexOf(player) + 1; this.RenderMessage(string.Format("{0}. {1} - {2} moves.", scoreNumber, player.GetName(), player.GetScore())); } this.RenderMessage(); } }
protected override void endLevel() { if(!moved) { moved = true; MediaSystem.StopSiren(); BoxSpawnPoint = spawnTheSecond; GameManager.Space.DuringForcesUpdateables.Starting += updateCamera; MediaSystem.LevelReset(); MediaSystem.PlayVoiceActing(11); boxesMax = boxesMaxTwo; boxesNeeded = boxesNeedTwo; scoreboard = new Scoreboard(levelTheme.TextColor, boxesNeedTwo, boxesMaxTwo, spawnTime); scoreAtCheckpoint = score; timeAtCheckpoint = time; lostAtCheckpoint = BoxesDestroyed; BoxesDestroyed = 0; boxesSaved = 0; BoxesRemaining = boxesMaxTwo; RenderingDevice.Add(baseTheSecond); GameManager.Space.Add(baseTheSecond); while(boxesOnscreen.Count > 0) { RenderingDevice.RemovePermanent(boxesOnscreen[0]); GameManager.Space.Remove(boxesOnscreen[0]); boxesOnscreen.RemoveAt(0); } TemporarilyMuteVoice = false; catcherTheSecond.AddToGame(GameManager.Space); int i = 0; foreach(OperationalMachine m in MachineList.Keys) { i++; if(i < 12) continue; else { RenderingDevice.Add(m); GameManager.Space.Add(m); } } i = 0; foreach(Tube m in tubeList) { i++; if(i < 111) continue; else { RenderingDevice.Add(m); GameManager.Space.Add(m); } } i = 0; foreach(BaseModel m in glassModels) { i++; if(i < 6) continue; else { RenderingDevice.Add(m); //GameManager.Space.Add(m); } } } else { base.endLevel(); results = new ResultsScreen(time, BoxesDestroyed + lostAtCheckpoint, score, levelNumber, CompletionData); } }
public override void ResetLevel() { speed = Vector3.Zero; GameManager.Space.DuringForcesUpdateables.Starting -= updateCamera; if(moved) { base.ResetLevel(); if(catcherTheSecond.Ent.Space == null) catcherTheSecond.AddToGame(GameManager.Space); score = scoreAtCheckpoint; overlay = null; if(!TemporarilyMuteVoice) MediaSystem.PlayVoiceActing(11); RenderingDevice.Camera.TargetPosition = secondCameraPoint; return; //int i = 0; //foreach(Machine m in MachineList.Keys) //{ // i++; // if(i < 12) // continue; // else // { // m.RemoveModelsFromRenderer(); // m.RemoveFromSpace(GameManager.Space); // } //} //i = 0; //foreach(Tube m in tubeList) //{ // i++; // if(i < 251) // continue; // else // { // RenderingDevice.Remove(m); // GameManager.Space.Remove(m); // } //} //i = 0; //foreach(BaseModel m in glassModels) //{ // i++; // if(i < 8) // continue; // else // { // RenderingDevice.Remove(m); // GameManager.Space.Remove(m); // } //} } RenderingDevice.Camera.SetForResultsScreen(); BoxSpawnPoint = spawnTheFirst; boxesMax = boxesMaxOne; scoreboard = new Scoreboard(levelTheme.TextColor, boxesNeedOne, boxesMaxOne, spawnTime); boxesNeeded = boxesNeedOne; scoreAtCheckpoint = lostAtCheckpoint = 0; timeAtCheckpoint = TimeSpan.Zero; base.ResetLevel(); }
public void Start() { board = this; modifyLivesBy(0); modifyScore(0, Scoreboard.ScoreType.OTHER); }
/// <summary> /// Start Game logic /// </summary> public void Start() { // Initialize the two basic objects needed for user interactions this.InputProvider = this.inputProvider ?? new ConsoleInputProvider(); this.OutputRenderer = this.outputRenderer ?? new ConsoleRenderer(); // Render initial UI this.OutputRenderer.RenderWelcomeScreen(string.Join(string.Empty, RenderersConstants.GameTitle)); this.OutputRenderer.RenderNewPlayerCreationRequest(); // Create the active player var player = new Player(this.InputProvider.ReceiveInputLine()); // Render console menu handler and execute logic for requesting board settings // TODO: Refactor menu handler logic int[] cursorPosition = this.OutputRenderer.GetCursor(); var menuItems = new List<IGameMode>() { new BeginnerMode(), new IntermediateMode(), new ExpertMode() }; var menuHandler = new ConsoleMenuHandler(this.inputProvider, this.outputRenderer, menuItems, cursorPosition[0] + 1, cursorPosition[1]); menuHandler.ShowSelections(); BoardSettings boardSettings = menuHandler.RequestUserSelection(); this.OutputRenderer.ClearScreen(); this.OutputRenderer.SetCursor(visible: true); //// End of menu handler logic var board = new Board(boardSettings, new List<IBoardObserver>()); var scoreboard = new Scoreboard(); var contentFactory = new ContentFactory(); var initializationStrategy = new StandardGameInitializationStrategy(contentFactory); var boardOperator = new CommandOperator(board, scoreboard); var engine = new StandardOnePlayerMinesweeperEngine(board, this.inputProvider, this.outputRenderer, boardOperator, scoreboard, player); engine.Initialize(initializationStrategy); board.Subscribe(engine); engine.Run(); }
void Awake(){ Instance = this; }
void Awake() { scoreboard = this; }
public void SetUpPlayer(string playerName, NetworkViewID horizontalID, NetworkViewID verticalID, NetworkViewID cornerID, string colorName) { gameObject.name = playerName; //Set up scoreboards if (IsOwnedByServer()) { _myScoreboard = Server.Get().GetComponent<Scoreboard>(); _myScoreboard.player = this; _enemyScoreboard = Client.Get().GetComponent<Scoreboard>(); } else { _myScoreboard = Client.Get().GetComponent<Scoreboard>(); _myScoreboard.player = this; _enemyScoreboard = Server.Get().GetComponent<Scoreboard>(); } //My sprites string normalSpriteFilename = "Sprites/fighter_" + colorName; string thrustingSpriteFilename = "Sprites/fighter_" + colorName + "_thrust"; GetComponent<Thruster>().SetSprites(normalSpriteFilename, thrustingSpriteFilename); //Weapon sprites _missileSpriteFilename = "Sprites/missile_" + colorName; _thrustingMissileSpriteFilename = "Sprites/missile_" + colorName + "_thrust"; _mineSpriteFilename = "Sprites/mine_" + colorName; SetUpTorusClone(out _torusHorizontal, horizontalID, playerName, normalSpriteFilename, thrustingSpriteFilename); SetUpTorusClone(out _torusVertical, verticalID, playerName, normalSpriteFilename, thrustingSpriteFilename); SetUpTorusClone(out _torusCorner, cornerID, playerName, normalSpriteFilename, thrustingSpriteFilename); GetComponent<Thruster>().SetTorusClones(_torusHorizontal, _torusVertical, _torusCorner); }
/// <summary> /// Start Game logic /// </summary> public void Start(Grid root) { // Initialize the two basic objects needed for user interactions this.InputProvider = this.inputProvider ?? new WpfInputProvider(); this.OutputRenderer = this.outputRenderer ?? new WpfRenderer(root); string testPlayerName = "John"; // Create the active player var player = new Player(testPlayerName); BoardSettings testBoardSettings = new EasyBoardSettings(); var board = new Board(testBoardSettings, new List<IBoardObserver>()); var scoreboard = new Scoreboard(); var contentFactory = new ContentFactory(); var initializationStrategy = new StandardGameInitializationStrategy(contentFactory); var boardOperator = new CommandOperator(board, scoreboard); var engine = new StandardOnePlayerMinesweeperEngine(board, this.inputProvider, this.outputRenderer, boardOperator, scoreboard, player); engine.Initialize(initializationStrategy); board.Subscribe(engine); engine.Run(); }
/// <summary> /// Prints scores of players. /// </summary> /// <param name="scoreboard">Uses a <see cref="GameFifteen.Models.Scoreboard"/> that contains players with scores.</param> public void RenderScoreboard(Scoreboard scoreboard) { int x = RenderConstants.InitialScoreboardX; int y = RenderConstants.InitialScoreboardY; this.ClearConsole(); this.PrintOnPosition(x, y++, RenderConstants.Scoreboard, RenderConstants.GameMessagesColor); if (scoreboard.TopPlayers.Count == 0) { this.PrintOnPosition(x, y++, RenderConstants.NoTopPlayers, RenderConstants.UserMessagesColor); } else { int position = 1; var scoreboardLines = scoreboard.GetTextRepresentation().Split('|'); foreach (string line in scoreboardLines) { var playerLine = line.Split(new string[] { "->" }, StringSplitOptions.None); this.PrintOnPosition(x, y, position.ToString() + ". ", RenderConstants.GameMessagesColor); this.PrintOnPosition(Console.CursorLeft, y, playerLine[0], RenderConstants.UserMessagesColor); this.PrintOnPosition(Console.CursorLeft, y, " -> ", RenderConstants.GameMessagesColor); this.PrintOnPosition(Console.CursorLeft, y++, playerLine[1], RenderConstants.UserMessagesColor); position++; } } this.PrintOnPosition(x, y++, string.Empty, RenderConstants.UserMessagesColor); this.SaveCursorCurrentPosition(); }
// Use this for initialization void Awake() { GameObject gameController = GameObject.FindGameObjectWithTag("GameController"); if (gameController) scoreboard = gameController.GetComponent<Scoreboard>(); }
/// <summary> /// Create a new level. /// </summary> /// <param name="levelNo">The level number.</param> /// <param name="boxesMax">The number of boxes the level will give you.</param> /// <param name="boxNeed">The amount of boxes you need to win.</param> /// <param name="spawnPoint">The Vector3 to spawn boxes at.</param> /// <param name="levelTheme">The theme to use.</param> /// <param name="glassModels">The array of glass models to use.</param> /// <param name="billboardsThisLevel">A list of Vector3's that determine the location /// of this level's machine's billboards.</param> /// <param name="levelModel">A model of the level's static parts (machine bases and such).</param> /// <param name="machines">A list of machines in this level.</param> /// <param name="coloredCatcher">If the level has a colored catcher, this is it.</param> /// <param name="normalCatcher">The level's Catcher.</param> /// <param name="tubes">All the tubes. Lots... and lots... of tubes.</param> /// <param name="data">Data detailing the elite requirements of complete completion.</param> /// <param name="name">Level's name.</param> public Level(int levelNo, int boxesMax, int boxNeed, Vector3 spawnPoint, List<Vector3> billboardsThisLevel, Theme levelTheme, BaseModel levelModel, BaseModel[] glassModels, Goal normalCatcher, Goal coloredCatcher, Dictionary<OperationalMachine, bool> machines, List<Tube> tubes, LevelCompletionData data, string name) { levelNumber = levelNo; this.levelTheme = levelTheme; scoreboard = new Scoreboard(levelTheme.TextColor, boxNeed, boxesMax, 16333); this.boxesMax = boxesMax; boxesSaved = 0; BoxesDestroyed = 0; BoxesRemaining = boxesMax; boxesNeeded = boxNeed; BoxSpawnPoint = spawnPoint; levelName = name; boxesOnscreen = new List<Box>(); tubeList = new List<Tube>(tubes); MachineList = new Dictionary<OperationalMachine, bool>(machines); Board = new Billboard(effectDelegate); this.levelModel = levelModel; //LevelModel.Lighting = levelTheme.Lighting; this.glassModels = new List<BaseModel>(); textureList = new Texture2D[billboardsThisLevel.Count]; activeList = new Texture2D[billboardsThisLevel.Count]; this.normalCatcher = normalCatcher; this.coloredCatcher = coloredCatcher; CompletionData = data; foreach(BaseModel m in glassModels) this.glassModels.Add(m); foreach(OperationalMachine mach in machines.Keys) foreach(BaseModel m in mach.GetGlassModels()) this.glassModels.Add(m); //foreach(Machine m in machines.Keys) // m.ApplyLighting(levelTheme.Lighting); if(billboardsThisLevel.Count != 0) Board.CreateBillboardVerticesFromList(billboardsThisLevel); for(int i = 0; i < textureList.Length; i++) { textureList[i] = billboardList[i]; activeList[i] = activeBillboardList[i]; } dispenser = new BaseModel(Dispenser, false, null, BoxSpawnPoint); dispenser.Ent.BecomeKinematic(); //if(levelNumber != 0) // Program.Game.Manager.CurrentSave.LevelData.SetCompletionData(levelNumber, data); gdmReset += onGDMReset; }
public void ScoreboardShouldDisplayScoresWhenThereAreAny() { var mockSerializer = new Mock<IScoreSerializer>(); mockSerializer.Setup(s => s.Load()).Returns(this.scores); mockSerializer.Setup(s => s.Save(It.IsAny<IList<Score>>())); serializer = mockSerializer.Object; var mockNotifier = new Mock<IScoreNotifier>(); mockNotifier.Setup(n => n.Notify(It.IsAny<string>())).Verifiable(); mockNotifier.Setup(n => n.DisplayScores(It.IsAny<IList<Score>>())); this.notifier = mockNotifier.Object; var scoreBoard = new Scoreboard(notifier, serializer, actionsReader); scoreBoard.DisplayTopScores(); mockNotifier.Verify(n => n.DisplayScores(It.IsAny<IList<Score>>()), Times.Once); }
/// <summary> /// Gets the score board corresponding to this game save data. /// </summary> /// <param name="orderedColumnIndicesToSort">The ordered column indices to sort on. /// The indicides that are specified first in the aray are the first that are sorted /// on. If there is a tie, the next indicies in the array are used, and so on.</param> /// <returns>The Scoreboard corresponding to this game save data.</returns> public Scoreboard GetScoreBoard(int[] orderedColumnIndicesToSort) { // If the scoreboard is already created, just sort and return. if (!this.updateScoreboard && this.scoreBoardCache != null) { this.scoreBoardCache.Sort(orderedColumnIndicesToSort, this.columnSortOrder, false); return this.scoreBoardCache; } // Failsafe. if (this.buffer == null || this.buffer.Length < 33) { return null; } this.scoreBoardCache = new Scoreboard(); int numberOfBufferEntries = this.NumberOfBufferEntries(); for (int i = 0; i < numberOfBufferEntries; i++) { int gamertagIndex = this.GetGamertagIndex(i); string gamertag = this.GetGamertag(gamertagIndex, 20); int[] columns = new int[this.buffer[0]]; int blockSize = this.GetBlockSize(); int index = 0; for (int j = gamertagIndex + 20; j < gamertagIndex + blockSize && j + 3 < this.buffer.Length; j += 4) { columns[index] = 0; columns[index] |= (int)this.buffer[j + 3]; columns[index] |= (int)(((int)this.buffer[j + 2]) << 8); columns[index] |= (int)(((int)this.buffer[j + 1]) << 16); columns[index] |= (int)(((int)this.buffer[j]) << 24); index++; } this.scoreBoardCache.Add(new PlayerScore(gamertag, columns)); } this.updateScoreboard = false; this.scoreBoardCache.Sort(orderedColumnIndicesToSort, this.columnSortOrder, true); return this.scoreBoardCache; }
public void Initialize() { PlaySpace = new Field(); Scoreboard = new Scoreboard(); Vector2 windowSize = new Vector2(pixlGame.GraphicsDevice.Viewport.Width, pixlGame.GraphicsDevice.Viewport.Height); Vector2 psp; psp.X = (windowSize.X - PlaySpace.RenderSize.X) / 2f; psp.Y = windowSize.Y - PlaySpace.RenderSize.Y - 50f; PlaySpace.Position = psp; Team1 = new Team("Broadway Bisons", this); Team2 = new Team("New Jersey Devils", this); Ball = new Ball(); Team1.Initialize(); Team2.Initialize(); /* KeyboardResult = Guide.BeginShowKeyboardInput(PlayerIndex.One, "TeamName entry", "Enter the team's name here", "Boradway Bisons", null, null); Team1.TeamName = Guide.EndShowKeyboardInput(KeyboardResult); */ Team1.Color = Color.Cyan; Team2.Color = new Color(167, 167, 167); AudioM = new AudioManager(); AudioM.Initialize(); time = QUARTERTIME; AddRule(new OutOfBounds(this, new LightOnFire(Judgement.JudgementType.TeamMember))); AddRule(new OutOfBounds(this, new Rebound(this))); AddRule(new RunInGoal(this, new ScoreExchange(this))); AddRule(new ThroughThePostsGoal(this, new ScoreChange(this, 7))); AddRule(new OutTheBackGoal(this, new Rebound(this))); AddRule(new PassInGoal(this, new ScoreChange(this, 5))); AddPlayer(Team1, InputController.InputMode.Player1); AddPlayer(Team2, InputController.InputMode.Player2); MenuM = new MenuManager(this); MenuM.Initialize(); }
// Use this for initialization void Start() { _instance = this; _userName = PlayerPrefs.GetString("userName", "Awesome Person"); _scoreboard = GameObject.Find ("Scoreboard").GetComponent<Scoreboard>(); _chatMessages = new List<string>(); _cameraPos = myCamera.transform.position; _cameraRot = myCamera.transform.rotation; //players = new List<PlayerData>(); }
void Awake() { S = this; }
void Start() { instance = this; }