void Start() { gm = GameObject.Find("_GM"); gameSettings = gm.GetComponent<GameSettings>(); diffColor = diffTxt.color; }
protected override void OnLeftClick() { GameSettings gameSettings = new GameSettings(); gameSettings.IsNewGame = true; gameSettings.UniverseSize = _universeSize; gameSettings.PlayerRace = new Race(new RaceStat(_playerRace, "Maxii", new StringBuilder("Maxii description"), _playerColor)); _eventMgr.Raise<BuildNewGameEvent>(new BuildNewGameEvent(this, gameSettings)); }
// Use this for initialization void Start() { target = GameObject.FindWithTag("Player").transform; myTransform = gameObject.transform; if (originalPosition == new Vector3(0, 0, 0)) { Debug.Log("Should set an original position!"); originalPosition = myTransform.position; } alarmScript = GameObject.FindWithTag("Alarm").GetComponent<GameSettings>(); string difficulty = alarmScript.getDifficulty(); if (difficulty == "Easy") { fieldOfView *= 0.75f; } else if (difficulty == "Medium") { rangeOfView *= 1.25f; moveSpeed *= 2.0f; } else if (difficulty == "Hard") { fieldOfView *= 1.1f; rangeOfView *= 1.5f; moveSpeed *= 4.0f; } else Debug.Log("EnemyAI: Difficulty could not be found : " + difficulty); inCollider = new List<GameObject>(); agent = GetComponent<NavMeshAgent> (); if (originalPosition == targetPosition || targetPosition == new Vector3(0, 0, 0)) patrol = false; else { patrol = true; agent.SetDestination (targetPosition); agent.speed = moveSpeed/4; } }
void Start() { GameSettings = Settings.GS; cc = GetComponent<CharacterController>(); MainCamera = Camera.main; cc.slopeLimit = MaxSlope; }
public GameSetup(string owner, string repo, string token, IEnumerable<Octokit.GitHubCommit> commits) { this.hash = HashHelper.GetMD5($"{owner}/{repo}"); this.owner = owner; this.repository = repo; this.token = token; this.commits = commits.ToArray(); this.settings = GameSettings.None; this.count = commits.Count(filter); this.messages = new List<Message>(); this.messages.Add(StateMessage.CreateSetup()); this.contributors = new List<Models.Contributor>(); this.users = new List<User>(); Models.GameSettings settings = new Models.GameSettings(); settings.ExcludeMerges = false; settings.LowerCase = false; settings.Contributors = GetContributors().Select(x => new Models.GameSettings.Contributor() { Name = x.Name, Active = x.Active }).ToArray(); this.SetSettings(settings); }
public SettingsWindow(GameSettings settings) { this.settings = settings; KeyDown += SettingsWindow_KeyDown; InitializeComponent(); //IList<Level> levels = GetLevels(); }
public void TestCascadeFlaggedCells() { int rows = 5; int cols = 5; var mines = new List<Point> { new Point(cols - 1, rows - 1) }; IPointGenerator generator = new DeterminatePointGenerator(mines); IGameSettings settings = new GameSettings(rows, cols, mines.Count, generator); IMineSearchGame game = new MineSearchGame(settings); var flaggedPoint = new Point(1, 0); game.FlagCell(flaggedPoint); var revealedPoint = new Point(0, 0); game.RevealCell(revealedPoint); game.CascadeCell(revealedPoint); var revealedCells = game.Cells.Where(cell => cell.Revealed).Select(cell => cell.Coordinates).ToList(); Assert.IsFalse(revealedCells.Contains(flaggedPoint)); }
/// <summary> /// Initializes a new instance of the BallerburgGame class /// </summary> public BallerburgGame() { Instance = this; gameSettings = new GameSettings(); playerSettings = new PlayerSettings[4]; applicationSettings = new ApplicationSettings(); graphics = new GraphicsDeviceManager(this) { PreferredBackBufferWidth = 640, PreferredBackBufferHeight = 480 }; graphicsManager = new BallerburgGraphicsManager(); contentManager = new ContentManager(); shaderManager = new ShaderManager(); audioManager = new AudioManager(applicationSettings, contentManager); gameObjectManager = new GameObjectManager(contentManager, this.audioManager, this.graphicsManager); MousePointer = new MousePointer(this) { DrawOrder = 1000, RestrictZone = new Rectangle(0, 0, 640, 480) }; Components.Add(MousePointer); // Create the screen manager component. screenManager = new ScreenManager(graphicsManager, contentManager, gameObjectManager, applicationSettings, gameSettings, shaderManager, audioManager, playerSettings) { GameMousePointer = MousePointer }; }
public SettingsView(MainMenuView menu) { if (File.Exists("settings.json")) settings = JsonConvert.DeserializeObject<GameSettings>(File.ReadAllText("settings.json")); else { settings = new GameSettings(); settings.EnableClouds = true; } scene = new Scene(ScrollInputs.None); (cloudButton = new FastButton(new Font("Content/font.ttf"), 22, "Content/button.png", "Content/button_hover.png", "Content/button_pressed.png") { Position = new Vector2f(500, 200), Size = new Vector2f(280, 49), Text = (settings.EnableClouds ? "Disable" : "Enable") + " Clouds", Anchor = AnchorPoints.Left | AnchorPoints.Top }).OnClick += ToggleClouds; (volDownButton = new FastButton(new Font("Content/font.ttf"), 22, "Content/button.png", "Content/button_hover.png", "Content/button_pressed.png") { Position = new Vector2f(500, 300), Size = new Vector2f(40, 49), Text = "-", Anchor = AnchorPoints.Left | AnchorPoints.Top }).OnClick += VolumeDown; (volUpButton = new FastButton(new Font("Content/font.ttf"), 22, "Content/button.png", "Content/button_hover.png", "Content/button_pressed.png") { Position = new Vector2f(740, 300), Size = new Vector2f(40, 49), Text = "+", Anchor = AnchorPoints.Left | AnchorPoints.Top }).OnClick += VolumeUp; volumeIndicator = new FastText(new Font("Content/font.ttf"), 22) { Position = new Vector2f(550, 300), Size = new Vector2f(180, 49), TextAlignment = Alignment.MiddleCenter, Text = "Volume: " + settings.Volume + "%", Anchor = AnchorPoints.Left | AnchorPoints.Top }; (menuButton = new FastButton(new Font("Content/font.ttf"), 22, "Content/button.png", "Content/button_hover.png", "Content/button_pressed.png") { Position = new Vector2f(500, 500), Size = new Vector2f(280, 49), Text = "Back", Anchor = AnchorPoints.Left | AnchorPoints.Bottom }).OnClick += MenuClick; scene.AddComponent(cloudButton); scene.AddComponent(menuButton); scene.AddComponent(volDownButton); scene.AddComponent(volUpButton); scene.AddComponent(volumeIndicator); this.menu = menu; }
GameObject create_icon(StrawberrySingleScore _score, GameSettings.WinCondition _win){ GameObject obj = GameObject.Instantiate(prefab); var component = obj.GetComponent<ScoreStrawberrySingleView>(); component.strawberry = _score; component.win = _win; obj.transform.SetParent(place_icons_here, false); return obj; }
public GameWindow(GameSettings settings) { Loaded += WindowLoaded; KeyDown += WindowKeyDown; this.settings = settings; InitializeComponents(); }
public static GameSettings Read(string settingsFilename) { Stream stream = File.OpenRead(settingsFilename); XmlSerializer serializer = new XmlSerializer(typeof(GameSettings)); gameSettings = (GameSettings)serializer.Deserialize(stream); stream.Close(); return gameSettings; }
public void TestInitialize() { // Use the default random point generator. var generator = new RandomPointGenerator(); // Create some simple game settings. var gameSettings = new GameSettings(4, 4, 4, generator); // Create a new instance of a game. _game = new MineSearchGame(gameSettings); }
public static void Save(string settingsFilename, GameSettings gameSettings) { if (File.Exists(settingsFilename)) File.Delete(settingsFilename); Stream stream = File.OpenWrite(settingsFilename); XmlSerializer serializer = new XmlSerializer(typeof(GameSettings)); serializer.Serialize(stream, gameSettings); stream.Close(); }
void Awake() { if(instance != null) { Destroy(gameObject); } instance = this; DontDestroyOnLoad(gameObject); }
public override void Update(GameSettings settings) { base.Update(settings); _vel.x = _vel.x - (_vel.x / 10); _vel.y = _vel.y - (_vel.y / 10); _rotV = _rotV - (_rotV / 10); SetPosAdd(_vel); SetRotationAdd(_rotV); }
public World(GameSettings settings, IInputFactory inputFactory, IGraphicManager graphicManager) { iteration = 0; this.inputFactory = inputFactory; this.graphicManager = graphicManager; RainClouds = new List<RainCloud>(); Thunderstorms = new List<Thunderstorm>(); Clouds = new List<Cloud>(); Settings = settings; }
void Start () { var gameSettingsObj = GameObject.FindWithTag("GameSettings"); gameSettings = gameSettingsObj.GetComponent<GameSettings>(); icons = new List<MinimapIcon>(); UpdatePixelRect(); lastScreenWidth = Screen.width; lastUiScale = gameSettings.uiScale; }
// Establish static (global) reference void Awake() { if (LoadedConfig == null) { LoadedConfig = this; //DontDestroyOnLoad(LoadedConfig); } else if (LoadedConfig != this) { Destroy(gameObject); } }
/// <summary> /// Saves the Game settings for this game /// </summary> /// <param name="data">The data to be saved</param> /// <param name="extension">The name of the path/file to save</param> public static void SaveGameSettings(GameSettings data, string extension) { // Create a new save file if (!Directory.Exists(settingsDataPath)) Directory.CreateDirectory(settingsDataPath); BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(settingsDataPath + extension); bf.Serialize(file, data); file.Close(); }
public static GameSettings GetInstance() { if ( s_instance == null ) { s_instance = (GameSettings)FindObjectOfType(typeof(GameSettings)); if ( s_instance == null ) { Debug.LogError( "<GameSettings::GetInstance>: GameSettings not found" ); } } return s_instance; }
void Start() { GameSettings = Settings.GS; FlashlightLight = GameObject.Find("Flashlight-Light").GetComponent<Light>(); FlashlightLight.enabled = false; on = false; if (GameSettings.Difficulty == 0) BatteryLife = .005f; if (GameSettings.Difficulty == 1) BatteryLife = .001f; if (GameSettings.Difficulty == 2) BatteryLife = .05f; if (GameSettings.Difficulty == 3) BatteryLife = .01f; }
void Start() { GameSettings = Settings.GS; if (GameSettings.Difficulty == 3) { gameObject.SetActive(false); } else { GameObject.Find("Pickups").GetComponent<AmmoTypes>().RandomAmmo(this.gameObject); } }
void Start() { Anim = GetComponent<Animator>(); GameSettings = Settings.GS; ASource = GetComponent<AudioSource>(); MainCam = Camera.main; ASource.volume = ASource.volume * (GameSettings.SFXVol/100); if (GameSettings.Difficulty == 0) DifficutlyAmount = 4; if (GameSettings.Difficulty == 1) DifficutlyAmount = 3; if (GameSettings.Difficulty == 2) DifficutlyAmount = 2; if (GameSettings.Difficulty == 3) DifficutlyAmount = 1; }
/// <summary> /// シーンを初期化する /// </summary> /// <param name="settings">ゲーム設定</param> public Scene Init(GameSettings settings) { #if CHECK_INITIALIZED this.initialized = true; #endif this.GameSettings = settings; this.Status = States.Paused; _Init(settings); return this; }
// EVENTS void Awake () { if (instance) { Destroy (gameObject); } else { instance = this; stage = 0; DontDestroyOnLoad (gameObject); } }
void Start() { GameSettings = Settings.GS; StartPos = transform.position; agent = GetComponent<NavMeshAgent>(); origSpeed = agent.speed; GetComponent<AudioSource>().volume = GetComponent<AudioSource>().volume * (GameSettings.SFXVol/100); if (GameSettings.Difficulty == 0) Damage = .01f; if (GameSettings.Difficulty == 1) Damage = .02f; if (GameSettings.Difficulty == 2) Damage = .05f; if (GameSettings.Difficulty == 3) Damage = .1f; InvokeRepeating("Wander", .5f, 3f); }
void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(this); } else { Destroy(gameObject); } }
public void TestCopyConstructor() { IGameSettings gameSettings1 = new GameSettings(10, 10, 10, _generator) { UseQuestionableState = true }; IGameSettings gameSettings2 = new GameSettings(gameSettings1); Assert.AreEqual(gameSettings1.Rows, gameSettings2.Rows); Assert.AreEqual(gameSettings1.Columns, gameSettings2.Columns); Assert.AreEqual(gameSettings1.MineCount, gameSettings2.MineCount); Assert.AreEqual(gameSettings1.PointGenerator, gameSettings2.PointGenerator); Assert.AreEqual(gameSettings1.UseQuestionableState, gameSettings2.UseQuestionableState); }
//Update the level so objects can be added or modifyed public override void Update(GameSettings settings) { int time = SoundPool.GetBackgroundMusicPos(); _time = time; foreach(TimedCannon c in _cannons){ c.Update(time); } if(ControlKeys.IsKeyDown("f") != _f){ _f = ControlKeys.IsKeyDown("f"); //var fire = new FireWork(new PointFloat((float)r.Next(-150,150)/10f, -15), new byte[3] { (byte)r.Next(255), (byte)r.Next(255), (byte)r.Next(255) }); //fire.Explode = true; //TomatoMainEngine.AddGameObject(fire); } }
public Settings() { GameSettings.AddSettingsFile(new SettingsFile { fileName = SettingsFile }); }
public GameSettings ProduceSettings() { var settings = new GameSettings(); settings.LightHack.Enabled = lightHackCheckBox.Checked; settings.WeatherHack.Enabled = weatherHackCheckBox.Checked; settings.ReceivePacketHack.Enabled = packetReceiveHackCheckBox.Checked; settings.ReceivePacketHack.BlockFlash.Enabled = blockFlashCheckBox.Checked; settings.ReceivePacketHack.FastTele.Enabled = fastTeleportCheckBox.Checked; settings.ReceivePacketHack.NoTownPortalAnim.Enabled = noTownPortalAnimCheckBox.Checked; settings.ReceivePacketHack.ItemTracker.Enabled = itemTrackerCheckBox.Checked; settings.ReceivePacketHack.ItemTracker.EnablePickit.Enabled = enablePickitCheckBox.Checked; settings.ReceivePacketHack.ItemTracker.UseTelekinesis.Enabled = useTelekinesisCheckBox.Checked; settings.ReceivePacketHack.ItemTracker.EnableTelepick.Enabled = enableTelepickCheckBox.Checked; settings.ReceivePacketHack.ItemTracker.TownPick.Enabled = pickInTownCheckBox.Checked; settings.ReceivePacketHack.ItemTracker.TeleBack.Enabled = teleBackCheckBox.Checked; settings.ReceivePacketHack.ItemTracker.LogRunes.Enabled = logRunesCheckBox.Checked; settings.ReceivePacketHack.ItemTracker.LogSets.Enabled = logSetsCheckBox.Checked; settings.ReceivePacketHack.ItemTracker.LogUniques.Enabled = logUniquesCheckBox.Checked; settings.ReceivePacketHack.ItemTracker.LogItems.Enabled = logItemsCheckBox.Checked; settings.ReceivePacketHack.ItemTracker.ReactivatePickit.Key = reactivatePickitKeyBindButton.Key; settings.ItemNameHack.Enabled = itemNameHackCheckBox.Checked; settings.ItemNameHack.ShowEth.Enabled = showEtherealCheckBox.Checked; settings.ItemNameHack.ShowItemLevel.Enabled = showItemLevelCheckBox.Checked; settings.ItemNameHack.ShowItemPrice.Enabled = showItemPriceCheckBox.Checked; settings.ItemNameHack.ShowRuneNumber.Enabled = showRuneNumberCheckBox.Checked; settings.ItemNameHack.ShowSockets.Enabled = showSocketsCheckBox.Checked; settings.ItemNameHack.ShowItemCode.Enabled = showItemCodeCheckBox.Checked; settings.ItemNameHack.ChangeItemColor.Enabled = changeColorCheckBox.Checked; settings.ViewInventory.Enabled = viewInventoryHackCheckBox.Checked; settings.ViewInventory.ViewInventoryKey = viewInventoryKeybindButton.Key; settings.Infravision.Enabled = infravisionHackCheckBox.Checked; settings.Infravision.HideCorpses.Enabled = hideCorpsesCheckBox.Checked; settings.Infravision.HideDying.Enabled = hideDyingCheckBox.Checked; settings.Infravision.HideItems.Enabled = hideItemsCheckBox.Checked; settings.RevealAct.Key = revealActKeybindButton.Key; settings.OpenStash.Key = openStashKeybindButton.Key; settings.OpenCube.Key = openCubeKeybindButton.Key; settings.FastExit.Key = fastExitKeybindButton.Key; settings.FastPortal.Key = townPortalKeybindButton.Key; settings.GoToTownAfterPortal.Enabled = autoTakePortalCheckBox.Checked; settings.AutoteleNext.Key = nextLevelKeybindButton.Key; settings.AutoteleMisc.Key = miscPointKeybindButton.Key; settings.AutoteleWP.Key = wpKeybindButton.Key; settings.AutotelePrev.Key = prevLevelKeybindButton.Key; settings.Chicken.Enabled = enableChickenCheckBox.Checked; settings.Chicken.ChickenToTown.Enabled = chickenToTownCheckBox.Checked; settings.Chicken.ChickenOnHostility.Enabled = chickenOnHostilityCheckBox.Checked; try { var val = Convert.ToDouble(chickenLifePctTextBox.Text); settings.Chicken.ChickenLifePercent = val; } catch { } try { var val = Convert.ToDouble(chickenManaPctTextBox.Text); settings.Chicken.ChickenManaPercent = val; } catch { } return(settings); }
void Awake() { settings = Game.Instance.Data.Settings[Game.Instance.Data.SettingsIndex]; }
private void Construct(GameSettings gameSettings, PrefabBulletsData prefabBulletsData, BulletData bulletData) { _gameSettings = gameSettings; _prefabBulletsData = prefabBulletsData; _bulletData = bulletData; }
public GameInfoBase StartGame(GameContextBase InGameContext) { DebugHelper.Assert(InGameContext != null); if (InGameContext == null) { return(null); } if (Singleton <BattleLogic> .instance.isRuning) { return(null); } MultiGameContext multiGameContext = InGameContext as MultiGameContext; Singleton <GameInput> .GetInstance().isSlowUpMoveCmd = (multiGameContext != null && multiGameContext.MessageRef != null && multiGameContext.MessageRef.bIsSlowUP != 0); SynchrReport.Reset(); GameSettings.DecideDynamicParticleLOD(); MonoSingleton <TGPSDKSys> .GetInstance().EnablePhone(true); Singleton <CHeroSelectBaseSystem> .instance.m_fOpenHeroSelectForm = Time.time - Singleton <CHeroSelectBaseSystem> .instance.m_fOpenHeroSelectForm; this.m_fLoadingTime = Time.time; this.m_eventsLoadingTime.Clear(); ApolloAccountInfo accountInfo = Singleton <ApolloHelper> .GetInstance().GetAccountInfo(false); DebugHelper.Assert(accountInfo != null, "account info is null"); this.m_iMapId = InGameContext.levelContext.m_mapID; this.m_kGameType = InGameContext.levelContext.GetGameType(); this.m_eventsLoadingTime.Add(new KeyValuePair <string, string>("OpenID", (accountInfo != null) ? accountInfo.OpenId : "0")); this.m_eventsLoadingTime.Add(new KeyValuePair <string, string>("LevelID", InGameContext.levelContext.m_mapID.ToString())); this.m_eventsLoadingTime.Add(new KeyValuePair <string, string>("isPVPLevel", InGameContext.levelContext.IsMobaMode().ToString())); this.m_eventsLoadingTime.Add(new KeyValuePair <string, string>("isPVPMode", InGameContext.levelContext.IsMobaMode().ToString())); this.m_eventsLoadingTime.Add(new KeyValuePair <string, string>("bLevelNo", InGameContext.levelContext.m_levelNo.ToString())); Singleton <BattleLogic> .GetInstance().isRuning = true; Singleton <BattleLogic> .GetInstance().isFighting = false; Singleton <BattleLogic> .GetInstance().isGameOver = false; Singleton <BattleLogic> .GetInstance().isWaitMultiStart = false; ActionManager.Instance.frameMode = true; MonoSingleton <ActionManager> .GetInstance().ForceStop(); Singleton <GameObjMgr> .GetInstance().ClearActor(); Singleton <SceneManagement> .GetInstance().Clear(); MonoSingleton <SceneMgr> .GetInstance().ClearAll(); MonoSingleton <GameLoader> .GetInstance().ResetLoader(); InGameContext.PrepareStartup(); if (!MonoSingleton <GameFramework> .instance.EditorPreviewMode) { DebugHelper.Assert(InGameContext.levelContext != null); DebugHelper.Assert(!string.IsNullOrEmpty(InGameContext.levelContext.m_levelDesignFileName)); if (string.IsNullOrEmpty(InGameContext.levelContext.m_levelArtistFileName)) { MonoSingleton <GameLoader> .instance.AddLevel(InGameContext.levelContext.m_levelDesignFileName); } else { MonoSingleton <GameLoader> .instance.AddDesignSerializedLevel(InGameContext.levelContext.m_levelDesignFileName); MonoSingleton <GameLoader> .instance.AddArtistSerializedLevel(InGameContext.levelContext.m_levelArtistFileName); } MonoSingleton <GameLoader> .instance.AddSoundBank("Effect_Common"); MonoSingleton <GameLoader> .instance.AddSoundBank("System_Voice"); } GameInfoBase gameInfoBase = InGameContext.CreateGameInfo(); DebugHelper.Assert(gameInfoBase != null, "can't create game logic object!"); this.gameInfo = gameInfoBase; gameInfoBase.PreBeginPlay(); Singleton <BattleLogic> .instance.m_LevelContext = this.gameInfo.gameContext.levelContext; try { DebugHelper.CustomLog("GameBuilder Start Game: ispvplevel={0} ispvpmode={4} levelid={1} leveltype={6} levelname={3} Gametype={2} pick={5}", new object[] { InGameContext.levelContext.IsMobaMode(), InGameContext.levelContext.m_mapID, InGameContext.levelContext.GetGameType(), InGameContext.levelContext.m_levelName, InGameContext.levelContext.IsMobaMode(), InGameContext.levelContext.GetSelectHeroType(), InGameContext.levelContext.m_pveLevelType }); Player hostPlayer = Singleton <GamePlayerCenter> .instance.GetHostPlayer(); if (hostPlayer != null) { DebugHelper.CustomLog("HostPlayer player id={1} name={2} ", new object[] { hostPlayer.PlayerId, hostPlayer.Name }); } } catch (Exception) { } if (!MonoSingleton <GameFramework> .instance.EditorPreviewMode) { this.m_fLoadProgress = 0f; MonoSingleton <GameLoader> .GetInstance().Load(new GameLoader.LoadProgressDelegate(this.onGameLoadProgress), new GameLoader.LoadCompleteDelegate(this.OnGameLoadComplete)); MonoSingleton <VoiceSys> .GetInstance().HeroSelectTobattle(); Singleton <GameStateCtrl> .GetInstance().GotoState("LoadingState"); } return(gameInfoBase); }
public Damka(GameSettings i_Settings) { InitializeComponent(); setupGame(i_Settings); }
void OnGUI() { // Setup variables int level = 1; Rect buttonDimension = new Rect(); string buttonText = string.Empty; float margin = (Screen.height * buttonMargin); float numLevelsHalf = (GameSettings.NumLevels / 2); SceneTransition sceneTransitionInstance = Singleton.Get <SceneTransition>(); GameSettings gameSettingInstance = Singleton.Get <GameSettings>(); // Disable the GUI if it's loading a level if (sceneTransitionInstance.State == SceneTransition.Transition.NotTransitioning) { GUI.skin = skin; // Position the first column of buttons if ((GameSettings.NumLevels % 2) == 1) { numLevelsHalf += 1; } // Check if this isn't a webplayer if (gameSettingInstance.IsWebplayer == false) { numLevelsHalf += 1; } buttonDimension.width = (Screen.width * buttonWidth); buttonDimension.y = (Screen.height * startButtonPosition); buttonDimension.x = (Screen.width / 2f) - (buttonDimension.width + (margin / 2f)); buttonDimension.height = (Screen.height * ((endButtonPosition - startButtonPosition) / numLevelsHalf)); buttonDimension.height -= margin; for (level = 1; level <= GameSettings.NumLevels; level += 2) { buttonText = LabelText(level); GUI.enabled = (level <= gameSettingInstance.NumLevelsUnlocked); if (GUI.Button(buttonDimension, buttonText) == true) { sceneTransitionInstance.LoadLevel(level); } buttonDimension.y += (buttonDimension.height + margin); } // Position the second column of buttons buttonDimension.y = (Screen.height * startButtonPosition); buttonDimension.x = (Screen.width / 2f) + (margin / 2f); for (level = 2; level <= GameSettings.NumLevels; level += 2) { buttonText = LabelText(level); GUI.enabled = (level <= gameSettingInstance.NumLevelsUnlocked); if (GUI.Button(buttonDimension, buttonText) == true) { sceneTransitionInstance.LoadLevel(level); } buttonDimension.y += (buttonDimension.height + margin); } // Re-enable the GUI GUI.enabled = true; // Check if this isn't a webplayer if (gameSettingInstance.IsWebplayer == false) { // Position the quit button buttonDimension.width = (Screen.width * smallButtonWidth); buttonDimension.height = (Screen.height * (smallButtonEndPosition - smallButtonStartPosition)) - margin; buttonDimension.x = ((Screen.width - buttonDimension.width) / 2f); buttonDimension.y = (Screen.height * smallButtonStartPosition); if (GUI.Button(buttonDimension, ("Quit Game")) == true) { Application.Quit(); } } } }
public void Construct(GameSettings gameSettings) { _gameSettings = gameSettings; _nextUpgrade = new MorePassiveUpgrade(null, _gameSettings); }
static void Main(string[] args) { /* * This project is used to run any random snippet you should choose * * * * Don't worry about the mess here, the mess here prevents mess in other places * * * * Some of these snippets are quite useful when testing AI or running evolution * * * * * * */ //string[] filepaths = Directory.GetFiles(@"C:\Users\admhe\Desktop\Statistics\200728", "TEST*", SearchOption.TopDirectoryOnly); //string fileContents; //foreach (string fp in filepaths) //{ // fileContents = File.ReadAllText(fp); // fileContents = fileContents.Replace("Generation ", ""); // fileContents = fileContents.Replace(" : Best avg: ", ","); // fileContents = fileContents.Replace(", Total avg: ", ","); // fileContents = fileContents.Replace(", avg similarity: ", ","); // using (var tw = new StreamWriter(fp + ".csv", false)) // { // tw.Write(fileContents); // } //} //GameSettings.LoadFromFile(@"thebes_config.thc"); //Individual[] individuals = new Individual[4]; //for (int i = 0; i < 4; i++) //{ // individuals[i] = new Individual(4 ,new SimpleEvolutionAI(4)); //} //int counter = 10; //for (int i = 0; i < 500; i++) //{ // if (i % 100 == 0) // { // Console.WriteLine(counter--); // } // Population.PlayMatch(individuals); //} //for (int i = 0; i < individuals.Length; i++) //{ // Console.WriteLine($"Average score for {i}: {individuals[i].AverageScore()}"); //} //Console.ReadLine(); //Population population = new Population(2, 100); //population.Evolve(1000, 5, 0.3, 2, 0.01, 0.05, 0); //Population population; //// number of parents //for (int i = 2; i < 5; i += 2) //{ // // survivor ratio // for (double j = 0.1; j <= 0.4; j += 0.1 // { // // mutation probability // for (double k = 0.01; k < 0.2; k += 0.06) // { // // mutation range // for (double l = 0.05; l < 0.5; l *= 2) // { // population = new Population(100); // population.Evolve(4, 150, 5, j, i, k, l, 0); // } // } // } //} //Individual individual = new Individual(new BetterEvolutionAI(null, null)); //individual.ai.NormalizeValues(-1, 1); //foreach (var value in individual.ai.weights) //{ // Console.WriteLine(value.ToString() + ','); //} //Console.ReadLine(); GameSettings.LoadFromFile(@"thebes_config.thc"); Dictionary <string, Tester> testers = new Dictionary <string, Tester>(); EvolutionA evoAI = new EvolutionA(2); testers.Add("mctsevo", new Tester("mctsevo", new MCTSIR(evoAI, 5000, 1.8))); testers.Add("simpleEvo", new Tester("simpleEvo", new EvolutionA(2))); //testers.Add("mcts1.4", new Tester("mcts1.4", new MCTSAI(2, 5000, 1.4))); //testers.Add("mcts1", new Tester("mcts1", new MCTSAI(2, 5000, 1))); //testers.Add("mcts1.8", new Tester("mcts1.8", new MCTSAI(3, 5000, 1.8))); //testers.Add("mcts0.7", new Tester("mcts0.7", new MCTSAI(2, 5000, 0.7))); //testers.Add("complexEvo", new Tester("complexEvo", new ComplexEvolutionAI(3))); //testers.Add("random", new Tester("random", new RandomAI())); //testers.Add("random1", new Tester("random1", new RandomAI())); //testers.Add("random2", new Tester("random2", new RandomAI())); //testers.Add("random3", new Tester("random3", new RandomAI())); //testers.Add("oldEvo", new Tester("oldEvo", new DumbEvolutionAI(4))); for (int i = 0; i < 10; i++) { Console.WriteLine(i); Tester.PlayMatch(testers); } Console.WriteLine("Done\n"); foreach (Tester tester in testers.Values.ToList()) { Console.WriteLine($"{tester.name}: avg rank: {tester.AverageRank()}, avg score: {tester.AverageScore()}"); tester.PrintPlayerStats(); } Console.ReadLine(); }
public void OnGameSettingsChanged(GameSettings newSettings) { masterVolume = newSettings.masterVolume; // TODO: Change volume on all playing audio }
public void UpdateSettings(GameSettings newSettings) { _settings = newSettings; PersistSettings(); }