public void Setup() { SETUP = MainTitleUI.getSetup(); PLAYERDATA = GameObject.FindGameObjectWithTag("PlayerData").GetComponent<PlayerData>(); PLAYERDATA.Launch(); ThumbGO = new GameObject("Thumbnails"); ThumbGO.transform.parent = gameObject.transform; ThumbGO.transform.localPosition = new Vector3(0f,0f,0f); levelName = FETool.findWithinChildren(gameObject, "LevelTitle/LEVEL_NAME").GetComponent<TextUI>(); _btnLeft = FETool.findWithinChildren(gameObject, "SelectLeft").GetComponent<LevelChooserButton>(); _btnRight = FETool.findWithinChildren(gameObject, "SelectRight").GetComponent<LevelChooserButton>(); Thumbs.Clear(); foreach (LevelInfo _lvl in PLAYERDATA.PROFILE.ActivatedLevels) { LevelThumbnail _th = CreateThumbnail(_lvl); Thumbs.Add(_th); } for (int j = 0; j < Thumbs.Count ; j++) { // Thumbs[j].gameObject.transform.localPosition = new Vector3(0f,0f,0f); Thumbs[j].gameObject.transform.localPosition = new Vector3(j * gapThumbs.x, 0f, gapThumbs.z); } Thumbs[0].isStartSlot = true; Thumbs[Thumbs.Count-1].isEndSlot = true; _btnLeft.Setup(this, LevelChooserButton.DirectionList.Left); _btnRight.Setup(this, LevelChooserButton.DirectionList.Right); currThumb = Thumbs[0]; levelName.text = currThumb.nameLv.ToString(); checkCurrThumb(); }
/// <summary> /// Builds the file To Generate Game Data /// </summary> /// <param name="divisions">All Division information</param> /// <param name="prizeLevels">All Prize Level information</param> /// <param name="gameInfo">All game Inforamtion</param> /// <param name="fileName">The full output file name and pat</param> /// <param name="gameSetupUC"></param> public void buildGameData( Divisions.DivisionsModel divisions, PrizeLevels.PrizeLevels prizeLevels, GameSetup.GameSetupModel gameInfo, string fileName, GameSetup.GameSetupUC gameSetupUC) { addListener(gameSetupUC); int numberOfDivisions = divisions.getNumberOfDivisions() + 1; List<int[]>[] divisionLevels = new List<int[]>[numberOfDivisions]; List<Thread> threads = new List<Thread>(); for (int i = 0; i < numberOfDivisions; i++) { int divisionIndex = i; Thread t; if (divisionIndex == numberOfDivisions - 1) { t = new Thread(() => divisionLevels[divisionIndex] = getDivisionLossingPermutations(gameInfo, prizeLevels, divisions).OrderBy(a => Guid.NewGuid()).ToList()); } else { int temp = i; t = new Thread(() => divisionLevels[divisionIndex] = getDivisionWinningPermutations(divisionIndex, gameInfo.totalPicks, divisions.getDivision(temp).MaxPermutations, divisions.getDivision(divisionIndex), prizeLevels).OrderBy(a => Guid.NewGuid()).ToList()); } t.Start(); threads.Add(t); } for (int i = 0; i < threads.Count; i++) { threads.ElementAt(i).Join(); } writeFile(fileName, divisionLevels, buildHeader(prizeLevels, divisions)); shout("FileFinished"); }
public void SetupTranslation(GameSetup.languageList _lang) { currLanguage = _lang; translated_texts = fillDicoText(currLanguage); // Debug.Log (translated_texts +""+_lang); // Debug.Log (translated_texts.Count); }
void Awake() { SP = this; gameSetupScript = GetComponent<GameSetup>() as GameSetup; highscoreText = GetComponent<GUIText>() as GUIText; highscoreText.enabled = false; }
public void Awake() { SETUP = Resources.Load("Tuning/GameSetup") as GameSetup; SETUP.changeLang(SETUP.ChosenLanguage); _mesh = GetComponent<TextMesh>(); initColor = color; DIALOG_ID = gameObject.name; }
private GameSetupParcelable(Parcel parcel) { var seats = parcel.CreateTypedArray(FactionParcelable.GetCreator()) .Cast <FactionParcelable>() .Select(fp => fp.Faction) .ToList(); int firstPlayer = parcel.ReadInt(); GameSetup = GameSetup.Create(seats, firstPlayer); }
public void PrepareEverything() { MobManager.InitializeState(State); Map.PrecomputeCubeLinedraw(); Pathfinder.PathfindDistanceAll(); TurnManager.PresortTurnOrder(); State.Reset(this); GameSetup.ResetPositions(this); State.LastTeamColor = CurrentTeam; }
private void StartNewGame(GameSetup resultsSetup) { board.Create(); IsPaused = false; Playtime = 0; pieceManager.Setup(board, resultsSetup); MenuEvents.StartGame(true); GameStatData.GameSetup = resultsSetup; }
private void Awake() { //getting components _source = GetComponent <AudioSource>(); _p_animator = _player.GetComponent <Animator>(); _r_animator = _rope.GetComponent <Animator>(); _gameSetup = GetComponent <GameSetup>(); _uiController = FindObjectOfType <UIController>(); // playing level music }
void Start() { //_gameController = FindObjectOfType<GameController>(); _playerScoreCounter = character.GetComponent <PlayerScoreCounter>(); _gameSetup = FindObjectOfType <GameSetup>(); totalHealthUI.text = _playerScoreCounter.maxHealth.ToString(); healthBar.maxValue = _playerScoreCounter.maxHealth; healthBar.value = _playerScoreCounter.maxHealth; _difficultyChoice.onValueChanged.AddListener(delegate { ValueChangeCheck(); }); }
public void OnSlotConfirmed() { if (this._confirmPanel.activeSelf) { this._confirmPanel.SetActive(false); } this.OnDisable(); GameSetup.SetInitType(InitTypes.Continue); GameSetup.SetSlot(this._pendingConfirmationSlot); SaveSlotSelectionScreen.OnSlotSelected.Invoke(); }
void Start() { GameObject gameController = GameObject.FindGameObjectWithTag("gc"); GameSetup gameSetup = gameController.GetComponent <GameSetup>(); totalPossibleCorrectParts = gameSetup.totalPossibleCorrectParts; // Debug.Log("TOTAL POSSIBLE CORRECT PARTS ARE: " + totalPossibleCorrectParts); ScoreBoard(); }
// Update is called once per frame void Update() { if (gs == null) { gs = GameObject.FindObjectOfType <GameSetup>(); } if (cam == null) { cam = PlayerCamera.instance.GetComponentInChildren <Camera>(); } }
public void IncrementAnimalNumber() { GameObject gameController = GameObject.FindGameObjectWithTag("gc"); GameSetup gameSetup = GetComponent <GameSetup>(); gameSetup.arrayIndex = animalLoaded; animalLoaded = animalLoaded++; Debug.Log(animalLoaded); }
IEnumerator DeleteIt() { GameObject gameController = GameObject.FindGameObjectWithTag("gc"); GameSetup gameSetup = gameController.GetComponent <GameSetup>(); // We should only read the screen buffer after rendering is complete yield return(new WaitForEndOfFrame()); File.Delete(gameSetup.tempFilePath + fileName); Debug.Log("Your file was deleted at " + gameSetup.tempFilePath + fileName); }
public void SetGameSettings(GameSetup setup, GameSettings gameSettings, PlayerSkins newSkins) { this.setup = setup; settings = gameSettings; skins = newSkins; Debug.Log("setup"); playerSettings = new PlayerSettings[settings.playerCount]; players = new GameObject[settings.playerCount]; playerCreator.Initialise(); Restart(); }
public void SetupSizeOfBoard() { var game = new GameSetup(); var expectedSize = 9; var board = game.NewBoard(); var actualSize = board.Count; Assert.AreEqual(expectedSize, actualSize); }
private static void ValidInputPrompt(GameSetup gameSetup, ref string userInput, ref bool validInput, List <string> board, Renderer renderer) { while (!validInput) { Console.WriteLine("Sorry invalid input, please enter a number from 0-8"); Console.WriteLine(renderer.Render(board)); userInput = Console.ReadLine(); validInput = gameSetup.IsValidInput(userInput); } }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } }
void Start() { PV = GetComponent <PhotonView>(); spawnFood = GetComponent <SpawnFood>(); joy = FindObjectOfType <Joystick>(); boost = FindObjectOfType <Booster>(); gameSet = FindObjectOfType <GameSetup>(); Debug.Log(gameSet.Master.tag.ToString()); Debug.Log(PhotonNetwork.IsMasterClient.ToString()); }
//public static System.Action EndOfRound; private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
void Awake() { if (GameSetup.Inst == null) { GameSetup.Inst = this; Camera.main.orthographicSize = Screen.height / 2; } else { Destroy(this); } }
public InteractionManager(MainGameManager mainManager, Map map, GameSetup gameSetup, UnityObjectManager unityObjectManager, IEnumerable <PlayerSetup> playerSetups) { gameSetup.NextTurnButton.onClick.AddListener(() => AdvanceGame()); _mainManager = mainManager; Map = new MapInteraction(this, map, mainManager.ObjectManager); Timeline = new TimelineInteraction(this); Factions = new FactionsInteractionManager(unityObjectManager.Factions); }
public static GameInstance LoadEvolutionSaveFile(string filename) { var lines = File.ReadAllLines(filename); var d1 = DNA.FromSerializableString(lines[0]); var d2 = DNA.FromSerializableString(lines[1]); var map = Map.Load("data/map.json"); var game = GameSetup.GenerateFromDna(d1, d2, map); return(game); }
// Use this for initialization public void Launch() { PROFILE = Resources.Load("Tuning/PlayerProfile") as PlayerProfile; SETUP = Resources.Load("Tuning/GameSetup") as GameSetup; INPUT = Resources.Load("Tuning/InputManager") as InputManager; DontDestroyOnLoad(this); GameEventManager.GameStart += GameStart; GameEventManager.GameOver += GameOver; GameEventManager.Respawn += Respawn; GameEventManager.EndGame += EndGame; }
public MetaEntity SetGameSetup(GameSetup newValue) { if (hasGameSetup) { throw new Entitas.EntitasException("Could not set GameSetup!\n" + this + " already has an entity with GameSetupComponent!", "You should check if the context already has a gameSetupEntity before setting it or use context.ReplaceGameSetup()."); } var entity = CreateEntity(); entity.AddGameSetup(newValue); return(entity); }
private IEnumerator StartServer() { GameSetup gameSetup = null; ConVar.GC.collect(); ConVar.GC.unload(); yield return(CoroutineEx.waitForEndOfFrame); yield return(CoroutineEx.waitForEndOfFrame); yield return(gameSetup.StartCoroutine(Bootstrap.StartServer(gameSetup.loadSave, gameSetup.loadSaveFile, true))); }
void Awake() { if (instance == null) { DontDestroyOnLoad(gameObject); instance = this; } else if (instance != this) { Destroy(gameObject); } }
public void OnLoad() { GameSetup.SetInitType(InitTypes.Continue); if (GameSetup.IsSinglePlayer) { this.BreadCrumbLevel2(); } else { this.BreadCrumbLevel3Mp(); } }
private void TryToyWorld() { if (GameCtrl != null) { GameCtrl.Dispose(); // Should dispose RRs and controllers too } GameSetup setup = new GameSetup( new FileStream(SaveFile, FileMode.Open, FileAccess.Read, FileShare.Read), new StreamReader(TilesetTable)); GameCtrl = GameFactory.GetThreadSafeGameController(setup); GameCtrl.Init(); }
public GameControllerTestBase() { var tmxMemoryStream = FileStreams.SmallTmx(); var tilesetTableMemoryStream = FileStreams.TilesetTableStream(); var tilesetTableStreamReader = new StreamReader(tilesetTableMemoryStream); var gameSetup = new GameSetup(tmxMemoryStream, tilesetTableStreamReader); GameController = GetController(gameSetup); GameController.Init(); }
private void OnEnable() { if (!instance) { instance = this; } else if (instance != this) { GameObject.Destroy(instance.gameObject); instance = this; } DontDestroyOnLoad(gameObject); }
private void ClientRoutine(string[] args) { Debug.Log("Starting dedicated client"); SteamDSConfig.isDedicatedServer = false; CoopPeerStarter.DedicatedHost = false; SteamClientDSConfig.isDedicatedClient = true; SteamClientDSConfig.serverAddress = this.GetStringArg(args, "+connect", "127.0.0.1:27015"); SteamClientDSConfig.password = this.GetPasswordArg(args, "+password", string.Empty); SteamClientDSConfig.adminPassword = this.GetPasswordArg(args, "+password_admin", string.Empty); SteamClientDSConfig.EndPoint = UdpEndPoint.Parse(SteamClientDSConfig.serverAddress); GameSetup.SetInitType(this.GetEnumArg <InitTypes>(args, "-inittype", SteamClientDSConfig.gameType)); Application.LoadLevel("SteamStartSceneDedicatedServer_Client"); }
public void ReplaceGameSetup(GameSetup newValue) { var entity = gameSetupEntity; if (entity == null) { entity = SetGameSetup(newValue); } else { entity.ReplaceGameSetup(newValue); } }
public ZigZagGameField(GameController gameController, GameSetup gameSetup) : base(gameController) { _gameController = gameController; gameSetup.GameControlTrigger.SetupGameControlTrigger(TriggerAction); _pool = new ZigZagObjectPool(gameSetup); _gameSpeed = gameSetup.CurrentGameSetup.gameSpeed; _groundTitleOffset = gameSetup.CurrentGameSetup.groundPrefab.transform.localScale.x; _crystalChance = gameSetup.CurrentGameSetup.crystalChance; generator = new ZigZagGenerator(gameSetup.cameraLimitValue); var gen = generator as ZigZagGenerator; BuildGameFieldOnStart(); }
IEnumerator DisableAndAcitvatePlayer(Collider2D player) { GameSetup gamesetup = FindObjectOfType <GameSetup>(); player.enabled = false; player.gameObject.transform.GetChild(3).GetComponent <CircleCollider2D>().enabled = false; GetComponent <CircleCollider2D>().isTrigger = false; GetComponent <CircleCollider2D>().radius = 5f; yield return(new WaitForSeconds(2f)); gamesetup.gameplay = false; gamesetup.GoBack(); gamesetup.timeUI.SetActive(true); }
public static GameSetupModel From(GameSetup setup) { var byType = setup.GetRandomizersByType(); Func<CardType, CardInfo[]> getInfoByType = type => byType[type].Select(x => x.GetInfo()).ToArray(); var model = new GameSetupModel { ThunderstoneBearer = getInfoByType(CardType.ThunderstoneBearer)[0], Monsters = getInfoByType(CardType.Monster), Heroes = getInfoByType(CardType.Hero), Weapons = getInfoByType(CardType.Weapon), Items = getInfoByType(CardType.Item), Spells = getInfoByType(CardType.Spell), Villagers = getInfoByType(CardType.Villager) }; return model; }
void New_game_can_be_started(string gameName, int numberOfPlayers, int expectedNumberOfStartingUnits, Guid gameId, GameSetup game, Dice dice) { var players = new Dictionary<Guid, string>(); var turnGuid = new Guid("41a8cd9a-3eab-4c92-92d1-ccc7917fe669"); "Given a game name" .Given(() => { }); "And a game Id" .And(() => gameId = Guid.NewGuid()); "And a number of players" .And(() => { for (var i = 0; i < numberOfPlayers; i++) { players.Add(Guid.NewGuid(), "Player" + i); } }); "And a dice" .And(() => dice = new Dice()); "When we start a game" .When(() => { var command = new StartGameSetup(gameId, gameName, players); game = new GameSetup(command, dice, () => turnGuid); }); "Then a game should be started with a number of players" .Then(() => { var @event = (GameSetupStarted)game.Events.Last(); @event.setupId.ShouldBe(gameId); @event.GameName.ShouldBe(gameName); @event.Players.Count.ShouldBe(numberOfPlayers); @event.NumberOfStartingInfantryUnits.ShouldBe(expectedNumberOfStartingUnits); @event.Board.ShouldNotBeNull(); players.Keys.ShouldContain(@event.StartingPlayerId); }); }
public void Setup(GameSetup.LevelList _set, bool _isLocked) { nameLv = _set; Locked = _isLocked; if (nameLv != GameSetup.LevelList.None) { Info = Instantiate(Resources.Load("Tuning/Levels/" + nameLv.ToString())) as LevelInfo; } gameObject.name = _set.ToString(); Locker = FETool.findWithinChildren(gameObject, "Lock").GetComponentInChildren<OTSprite>(); if (Locked == true) { Locker.alpha = 1f; } else { Locker.alpha = 0f; } linkedPlayBtn = GetComponentInChildren<MiscButton>(); }
private Dictionary<string, string> fillDicoText(GameSetup.languageList _lang) { Doc = new XmlDocument(); // Debug.Log("Loading" +_lang.ToString()); Doc.LoadXml(dialog_file.text); Dictionary<string, string> translate = new Dictionary<string, string>(); XmlNodeList TextNode = Doc.SelectNodes("texts"); foreach (XmlNode node in TextNode) { node.InnerXml = node.InnerXml.Replace(" ", ""); XmlNodeList entries = node.SelectNodes("entry"); foreach (XmlNode entry in entries) { string entryID = entry.Attributes.GetNamedItem("id").Value; XmlNodeList LangEntry = entry.SelectNodes(_lang.ToString()); string entryTranslation = LangEntry.Item(0).InnerText; entryTranslation = entryTranslation.Replace("/n", "\n"); if (translate.ContainsKey(entryID) == false) { translate.Add(entryID, entryTranslation); } } } return (translate); }
public void AddGameSetup(string id, GameSetup setup) { if (_gameSetups.ContainsKey(id)) throw new HotCitException(ExceptionType.Impossible); _gameSetups[id] = setup; }
public void Setup(ParentMenu _menu) { parentUi = _menu; if (_menu.GetComponent<MainTitleUI>() != null) { mainUi = _menu.GetComponent<MainTitleUI>(); } SETUP = parentUi.PLAYERDAT.SETUP; if (_coll = GetComponent<BoxCollider>()) {_coll.isTrigger = true;} if (GetComponentInChildren<OTSprite>() != null) { spr = GetComponentInChildren<OTSprite>(); stdFrame = spr.frameName; altFrame = spr.frameName +"Alt"; } }
/// <summary> /// Generates losing permutations for a game /// </summary> /// <param name="gameInfo">All game Information</param> /// <param name="prizeLevels">All prizeLevels</param> /// <returns>List of int arrays representing losing permutations</returns> private List<int[]> getDivisionLossingPermutations( GameSetup.GameSetupModel gameInfo, PrizeLevels.PrizeLevels prizeLevels, Divisions.DivisionsModel divisions ) { List<int[]> lossPermutations = new List<int[]>(); List<int> extraPicks = getExtraPicks(new int[1], prizeLevels).ToList(); List<int[]> baseLossconditions = new List<int[]>(); int numberOfPermutationsForNearWinAmount = divisions.LossMaxPermutations; if (gameInfo.isNearWin) { baseLossconditions.AddRange(getBaseNearWinLossPermutations(gameInfo.nearWins, gameInfo.totalPicks, prizeLevels)); } else { int[] baseLoss = new int[gameInfo.totalPicks]; baseLossconditions.Add(baseLoss); } lossPermutations = getAllLossPermutations(baseLossconditions, prizeLevels, gameInfo.nearWins, numberOfPermutationsForNearWinAmount); List<int[]> Losses = lossPermutations.Take(divisions.LossMaxPermutations).ToList(); return Losses; }
void Awake() { Screen.SetResolution(1366,768, false); name = "TitleMenu"; base.Setup(); SETUP = Resources.Load ("Tuning/GameSetup") as GameSetup; Chooser = FETool.findWithinChildren(gameObject, "LevelChooser").GetComponent<LevelChooser>(); SETUP.startTranslate(SETUP.ChosenLanguage); SETUP.translateSceneText(); levelInformations = new List<LevelInfo> (); if (GameObject.Find("Frameworks") == null) { GameObject fmObj = Instantiate(Resources.Load("Presets/Frameworks")) as GameObject; fmObj.name = "Frameworks"; } Chooser.Setup (); awayPlace = FETool.findWithinChildren(gameObject, "AwayPlace"); frontPlace = FETool.findWithinChildren(gameObject, "FrontPlace"); Credits = FETool.findWithinChildren(gameObject, "Credits").GetComponent<SubMenu>(); Landing = FETool.findWithinChildren(gameObject, "Landing").GetComponent<SubMenu>(); LevelChooser = FETool.findWithinChildren(gameObject, "LevelChooser").GetComponent<SubMenu>(); Options = FETool.findWithinChildren(gameObject, "Options").GetComponent<SubMenu>(); versionDisplay = FETool.findWithinChildren(gameObject, "Landing/Underpanel/GAME_VERSION").GetComponent<TextUI>(); SubMenu[] subMn = GetComponentsInChildren<SubMenu>(); foreach (SubMenu sub in subMn) { sub.SetupSub(this); sub.setupBtn(); } if (Input.GetJoystickNames().Length > 0) { padEntered = true; changeState(MenuStates.Start); } versionDisplay.TranslateThis(); InvokeRepeating("checkPadMenu", 0f, 0.5f); TranslateAllInScene(); versionDisplay.text += SETUP.gameversion; GameEventManager.TriggerGameStart("MainTitle"); // StartCoroutine("DelayMusic"); }