/// <summary> /// The set current scene. /// </summary> /// <param name="scene"> /// The scene. /// </param> public static void SetCurrentScene(Scene scene) { if (scenes.Contains(scene) && !scene.Visible) { // want to be able to have multiple transparent scenes overlaid on the nontransparent scene if (!scene.Transparent) { foreach (Scene visibleScene in GetVisibleScenes()) { visibleScene.Visible = false; } } scene.Visible = true; if (scene.MainGameScene) { var ingameMenu = new InGameMenu(scene.Game); ingameMenu.Initialize(); AddScene(ingameMenu); } else if (!(scene is InGameMenu)) { scenes.Remove((from s in scenes where s is InGameMenu select s).FirstOrDefault()); } } }
// Start is called before the first frame update protected virtual void Start() { rigidbody = transform.GetComponent <Rigidbody2D>(); boxCollider = transform.GetComponent <BoxCollider2D>(); anim = GetComponent <Animator>(); inGameMenu = InGameMenu.transform.GetComponent <InGameMenu>(); }
private void InitializeLevel() { if (!doNotRemoveAssetsWithTag) { // Remove all assets with Player tag. for (int i = 0; i < removeAssetsWithTag.Length; i++) { RemoveAssetsWithTag(removeAssetsWithTag[i], true); } //// Removes all assets with StripGameObjectFromBuild from build. StripGameObjectsFromBuild(); } // Initialize any game data. gameData.InitializeGameData(); // Instantiate the UI. if (gameData.InGameMenu) { inGameMenu = Instantiate(gameData.InGameMenu); } else { Debug.Log("No IngameMenu."); } // Spawn Player. InitializePlayer(true); // Spawn Camera. //InitializeCamera(playerInstance); }
private void Start() { CorrectWorkingState(); inGameMenu = InGameMenu.instance; objectList = new Dictionary <int, int>(); isCrafting = false; }
public void Load() { GUIPanel.Pannels.Clear(); InventoryWindow = new InventoryScreen(); InventoryWindow.Init(); SkillScreen = new CharcterScreen(); SkillScreen.Init(); StatusWindow = new PlayerStatus(); StatusWindow.Init(); Selector = new TargetSelection(); Selector.Init(); Selector.Enabled = false; Loot = new LootScreen(); Loot.Init(); Loot.Enabled = false; GameMenu = new InGameMenu(); GameMenu.Init(); GameMenu.Enabled = false; InMenu = false; SetPlayer(GameState.Instance.PlayerObject); }
void Start() { pointScript = FindObjectOfType <PointScript>(); soundManager = FindObjectOfType <SoundManagerScript>(); menu = FindObjectOfType <InGameMenu>(); gunScript = FindObjectOfType <GunController>(); }
void Awake() { if (instance == null) { instance = this; } }
private void Start() { CorrectWorkingState(); inGameMenu = InGameMenu.instance; generationPrefab = null; generationPrefabID = 0; }
void Awake() { // Do any general system initialization stuff here. igm = GetComponent<InGameMenu>(); SetState(State.SetupNewGame); }
void toggleInGameMenu() { //in-Game Menu code -- EXTRACT METHOD //this block of code expands the menu screen // LayerMask.GetMask ("Shootable"))) { if (Application.loadedLevelName == "Level 01") { RaycastHit hit; Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)); if (Physics.Raycast(ray, out hit, 100f, LayerMask.GetMask("InGameMenu"))) { InGameMenu ingamemenu_temp = hit.collider.GetComponent <InGameMenu> (); if (Application.loadedLevelName == "Level 01") { if (ingamemenu_temp) { Debug.Log("HIT WAS SUCCESFULL"); ingamemenu.expand = true; } } } else { ingamemenu.expand = false; } } }
public InGameMenuWiring(ScriptClient client, InGameMenu inGameMenu, ExitMenu exitMenu, WaitScreen waitScreen, Login.Login login, CharacterList characterList, LeaveGameSender leaveMsgSender) { inGameMenu.BackToMainMenu += sender => { leaveMsgSender.SendLeaveGameMessage(); waitScreen.Message = "Lade Charakterliste..."; waitScreen.Open(); sender.Close(); characterList.RefreshFromServer(); }; inGameMenu.BackToLoginSelected += sender => { sender.Close(); waitScreen.Message = "Logout läuft..."; waitScreen.Open(); login.StartLogout(); }; inGameMenu.ExitGameSelected += sender => { sender.Close(); exitMenu.Open(); }; inGameMenu.OnEscape += sender => sender.Close(); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { InGameMenu.Show(); } }
void Awake() { mainFSM = new FiniteStateMachine<State>(); mainFSM.AddTransition(State.Initialize, State.SetupNewGame, null, InitializeNewGame, OnSettingUpNewGame); mainFSM.AddTransition(State.SetupNewGame, State.Game, null, () => StartCoroutine(InitializeGameLogicStuff()), null); mainFSM.AddTransition(State.Game, State.GameOver, OnGameIsOver); mainFSM.AddTransition(State.GameOver, State.Restart, null); mainFSM.AddTransition(State.Restart, State.SetupNewGame, null, InitializeNewGame, null); mainFSM.AddTransition(State.Restart, State.Quit, null); mainFSM.StateChanged += (object s, EventArgs e) => { Debug.Log("state: " + mainFSM.CurrentState.ToString() + " | game state: " + gameFSM.CurrentState.ToString()); }; gameFSM = new FiniteStateMachine<GameState>(); gameFSM.AddTransition(GameState.Idle, GameState.InGameMenu, OnInGameMenuOpened); gameFSM.AddTransition(GameState.InGameMenu, GameState.Idle, OnInGameMenuClosed); gameFSM.StateChanged += (object s, EventArgs e) => { Debug.Log("state: " + mainFSM.CurrentState.ToString() + " | game state: " + gameFSM.CurrentState.ToString()); }; GameIsOver += (object s, EventArgs e) => { Debug.Log("oh no!"); }; InGameMenuOpened += (object s, EventArgs e) => { Time.timeScale = 0f; Debug.Log("PAUSED"); }; InGameMenuClosed += (object s, EventArgs e) => { Time.timeScale = 1f; Debug.Log("UNPAUSED"); }; igm = GetComponent<InGameMenu>(); mainFSM.ChangeState(State.SetupNewGame); }
public void AtivarGameOver() { PauseMenu.SetActive(false); InGameMenu.SetActive(false); GameOver.SetActive(true); Time.timeScale = 0; }
public override void Inputs_CANCEL() { base.Inputs_CANCEL(); State = MainMenuStates.InGameMenu; InGameMenu.ReInit(); fade = 0; }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } // Array of menu item control names. menuOptions = new Dictionary <String, Vector3>(); float anchorMinYLeft = selector.transform.GetChild(0).GetComponent <RectTransform>().anchorMin.y; float anchorMaxYLeft = selector.transform.GetChild(0).GetComponent <RectTransform>().anchorMax.y; float anchorMinYRight = selector.transform.GetChild(1).GetComponent <RectTransform>().anchorMin.y; float anchorMaxYRight = selector.transform.GetChild(1).GetComponent <RectTransform>().anchorMax.y; menuOptions.Add("Quit to Main Menu", new Vector3(anchorMinYLeft, anchorMaxYLeft)); menuOptions.Add("Quit to Desktop", new Vector3(anchorMinYLeft, anchorMaxYLeft - CHANGE_POSITION_VALUE)); // Default selected menu item (in this case, Tutorial). }
void Start() { inMenu = false; backPanel.SetActive(inMenu); Time.timeScale = 1; //Cursor.visible = inMenu; instance = this; }
void Start() { myRigidBody = GetComponent <Rigidbody>(); mainCamera = FindObjectOfType <Camera>(); Gun.canFire = true; Gun.canThrow = true; menu = FindObjectOfType <InGameMenu>(); }
//Initializing the Manager by populating the menus //Also sets up the starting state and initializes the In Game Menu public void Init() { StartMenu = (StartMenu)MenuDictionary[MenuState.StartMenu.ToString()]; InGameMenu = (InGameMenu)MenuDictionary[MenuState.InGameMenu.ToString()]; ResultMenu = (ResultMenu)MenuDictionary[MenuState.ResultMenu.ToString()]; SetState(MenuState.StartMenu); InGameMenu.Init(); }
void Update() { if (InGameMenu.isMenuShowing()) { return; } if (Input.GetButtonDown("Interact") && currentInterObj) { if (currentInterObjScript.talks) { } if (currentInterObjScript.openable) { hubChest.toolTipObject.SetActive(false); equipment.toolTipObject.SetActive(false); if (currentInterObj.name == "HubChest" && !hubChest.inventoryEnabled) { equipment.invsOpen++; hubChest.inventoryEnabled = !hubChest.inventoryEnabled; EventSystem.current.SetSelectedGameObject(hubChest.slots[0].gameObject); hubChest.inventoryUI.SetActive(true); player.playerMovement.SetEnabled(false); followCamera.SetEnabled(false); hubChest.ShowToolTip(hubChest.slots[0]); hubChest.CompareToolTips(hubChest.slots[0]); } else if (currentInterObj.name == "HubChest" && hubChest.inventoryEnabled) { hubChest.inventoryUI.SetActive(false); equipment.invsOpen--; if (equipment.invsOpen == 0) { player.playerMovement.SetEnabled(true); followCamera.SetEnabled(true); } EventSystem.current.SetSelectedGameObject(equipment.slots[0].gameObject); hubChest.HideToolTip(hubChest.slots[0]); hubChest.HideCompareToolTips(); hubChest.FindGrey(); hubChest.inventoryEnabled = false; if (equipment.inventoryEnabled) { equipment.ShowToolTip(equipment.slots[0]); } } } } if (Input.GetButtonDown("UseHealthPotion")) { player.UsePotionStart(); } if (Input.GetButtonDown("SortInventory") && hubChest.inventoryEnabled) { Sort(); } }
private void Awake() { if (instance == null) { instance = this; return; } Debug.Log("More than one menu."); }
public void AddInGameMenuFunctionality(InGameMenu inGameMenu) { this.inGameMenu = inGameMenu; scoreText = inGameMenu.ScoreText; inGameMenu.SpawnButton.onClick.AddListener(delegate { Player.Instance.Stack(); }); }
void Start() { m_AudioSource = GetComponent <AudioSource>(); NadeReady.SetActive(true); NadeUnready.SetActive(false); menu = FindObjectOfType <InGameMenu>(); pointScript = FindObjectOfType <PointScript>(); playercontroler = FindObjectOfType <PlayerController>(); }
public maskTest2(Game game) : base(game) { LoadContent(Game.Content); world = new World(Game,new DestructableLevel(Game, _Planet, _AlphaMap)); pauseMenu = new InGameMenu(Game); world.Players.Add(new Player(Game, PlayerIndex.One, new Vector2(200, 200))); //Kenneth: Hardkodet inn HUDposition... camera1 = new Camera(world.Players[0], world, Vector2.Zero, new Rectangle(0, 0, Game.Window.ClientBounds.Width, Game.Window.ClientBounds.Height - 100), new Rectangle(0,Game.Window.ClientBounds.Height - 100, Game.Window.ClientBounds.Width, 100)); }
public void ShowMenu(InGameMenu _Menu) { if (Menu != null) { Menu.InGameOpen = false; } Menu = _Menu; Menu.InGameOpen = true; }
void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { InGameMenu.Show(); } if (dataNewlyBound) { dataNewlyBound = false; MultiplayerGamers.ResetPlayers(); UIGameTable.CleanTable(); // GET CURRENT PLAYER SEATS object seat0, seat1, seat2, seat3; if (RoomProperties.TryGetValue("SEAT0", out seat0)) { MultiplayerGamers.UserJoined(seat0.ToString(), 0, seat0.ToString().Equals(player.GetInternalPlayer().PlayerName)); } if (RoomProperties.TryGetValue("SEAT1", out seat1)) { MultiplayerGamers.UserJoined(seat1.ToString(), 1, seat1.ToString().Equals(player.GetInternalPlayer().PlayerName)); } if (RoomProperties.TryGetValue("SEAT2", out seat2)) { MultiplayerGamers.UserJoined(seat2.ToString(), 2, seat2.ToString().Equals(player.GetInternalPlayer().PlayerName)); } if (RoomProperties.TryGetValue("SEAT3", out seat3)) { MultiplayerGamers.UserJoined(seat3.ToString(), 3, seat3.ToString().Equals(player.GetInternalPlayer().PlayerName)); } object gameType, gameGoal; if (RoomProperties.TryGetValue("TYPE", out gameType)) { if (gameType.ToString() == "0") { MultiplayerManager.CurrentEndCondition = Common.Enums.GameMode.RoundCount; } else { MultiplayerManager.CurrentEndCondition = Common.Enums.GameMode.TargetScore; } } if (RoomProperties.TryGetValue("GOAL", out gameGoal)) { MultiplayerManager.CurrentEndConditionGoal = gameGoal; } } }
private void Start() { inGameMenu = InGameMenu.instance; firstThroughput = 1; secondThroughput = 1; thirdThroughput = 1; outputIndx = 1; ClearOutputCounters(); }
void AddInGameMenu(Player player) { var inGameMenu = new InGameMenu(); inGameMenu.playingGameState = this; inGameMenu.player = player; inGameMenu.menuPlacement = player.localNumber == 2 ? MenuAnchor.TopRight : MenuAnchor.TopLeft; inGameMenu.Setup(); inGameMenus.Add(inGameMenu); }
// InGameMenu inGameMenu; private void Awake() { dazzaRB = GetComponent <Rigidbody2D>(); // inGameMenu = FindObjectOfType<InGameMenu>().GetComponent<InGameMenu>(); gameController = GameObject.FindWithTag("GameController").GetComponent <GameController>(); powerUpController = transform.GetComponent <PowerUpController>(); upgradeController = gameController.GetComponent <UpgradeController>(); gameData = GameObject.Find("DataController").GetComponent <GameData>(); inGameMenu = FindObjectOfType <InGameMenu>().GetComponent <InGameMenu>(); }
// Use this for initialization void Awake() { playerController = GetComponent <CharacterController>(); inGameMenu = GameObject.FindGameObjectWithTag("InGameMenu").GetComponent <InGameMenu>(); gui = GameObject.FindWithTag("GUI").GetComponent <GUI_HUD>(); cam = Camera.main; Cursor.visible = false; rotationSpeed = PlayerPrefs.GetFloat("RotationSensitivity"); EquipGun(PlayerPrefs.GetInt("playerLoadout")); }
void Update() { if (Input.GetButtonDown("Interact") && !InGameMenu.isMenuShowing()) { if (interactAction != null) { interactAction.Invoke(); } } timePlayed += Time.deltaTime; }
private void InitializeMenus() { Transform canvas = GameObject.Find("Canvas").transform; menuManager = canvas.GetComponent<InGameMenuMenager>(); escMenu = canvas.Find("EscMenu").GetComponent<InGameMenu>(); inventoryMenu = canvas.Find("InventoryMenu").GetComponent<InGameMenu>(); cardMenu = canvas.Find("CardMenu").gameObject; worldMapMenu = canvas.Find("WorldMapMenu").gameObject; abilityBookMenu = canvas.Find("AbilityBookMenu").gameObject; minimapFrame = canvas.Find("MinimapFrame").gameObject; }
private void spawnPlayer() { Debug.Log("Spawning player"); Vertex spawnPoint; do // Don't spawn the player on portals. Warning: infinite loop if there are only 1-2 cells { spawnPoint = masterDt.vertices[mt.Next(masterDt.vertices.Count - 1)]; } while (spawnPoint.cell.hasPortal); SpawnPoint spawner = GameObject.FindGameObjectWithTag("Spawn Point").GetComponent <SpawnPoint>(); spawner.transform.position = spawnPoint.toVector3AtHeight(currentDungeonType.wallHeight * 0.8f); player = spawner.spawnPlayer(); // Attach any other stuff to player here Cheats cheater = GameObject.FindObjectOfType <Cheats>(); cheater.player = player; cheater.playerMovement = player.GetComponentInChildren <PlayerMovement>(); InGameMenu menu = GameObject.FindObjectOfType <InGameMenu>(); menu.player = player; // Set up HUD GameObject hud = GameObject.Find("HUD"); hud.GetComponent <Canvas>().enabled = true; HUD hudScript = hud.GetComponentInChildren <HUD>(); hudScript.escapeHatch = GameObject.Find("Escape Point").transform; hudScript.playerTransform = player.transform; // Enable firing script (disabled in hub) PlayerShoot shootScript = player.GetComponentInChildren <PlayerShoot>(); shootScript.enabled = true; if (StateManager.startedFromDungeon) { // Give player weapons when starting in dungeon, since that implies it's a dev starting in the editor Debug.Log("Looks like you launched this scene directly from the editor. Here's some free stuff..."); StateManager.cashOnHand = debugCash; Inventory playerInventory = GameObject.FindGameObjectWithTag("Player Inventory").GetComponentInChildren <Inventory>(); foreach (GameObject weapon in debugWeapons) { GameObject realWeapon = Instantiate(weapon); playerInventory.addWeapon(realWeapon); } } // Enable temporary player invincibility on spawn StartCoroutine(player.GetComponentInChildren <PlayerHealth>().enableIframes(5f)); }
public maskTest(Game game) : base(game) { LoadContent(Game.Content); world = new World(Game,new DestructableLevel(Game, _Planet, _AlphaMap)); pauseMenu = new InGameMenu(Game); world.Players.Add(new Player(Game, PlayerIndex.One, new Vector2(200, 200))); world.Players.Add(new Player(Game, PlayerIndex.Two, new Vector2(300, 200))); //Kenneth: Hardkodet inn HUDposition... Vi MÅ sende med game.window.bounds som parameter siden resten av HUD er posisjonert relativt til HUDposition. camera1 = new Camera(world.Players[0], world, Vector2.Zero, new Rectangle(0, 0, Game.Window.ClientBounds.Width/2, Game.Window.ClientBounds.Height), new Rectangle(Game.Window.ClientBounds.Width / 2 , 0, Game.Window.ClientBounds.Width / 2, Game.Window.ClientBounds.Height)); camera2 = new Camera(world.Players[1], world, Vector2.Zero, new Rectangle(Game.Window.ClientBounds.Width / 2, 0, Game.Window.ClientBounds.Width / 2, Game.Window.ClientBounds.Height), new Rectangle(Game.Window.ClientBounds.Width / 2, 0, Game.Window.ClientBounds.Width / 2, Game.Window.ClientBounds.Height)); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(this.gameObject); Debug.LogError("Destroyed " + gameObject.name + " because another instance of InGameMenu allready exists."); } }
public void LoadMenu(InGameMenu newMenu) { if (SelectedMenu != null) { CloseSelectedMenu(); } SelectedMenu = newMenu; SelectedMenu.IsOpen = true; ChangeEnableOnControls(); OnMenuOpening(this); }
public InGame(Game game) : base(game) { player = new Player(game, PlayerIndex.One, new Vector2(100f, 100f)); test = ((ContentLoader<SoundEffect>)Game.Services.GetService(typeof(ContentLoader<SoundEffect>))).get("test").CreateInstance(); test2 = ((ContentLoader<SoundEffect>)Game.Services.GetService(typeof(ContentLoader<SoundEffect>))).get("test2").CreateInstance(); test.Play(); test2.IsLooped = false; pauseMenu = new InGameMenu(Game); particleEmitter = new TestParticleEmitterKenneth(game, "reticule", 200, player.getReticulePosition(), player.getReticulePositionNormalized(), 200, 200000, Color.White); rock = new Sprite(game, "Rock"); mouseState = Mouse.GetState(); mouseCollisionRectangle = new Rectangle(mouseState.X, mouseState.Y, 20, 20); //Testing av gridnett int gridWidth = game.Window.ClientBounds.Width / 100; //Et rektangel i gridnettet er 100 * 100. Deler derfor på 100 for å få antall rektangler. int gridHeight = game.Window.ClientBounds.Height / 100; //Samme her. Tallet fra denne matten blir ikke riktig int gridSize = gridWidth * (gridHeight * 2); //Derfor ganges høyden med 2. Merk at vi da får for mange rektangler totalt, dvs. rektanglene går utenfor skjermen(Bedre enn å ha for få da). int x = 0; //brukes til å plassere rektangler på x-aksen i løkka nedenfor int y = 0; //brukes til å plassere rektangler på y-aksen i løkka nedenfor Console.WriteLine(gridSize); //Debug Console.WriteLine(gridWidth); Console.WriteLine(gridHeight); collisionGrid = new List<CollisionBox>(); //Listen initialiseres for (int i = 0; i < gridSize; i++) { collisionGrid.Add(new CollisionBox(new Rectangle(x, y, 100, 100))); x += 100; if (collisionGrid.ElementAt(i).rectangle.X > game.Window.ClientBounds.Width) { x = 0; y += 100; } } }
public void SetOptionsController(InGameMenu igm) { optionsController = igm; }
void Awake() { if (instance != null){ Debug.LogWarning("There are 2 gui managers"); } instance = this; activeControls = new List<GUIControl>(); controlsToRemove = new List<GUIControl>(); controlsToAdd = new List<GUIControl>(); chatMenu = GetComponent<ChatMenu>(); inGameMenu = GetComponent<InGameMenu>(); interactionMenu = GetComponent<InteractionMenu>(); pauseMenu = GetComponent<PauseMenu>(); loadingScreen = GetComponent<LoadingScreen>(); }
void Awake() { if (instance == null) instance = this; }
private void OpenMenu(InGameMenu menu) { if (isInGameMenuOpen == false) { menuManager.LoadMenu(menu); isInGameMenuOpen = true; } else { menuManager.CloseMenu(); isInGameMenuOpen = false; } }
public void SetWarningController(InGameMenu igm) { warningController = igm; }
protected void initializeInGameMenu(){ if(playerEnabled){ gameMenu = (InGameMenu) GameObject.FindObjectOfType (typeof (InGameMenu)); } }
void Awake() { // Assumes this script is on the same object as the InGameMenu script. igm = gameObject.GetComponent<InGameMenu>(); }