public override void OnEnter() { TutorialManager = new Tutorial.TutorialManager(); IsInitialized = true; DwarfTime.LastTime.Speed = 1.0f; IndicatorManager.SetupStandards(); DwarfGame.GumInputMapper.GetInputQueue(); GuiRoot = new Gui.Root(DwarfGame.GuiSkin); Tip = GuiRoot.RootItem.AddChild(new Gui.Widget { Font = "font10", TextColor = new Vector4(1, 1, 1, 1), MinimumSize = new Point(0, 64), TextHorizontalAlign = Gui.HorizontalAlign.Center, TextVerticalAlign = Gui.VerticalAlign.Center, Text = "Press any key to jump!", AutoLayout = Gui.AutoLayout.DockBottom, Background = new Gui.TileReference("basic", 0), BackgroundColor = new Vector4(0, 0, 0, 0.5f), InteriorMargin = new Gui.Margin(0, 0, 15, 15) }); LoadTicker = GuiRoot.RootItem.AddChild(new Gui.Widgets.InfoTicker { Font = "font8", AutoLayout = Gui.AutoLayout.DockFill, TextColor = new Vector4(1, 1, 1, 1) }) as Gui.Widgets.InfoTicker; GuiRoot.RootItem.Layout(); if (Settings.GenerateFromScratch) { Generator = new WorldGenerator(Settings) { Seed = MathFunctions.Random.Next() }; Generator.Generate(); } else { CreateWorld(); } base.OnEnter(); }
} // The player whose turn it currently is void Start() { // Cache major scripts to be initialized scenarioLoader = GetComponent <ScenarioLoader>(); uiHandler = GetComponent <UIHandler>(); selectionManager = GetComponent <SelectionManager>(); unitFactory = GetComponent <UnitFactory>(); // Load map, then camera scenarioLoader.Initialize(); uiHandler.Initialize(); // Establish player types, network information GameObject matchControllerObject = GameObject.Find("MatchController"); if (matchControllerObject != null) { matchController = matchControllerObject.GetComponent <Netcode.MatchController>(); } if (matchController != null) { playerDirectory = new Dictionary <int, PlayerType>(); foreach (int player in matchController.netRepPlayers.Keys) { if (matchController.whoAmI == player) { playerDirectory.Add(player, PlayerType.Local); } else { playerDirectory.Add(player, PlayerType.Online); } } } else if (Vaults.playerDirectory != null) { playerDirectory = Vaults.playerDirectory; } else { Debug.Log("Using default playerDirectory"); playerDirectory = new Dictionary <int, PlayerType>(); playerDirectory.Add(1, PlayerType.Local); playerDirectory.Add(2, PlayerType.AI); // FOR TESTING__, these defaults shouldn't be reached } Tutorial.TutorialManager tutorialManager = GetComponent <Tutorial.TutorialManager>(); if (tutorialManager != null) { computerPlayer = new Tutorial.TutorialAI(tutorialManager, selectionManager, scenarioLoader); } else if (playerDirectory.Values.Contains(PlayerType.AI)) { computerPlayer = new DefaultAI(selectionManager, scenarioLoader); } ActivePlayer = 1; // Build & load units onto the map if (Vaults.wsUnitList != null) { foreach (WeaponSelect.WSController.WSUnitDescriptor unit in Vaults.wsUnitList) { unitFactory.Create(unit.player, unit.unitType, unit.weaponType, scenarioLoader.HexGrid[unit.position]); } } else // FOR TESTING /* * unitFactory.Create(1, UnitBaseType.Simple, WeaponType.Longbow, GetComponent<ScenarioLoader>().HexGrid[new Vector2(-5, 5)]); * unitFactory.Create(1, UnitBaseType.Simple, WeaponType.Shield, GetComponent<ScenarioLoader>().HexGrid[new Vector2(-3, 5)]); * unitFactory.Create(2, UnitBaseType.Simple, WeaponType.Spear, GetComponent<ScenarioLoader>().HexGrid[new Vector2(0, -5)]); * unitFactory.Create(2, UnitBaseType.Simple, WeaponType.Flail, GetComponent<ScenarioLoader>().HexGrid[new Vector2(-3, -5)]);*/ { } // Initialize the first turn selectionManager.Initialize(); if (tutorialManager != null) { tutorialManager.Initialize(); } }