public void GameBoard_Get_InvalidMove_Positive() { var rows = 8; var cols = 8; var props = new GameProperties(new Bounds(rows, cols), 2, 2); var tokens = new[] { new Token(1, "player1", TokenType.Flag, 1, 2), new Token(1, "player2", TokenType.Flag, 3, 4) }; var gameBoard = new GameBoard(props, tokens); gameBoard.Get(100, 100); // throws }
public async Task<Game> CreateSinglePlayerGameAsync(Player player, GameProperties properties) { var gameBoard = GameBoard.New(properties, player, Player.ComputerPlayer); var status = GameStatus.CreateActive(player, Player.ComputerPlayer); var game = new Game(0, player, Player.ComputerPlayer, status, gameBoard); var results = await repository.CreateAsync(game); return results; }
public MicrobeSpawner(Species species, CompoundCloudSystem cloudSystem, GameProperties currentGame) { this.species = species ?? throw new ArgumentException("species is null"); microbeScene = SpawnHelpers.LoadMicrobeScene(); this.cloudSystem = cloudSystem; this.currentGame = currentGame; random = new Random(); }
private void Start() { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; gP = GameProperties.Instance; transform.eulerAngles = Vector3.zero; input = ReInput.players.Players[0]; camera = GetComponent <Camera>(); }
public void StartNewGame() { CurrentGame = GameProperties.StartNewMicrobeGame(); CreatePatchManagerIfNeeded(); UpdatePatchSettings(false); SpawnPlayer(); }
private void Start() { if (Singleton != null) { Destroy(gameObject); return; } Singleton = this; DontDestroyOnLoad(this); }
public void Init() { m_gameProperties = GetComponent <GameProperties>(); m_gameStateManager = gameObject.AddComponent <GameStateManager>(); m_gameStateManager.Init(); m_inputHandler = gameObject.AddComponent <InputHandler>(); m_uiManager = gameObject.AddComponent <UIManager>(); m_playerManager = gameObject.AddComponent <PlayerManager>(); m_playerManager.Init(); }
public PatchManager(SpawnSystem spawnSystem, ProcessSystem processSystem, CompoundCloudSystem compoundCloudSystem, TimedLifeSystem timedLife, DirectionalLight worldLight, GameProperties currentGame) { this.spawnSystem = spawnSystem; this.processSystem = processSystem; this.compoundCloudSystem = compoundCloudSystem; this.timedLife = timedLife; this.worldLight = worldLight; this.currentGame = currentGame; }
void KillAllSupervisors(GameProperties gameProperties) { var sups = gameProperties. Membership.GetMembership() .Teams.SelectMany(x => x.Players) .Select(p => SupervisorsService .Instance .GetSupervisorFor(p)); SupervisorsService.Instance.KillSupervisors(sups); }
private string PrintGameProperties(GameProperties properties) { string text = string.Empty; text = "Game Properties: ["; int creationAttributesCount = properties.CreationAttributesCount; text += "Creation Attributes: "; for (int i = 0; i < creationAttributesCount; i++) { bnet.protocol.attribute.Attribute attribute = properties.CreationAttributes[i]; string text2 = text; text = string.Concat(new object[] { text2, "[Name: ", attribute.Name, " Value: ", attribute.Value, "] " }); } if (properties.HasFilter) { this.PrintGameMasterAttributeFilter(properties.Filter); } if (properties.HasCreate) { string text2 = text; text = string.Concat(new object[] { text2, "Create New Game?: ", properties.Create, " " }); } if (properties.HasOpen) { string text2 = text; text = string.Concat(new object[] { text2, "Game Is Open?: ", properties.Open, " " }); } if (properties.HasProgramId) { text = text + "Program Id(4CC): " + properties.ProgramId; } return(text); }
public bool PrepareGame(GameProperties gameProperties) { var supervisors = PrepareSupervisors(gameProperties); var timers = PrepareTimers(gameProperties); if (supervisors != null && timers != null) { return(true); } return(false); }
private void OnFreebuildFadeInEnded() { // Instantiate a new editor scene var editor = (MicrobeEditor)SceneManager.Instance.LoadScene(MainGameState.MicrobeEditor).Instance(); // Start freebuild game editor.CurrentGame = GameProperties.StartNewMicrobeGame(true); // Switch to the editor scene SceneManager.Instance.SwitchToScene(editor); }
public void FindGame(byte[] requestGuid, int gameType, int scenario, long deckId, long aiDeckId, bool setScenarioIdAttr) { if (this.s_gameRequest != 0UL) { LogAdapter.Log(LogLevel.Warning, "WARNING: FindGame called with an active game"); this.CancelFindGame(this.s_gameRequest); this.s_gameRequest = 0UL; } Player player = new Player(); Identity identity = new Identity(); identity.SetGameAccountId(this.m_battleNet.GameAccountId); player.SetIdentity(identity); player.AddAttribute(ProtocolHelper.CreateAttribute("type", (long)gameType)); player.AddAttribute(ProtocolHelper.CreateAttribute("scenario", (long)scenario)); player.AddAttribute(ProtocolHelper.CreateAttribute("deck", (long)((int)deckId))); player.AddAttribute(ProtocolHelper.CreateAttribute("aideck", (long)((int)aiDeckId))); player.AddAttribute(ProtocolHelper.CreateAttribute("request_guid", requestGuid)); GameProperties gameProperties = new GameProperties(); AttributeFilter attributeFilter = new AttributeFilter(); attributeFilter.SetOp(AttributeFilter.Types.Operation.MATCH_ALL); if (!BattleNet.IsVersionInt()) { attributeFilter.AddAttribute(ProtocolHelper.CreateAttribute("version", BattleNet.GetVersion())); } else { int num = 0; if (!int.TryParse(BattleNet.GetVersion(), out num)) { LogAdapter.Log(LogLevel.Error, "Could not convert BattleNetVersion to int: " + BattleNet.GetVersion()); } attributeFilter.AddAttribute(ProtocolHelper.CreateAttribute("version", (long)num)); } attributeFilter.AddAttribute(ProtocolHelper.CreateAttribute("GameType", (long)gameType)); if (setScenarioIdAttr) { attributeFilter.AddAttribute(ProtocolHelper.CreateAttribute("ScenarioId", (long)scenario)); } gameProperties.SetFilter(attributeFilter); gameProperties.AddCreationAttributes(ProtocolHelper.CreateAttribute("type", (long)gameType)); gameProperties.AddCreationAttributes(ProtocolHelper.CreateAttribute("scenario", (long)scenario)); FindGameRequest findGameRequest = new FindGameRequest(); findGameRequest.AddPlayer(player); findGameRequest.SetProperties(gameProperties); findGameRequest.SetAdvancedNotification(true); FindGameRequest findGameRequest2 = findGameRequest; this.PrintFindGameRequest(findGameRequest2); this.IsFindGamePending = true; this.m_rpcConnection.QueueRequest(this.m_gameMasterService.Id, 3u, findGameRequest2, new RPCContextDelegate(this.FindGameCallback), 0u); }
private IList <SupervisorsService.Supervisor> PrepareSupervisors(GameProperties gameProperties) { var membership = gameProperties.Membership.GetMembership(); var supervisors = SupervisorsService.Instance.CreateSupervisorsFor(membership); if (supervisors != null && supervisors.Any()) { return(supervisors); } return(null); }
private void LoadFastGame(Settings settings, GameProperties props) { props.Player1Name = "Human"; props.Player2Name = "AI"; (_props.Player1Field, _props.Player1Flotilla) = FieldManager.GenerateField(settings); (_props.Player2Field, _props.Player2Flotilla) = FieldManager.GenerateField(settings); _props.FieldSize = new[] { settings.BattlefieldSize[0], settings.BattlefieldSize[1] }; StartGame(props); }
public void StartGame() { if (OnGameStart != null) { OnGameStart(); } gunner.SetupSequence(GameProperties.GetSequenceCtor(gunner.CannonNb), GameProperties.GetSequenceGrower()); gunner.OnEndOfSequence += OnSequenceEnd; gameStarted = true; StartExperience(); }
private void LoadAiVsAiGame(Settings settings, GameProperties props) { props.Player1Name = "Beavis"; props.Player2Name = "Butthead"; (_props.Player1Field, _props.Player1Flotilla) = FieldManager.GenerateField(settings); (_props.Player2Field, _props.Player2Flotilla) = FieldManager.GenerateField(settings); _props.FieldSize = new[] { settings.BattlefieldSize[0], settings.BattlefieldSize[1] }; StartGame(props); }
private void OnMouseDown() { if (locked) { return; } GameProperties.getInstance().SetProperties(level, cardsPosition, positionTablero, cronoPosition, puntuacionPosition, new PuntuacionFacil(), baraja, vNiño); Debug.Log(baraja); SceneManager.LoadScene("Partida"); }
public void niveles() { if (DBManager.getInstance().LoggedIn) { GameProperties.getInstance().trios = false; SceneManager.LoadScene("LevelsMap"); } else { Debug.Log("no estás loggeado"); } }
IEnumerator InitiateCooldown() { float Seconds = GameProperties.GetMiddleClickCooldown(); while (Seconds >= 0) { Seconds -= Time.deltaTime; //TODO Deal with middle click wait animation right here m8 yield return(new WaitForEndOfFrame()); } CanMiddleClick = true; }
private void OnMouseDown() { GameProperties.getInstance().SetProperties(desafio, cardsPosition, positionTablero, cronoPosition, puntuacionPosition, new PuntuacionDesafio2(), baraja, false); GameProperties.getInstance().tamaño = "pequeño"; GameProperties.getInstance().time = 60; GameProperties.getInstance().tipoPartida = "PartidaEstandar"; panel.SetActive(true); desafio1.SetActive(false); desafio2.SetActive(false); desafio3.SetActive(false); volver.SetActive(false); }
public void Desafio() { if (DBManager.getInstance().LoggedIn) { GameProperties.getInstance().trios = false; SceneManager.LoadScene("Desafios"); } else { Debug.Log("No estás logeado"); } }
public void GameBoard_GetTokens() { int rows = 6; int cols = 6; var props = new GameProperties(new Bounds(rows, cols), 2, 2); var tokens = new[] { new Token(1, "player1", TokenType.Flag, 1, 2), new Token(1, "player2", TokenType.Flag, 3, 4) }; var gameBoard = new GameBoard(props, tokens); CollectionAssert.AreEquivalent(tokens.OrderBy(x => x.Row).ThenBy(x => x.Col).ToArray(), gameBoard.GetTokens().OrderBy(x => x.Row).ThenBy(x => x.Col).ToArray(), "GetTokens should return an equivelant collection to input collection"); }
public ColonySpawnInfo(bool horizontal, Random random, Species species, CompoundCloudSystem cloudSystem, GameProperties currentGame, Vector3 curSpawn, PackedScene microbeScene, Node worldRoot) { Horizontal = horizontal; Random = random; Species = species; CloudSystem = cloudSystem; CurrentGame = currentGame; CurSpawn = curSpawn; MicrobeScene = microbeScene; WorldRoot = worldRoot; }
void Awake() { if (props == null) { DontDestroyOnLoad(this.gameObject); props = this; } else if (props != this) { Destroy(this.gameObject); } }
/// <summary> /// Starts a new game in the microbe stage /// </summary> public static GameProperties StartNewMicrobeGame(bool freebuild = false) { var game = new GameProperties(); if (freebuild) { game.EnterFreeBuild(); game.GameWorld.GenerateRandomSpeciesForFreeBuild(); } return(game); }
public void EventListener(GameProperties props, int row, int col) { while (true) { if (props.Winner != null && row >= props.MenuOptions.Count) { row = 0; props.Renderer.GameOverScreen(props, 0); } ConsoleKeyInfo key = Console.ReadKey(true); switch (key.Key) { case ConsoleKey.RightArrow when col + 1 < props.FieldSize[1]: props.Renderer.RenderBoard(props, row, ++col); break; case ConsoleKey.LeftArrow when col - 1 >= 0: props.Renderer.RenderBoard(props, row, --col); break; case ConsoleKey.UpArrow when row - 1 >= 0: props.Renderer.RenderBoard(props, --row, col); break; case ConsoleKey.DownArrow when row + 1 < props.SelectableRowCount + props.MenuOptions.Count: props.Renderer.RenderBoard(props, ++row, col); break; case ConsoleKey.Enter when row >= props.SelectableRowCount: MenuEnterEvent(props, props.SelectableRowCount, row); props.Renderer.RenderBoard(props, row, col); break; case ConsoleKey.Enter: if (props.Manager.CheckMove(props.GetDefenderField(), row, col)) { props.Manager.MakeMove(props, row, col); } if (props.Winner != null) { row = 0; } break; case ConsoleKey.M: row = props.SelectableRowCount; props.Renderer.RenderBoard(props, row, 0); break; } } }
public void StartNewGame() { CurrentGame = GameProperties.StartNewMicrobeGame(); CreatePatchManagerIfNeeded(); patchManager.ApplyChangedPatchSettingsIfNeeded(GameWorld.Map.CurrentPatch); HUD.UpdatePatchInfo(GameWorld.Map.CurrentPatch.Name); UpdateBackground(); SpawnPlayer(); Camera.ResetHeight(); }
private void StartGame() { int length = Random.Range(GameProperties.GetMinimumRandomChecks(), GameProperties.GetMaximumRandomChecks() + 1); for (int i = 0; i < length; i++) { int rand = Random.Range(0, 4); gameCodes.Enqueue(RandToCode(rand)); } gameStarted = true; currentCheck = KeyCode.None; StartCoroutine(MiniGameEnumeration()); }
public void GameBoard_Get() { var rows = 8; var cols = 8; var props = new GameProperties(new Bounds(rows, cols), 2, 2); var tokens = new[] { new Token(1, "player1", TokenType.Flag, 1, 2), new Token(1, "player2", TokenType.Flag, 3, 4) }; var gameBoard = new GameBoard(props, tokens); Assert.AreEqual(rows, gameBoard.NumRows, "NumRows should be correct"); Assert.AreEqual(cols, gameBoard.NumCols, "NumCols should be correct"); Assert.AreEqual(tokens[0], gameBoard.Get(1, 2), "1,2 should return the first token"); Assert.AreEqual(tokens[1], gameBoard.Get(3, 4), "3,4 should return the second token"); Assert.IsNull(gameBoard.Get(1, 1), "1,1 should return null"); }
private void Start() { propertiesObject = this; if (isServer) { is2PlayerGame = Server.isGame2Player(); CardCount = Server.CardCount; } for (int i = 0; i < SpritesinDic.Length; i++) { TypeSprites.Add(TypesInDic[i], SpritesinDic[i]); } }
public void CreateFriendlyChallengeGame(long myDeck, long hisDeck, EntityId hisGameAccount, int scenario) { FindGameRequest request = new FindGameRequest(); bnet.protocol.game_master.Player val = new bnet.protocol.game_master.Player(); Identity identity = new Identity(); identity.SetGameAccountId(base.m_battleNet.GameAccountId); GameProperties properties = new GameProperties(); AttributeFilter filter = new AttributeFilter(); filter.SetOp(AttributeFilter.Types.Operation.MATCH_ALL); if (!BattleNet.IsVersionInt() && (BattleNet.GetVersionString() == "PAX")) { filter.AddAttribute(ProtocolHelper.CreateAttribute("version", BattleNet.GetVersionString() + BattleNet.GetVersionInt().ToString())); } else if (BattleNet.IsVersionInt()) { filter.AddAttribute(ProtocolHelper.CreateAttribute("version", (long)BattleNet.GetVersionInt())); } else { filter.AddAttribute(ProtocolHelper.CreateAttribute("version", BattleNet.GetVersionString())); } filter.AddAttribute(ProtocolHelper.CreateAttribute("GameType", (long)1L)); filter.AddAttribute(ProtocolHelper.CreateAttribute("ScenarioId", (long)scenario)); properties.SetFilter(filter); properties.AddCreationAttributes(ProtocolHelper.CreateAttribute("type", (long)1L)); properties.AddCreationAttributes(ProtocolHelper.CreateAttribute("scenario", (long)scenario)); val.SetIdentity(identity); val.AddAttribute(ProtocolHelper.CreateAttribute("type", (long)1L)); val.AddAttribute(ProtocolHelper.CreateAttribute("scenario", (long)scenario)); val.AddAttribute(ProtocolHelper.CreateAttribute("deck", (long)((int)myDeck))); request.AddPlayer(val); identity = new Identity(); val = new bnet.protocol.game_master.Player(); identity.SetGameAccountId(hisGameAccount); val.SetIdentity(identity); val.AddAttribute(ProtocolHelper.CreateAttribute("type", (long)1L)); val.AddAttribute(ProtocolHelper.CreateAttribute("scenario", (long)scenario)); val.AddAttribute(ProtocolHelper.CreateAttribute("deck", (long)((int)hisDeck))); request.AddPlayer(val); request.SetProperties(properties); request.SetAdvancedNotification(true); FindGameRequest request2 = request; this.PrintFindGameRequest(request2); this.IsFindGamePending = true; base.m_rpcConnection.QueueRequest(this.m_gameMasterService.Id, 3, request2, new RPCContextDelegate(this.FindGameCallback), 0); }
/// <summary> /// Inform the game that a game property has been changed. This will invoke the /// PropertyChanged event and cause the property grids to be updated. /// </summary> public static void InformPropertyChanged(GameProperties property) { if (PropertyChanged != null) PropertyChanged(property); }
private String ParseResourceXML(String resourceXMLPath) { XmlDocument document = new XmlDocument(); GamePropertiesInfo = new GameProperties(); try { document.Load(resourceXMLPath); } catch (Exception exc) { MessageBox.Show(exc.ToString(), "Ошибка загрузки XML"); return ""; } string xpathApplication = "/Resources"; XmlNode gamenode = document.SelectSingleNode(xpathApplication); String resourcePath = ""; foreach (XmlNode node in gamenode.ChildNodes) { switch (node.Name.ToLower()) { case "resource": { String value = node.Attributes[0].Value; String name = node.ChildNodes.Item(0).Name; String vn = System.IO.Path.Combine(value, name); String gamedir = GetFullGameXMLPath(); resourcePath = System.IO.Directory.GetParent(gamedir).FullName; resourcePath = System.IO.Path.Combine(resourcePath, vn); resourcePath += ".resource"; break; } } } return resourcePath; }
private void ParseGameXML(String gameXMLPath) { GameXMLPath = gameXMLPath; XmlDocument document = new XmlDocument(); GamePropertiesInfo = new GameProperties(); try { document.Load(gameXMLPath); } catch (Exception exc) { MessageBox.Show(exc.ToString(), "Ошибка загрузки XML"); return; } string xpathApplication = "/Game"; try { XmlNode gamenode = document.SelectSingleNode(xpathApplication); foreach (XmlNode node in gamenode.ChildNodes) { String value = node.Attributes[0].Value; switch (node.Name.ToLower()) { /* case "title": { GamePropertiesInfo.Title = value; break; } case "resourceresolution": { GamePropertiesInfo.ResourceResolution = value; break; } case "fixedcontentresolution": { GamePropertiesInfo.FixedContentResolution = value; break; } case "personalitymodule": { GamePropertiesInfo.PersonalityModule = value; break; } case "initfunction": { GamePropertiesInfo.InitFunction = value; break; } case "updatefunction": { GamePropertiesInfo.UpdateFunction = value; break; } case "finilizefunction": { GamePropertiesInfo.FinilizeFunction = value; break; } case "defaultarrow": { GamePropertiesInfo.DefaultArrow = value; break; } case "width": { GamePropertiesInfo.Width = Convert.ToInt32(value); break; } case "height": { GamePropertiesInfo.Height = Convert.ToInt32(value); break; } case "bits": { GamePropertiesInfo.Bits = Convert.ToInt32(value); break; } case "fullscreen": { GamePropertiesInfo.Fullscreen = Convert.ToInt32(value); break; }*/ } } } catch (Exception exc) { MessageBox.Show(exc.ToString(), "Ошибка чтения XML"); return; } }
// Use this for initialization void Start() { m_gameproperties = m_instance.GetComponent<GameProperties>(); m_inputmanager = gameObject.AddComponent<InputManager>(); m_gamestatemanager = gameObject.AddComponent<GameStateManager>(); m_commandmanager = gameObject.AddComponent<CommandManager>(); m_loadmanager = gameObject.AddComponent<LoadManager>(); m_enemymanager = gameObject.AddComponent<EnemyManager>(); m_guimanager = gameObject.AddComponent<GUIManager>(); m_bulletPoolManager = gameObject.AddComponent<BulletPoolManager>(); m_enemyPoolManager = gameObject.AddComponent<EnemyPoolManager>(); m_gamestatemanager.Init(); }