public static void NewGame() { Objects = new List <GameObject> (); Map = new Tile[MAP_WIDTH, MAP_HEIGHT]; Log = new List <Message>(); abilityGUI = new AbilityGUI(); statusGUI = new StatusGUI(); equipmentGUI = new EquipmentGUI(5); inventoryGUI = new InventoryGUI(); Map = MapMaker.MakeTunnelMap(false); miniMap = new MiniMap(30, 20, Map); PlayerObject = new GameObject(StartPosition.x, StartPosition.y, "hero", 120, 200, (int)(0.05 * Game1.WIDTH - 124.21), (int)(0.61 * Game1.HEIGHT - 670)); PlayerObject.Player = new Player(10); PlayerObject.Player.Owner = PlayerObject; PlayerObject.Fighter = new Fighter(2, 5, 0, 0); PlayerObject.Fighter.Owner = PlayerObject; Objects.Add(PlayerObject); DeathScreen.OnStart(); Started = true; ToRemove = new List <GameObject>(); GoToPlaying(); //Console.Out.WriteLine(PlayerObject.x.ToString() + ";" + PlayerObject.y.ToString()); //Console.Out.WriteLine("Position : " + PlayerObject.Position.x.ToString() + ";" + PlayerObject.Position.y.ToString()); //Console.Out.WriteLine("InventoryWidth:" + InventoryWidth.ToString()); }
public override async void _Ready() { _crystal = GetNode <Character>("Crystal"); _waveSpawner = GetNode <WaveSpawner>("WaveSpawner"); _enemyContainer = _waveSpawner.GetEnemyContainer(); _moneyNode = GetNode <MoneyNode>("Hud/Money"); _global = GetTree().Root.GetNode <Global>("Global"); _sceneChanger = GetTree().Root.GetNode <SceneChanger>("SceneChanger"); _jumpScreen = GetNode <JumpScreen>("JumpScreen"); _fireworks = GetNode <Fireworks>("Fireworks"); _deathScreen = GetNode <DeathScreen>("DeathScreen"); _musicPlayer = GetNode <BattleGroundMusicPlayer>("BattleGroundMusicPlayer"); _enemyContainer.Connect(nameof(EnemyContainer.Updated), this, nameof(_OnEnemyContainerUpdated)); _enemyContainer.Connect(nameof(EnemyContainer.EnemyDeath), this, nameof(_OnEnemyDeath)); _stateMachine = new StateMachine(); PauseState = new PauseState(this, _stateMachine); PlayerAttackState = new PlayerAttackState(this, _stateMachine); _stateMachine.Initialize(PlayerAttackState); _jumpScreen.EnterAnimation(); await ToSignal(_jumpScreen, nameof(JumpScreen.AnimationFinished)); foreach (var effect in GetNode <HBoxContainer>("Hud/Effects").GetChildren()) { (effect as Effect).Init(this); } Start(3, _global.Level); }
public ScreenSelect() { RunningState.set_state(1); //Set to 1 for title do { switch (RunningState.get_state()) { case (1): //1 for title screen using (var game = new TitleScreen()) game.Run(); break; case (2): //2 for game screen using (var game = new GameScreen()) game.Run(); break; case (3): //3 for death screen using (var game = new DeathScreen()) game.Run(); break; } } while (RunningState.get_state() != 0); //Run the game until the running state is at 0, where the game will exit }
// Use this for initialization void Start() { player = FindObjectOfType <Player> (); rend = player.GetComponent <Renderer> (); playerHealth = FindObjectOfType <PlayerHealth> (); deathScreen = FindObjectOfType <DeathScreen> (); }
void Start() { this.animator = GetComponent <Animator>(); this.deathScreen = Resources.FindObjectsOfTypeAll <DeathScreen>() // Get the first DeathScreen that's not a prefab (detects inactive objects) .First(ds => ds.gameObject.scene.name != null); // This is to check if it's not a prefab but an instance }
protected override void OnLoadContent() { base.OnLoadContent(); ESCMenu menu = new ESCMenu(); AddChild(menu, 6); menu.SetPositionInScreenPercent(50, 50); ChampionState = new CurrentChampionState(100, 100); AddChild(new GameUI(ChampionState, new PingCounter(() => { return(Client.Instance.GetPing().TotalMilliseconds); }), GameScore), 3); AddChild(KillDisplay, 3); AddChild(DeathScreen = new DeathScreen(), 4); AddChild(WinLoseScreen = new WinLoseScreen(), 5); AddChild(GameWorld, 1); Map = new DrawableTileMap(Match.World.Map, Match.World.Map.TileSet); GameWorld.AddChild(Map); Client.RegisterCommandHandler(ServerCommand.JoinedGame, OnJoinedGame); Client.RegisterCommandHandler(ServerCommand.NewRemotePlayer, OnNewRemotePlayer); Client.RegisterCommandHandler(ServerCommand.StateUpdate, OnStateUpdate); AddChild(Parallax, 0); ((SoundService)Services.GetService(typeof(SoundService))).PlayMusic("Sounds/Musics/SonOfARocket"); }
public void Die(string reason) { DeathScreen screen = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <DeathScreen>(); ReasonText.text = reason; screen.Show(); }
public void hookUpInterface() { inGameScreen = new inGame(ref p1); charCreation = new CharacterCreation(ref p1); startScreen = new StartScreen(); deathScreen = new DeathScreen(); startScreen.NewGame.Click += NewGame_Click; startScreen.LoadGame.Click += loadGame_Click; deathScreen.StartScreen.Click += StartGame_Click; deathScreen.EndGame.Click += EndGame_Click; charCreation.strUp.Click += plusStr_Click; charCreation.dexUp.Click += plusDex_Click; charCreation.intUp.Click += plusInt_Click; charCreation.strdwn.Click += strdwn_Click; charCreation.dexdwn.Click += dexdwn_Click; charCreation.intdwn.Click += intdwn_Click; charCreation.completeButton.Click += completeButton_Click; inGameScreen.muteButton.Click += muteSound_Click; inGameScreen.armorBox.SelectionChanged += armorBox_SelectionChanged; inGameScreen.weaponBox.SelectionChanged += weaponBox_SelectionChanged; inGameScreen.useConsumable.Click += useConsumable_Click; inGameScreen.plusDex.Click += plusDex_Click; inGameScreen.plusInt.Click += plusInt_Click; inGameScreen.plusStr.Click += plusStr_Click; inGameScreen.Shop1.sellWeapon.Click += sellWeapon_Click; inGameScreen.Shop1.sellArmor.Click += sellArmor_Click; inGameScreen.Shop1.sellConsumable.Click += sellConsumable_Click; inGameScreen.Shop1.buyWeapon.Click += buyWeapon_Click; inGameScreen.Shop1.buyArmor.Click += buyArmor_Click; inGameScreen.Shop1.buyConsumable.Click += buyConsumable_Click; inGameScreen.Shop1.weaponBox.ItemsSource = p1.weaponInventory; inGameScreen.Shop1.armorBox.ItemsSource = p1.armorInventory; inGameScreen.Shop1.consumeBox.ItemsSource = p1.itemInventory; inGameScreen.Shop1.weaponBox.SelectionChanged += storeWeaponBox_SelectionChanged; inGameScreen.Shop1.armorBox.SelectionChanged += storeArmorBox_SelectionChanged; inGameScreen.Shop1.consumeBox.SelectionChanged += storeConsumeBox_SelectionChanged; inGameScreen.Shop1.shopWeaponBox.SelectionChanged += shopWeaponBox_SelectionChanged; inGameScreen.Shop1.shopArmorBox.SelectionChanged += shopArmorBox_SelectionChanged; inGameScreen.Shop1.shopConsumeBox.SelectionChanged += shopConsumeBox_SelectionChanged; inGameScreen.Shop1.shopWeaponBox.ItemsSource = shopWeaponInventory; inGameScreen.Shop1.shopArmorBox.ItemsSource = shopArmorInventory; inGameScreen.Shop1.shopConsumeBox.ItemsSource = shopConsumableInventory; inGameScreen.Shop1.playerGold.DataContext = p1; inGameScreen.Shop1.Visibility = Visibility.Hidden; }
private void Client_OnKilledShared(bool killedBy, Character attacker, ref uLink.NetworkMessageInfo info) { Controllable controllable; bool flag; AudioClipArray trait = base.GetTrait <CharacterSoundsTrait>().death; AudioClip item = trait[UnityEngine.Random.Range(0, trait.Length)]; item.Play(base.transform.position, 1f, 1f, 10f); bool flag1 = base.localControlled; if (flag1) { base.rposLimitFlags = RPOSLimitFlags.KeepOff | RPOSLimitFlags.HideInventory | RPOSLimitFlags.HideContext | RPOSLimitFlags.HideSprites; DeathScreen.Show(); } BaseHitBox remote = base.idMain.GetRemote <BaseHitBox>(); if (remote) { remote.collider.enabled = false; } if (!killedBy || !attacker) { controllable = null; flag = false; } else { controllable = attacker.controllable; flag = (!controllable ? false : controllable.localPlayerControlled); } base.AdjustClientSideHealth(0f); if (flag1 || flag) { InterpTimedEvent.Queue(this, "ClientLocalDeath", ref info); if (!flag1) { InterpTimedEvent.Remove(this, true); } else { InterpTimedEvent.Clear(true); } } else { Collider[] componentsInChildren = base.GetComponentsInChildren <Collider>(); for (int i = 0; i < (int)componentsInChildren.Length; i++) { Collider collider = componentsInChildren[i]; if (collider) { collider.enabled = false; } } InterpTimedEvent.Queue(this, "RAG", ref info); NetCull.DontDestroyWithNetwork(this); } }
// Event handler for RLNET's Render event private static void OnRootConsoleRender(object sender, UpdateEventArgs e) { if (_renderRequired) { _mapConsole.Clear(); _statConsole.Clear(); _messageConsole.Clear(); DungeonMap.Draw(_mapConsole, _statConsole); Player.Draw(_mapConsole); Player.DrawStats(_statConsole); MessageLog.Draw(_messageConsole); if (!Globals.BuildingEntranceIsTriggered && !Globals.IsPlayerDead && !Globals.IsBossDead) { // Blit the sub consoles to the root console in the correct locations RLConsole.Blit(_mapConsole, 0, 0, _mapWidth, _mapHeight, _rootConsole, 0, 0); RLConsole.Blit(_statConsole, 0, 0, _statWidth, _statHeight, _rootConsole, _mapWidth, 0); RLConsole.Blit(_messageConsole, 0, 0, _messageWidth, _messageHeight, _rootConsole, 0, _screenHeight - _messageHeight); } else if (Globals.BuildingEntranceIsTriggered) { if (Globals.SheriffTriggered) { QuestMenu.CreateQuestMenu(_rootConsole); } else if (Globals.GenericMenuTriggered) { Menu.CreateMenu(_rootConsole); } else { Globals.BuildingEntranceIsTriggered = false; } } else if (Globals.IsBossDead) { WinMenu.CreateWinScreen(_rootConsole); } else if (Globals.IsPlayerDead) { if (Player.Health <= 0) { DeathScreen.CreateDeathScreen(_rootConsole); } else { Globals.IsPlayerDead = false; } } // Tell RLNET to draw the console that we set _rootConsole.Draw(); _renderRequired = false; } }
private void Awake() { if (Instance != null) { Destroy(this.gameObject); return; } Instance = this; }
// Use this for initialization void Start() { levelManager = FindObjectOfType <LevelManager> (); anim = gameObject.GetComponent <Animator>(); rb2d = gameObject.GetComponent <Rigidbody2D>(); playerHealth = FindObjectOfType <PlayerHealth> (); deathScreen = FindObjectOfType <DeathScreen> (); }
IEnumerator DeathProcess(string reason) { DeathScreen deathScreen = FindObjectOfType <DeathScreen>(); deathScreen.SetText(reason); yield return(new WaitForSecondsRealtime(4)); LoadLevel(currentLevel); }
public static void OnPlayerShipDestroyed() { StopGameTimer(); isShowingDeathScreen = true; DeathScreen deathScreen = GameObject.Instantiate(deathScreenPrefab, Vector3.zero, Quaternion.identity).GetComponent <DeathScreen>(); deathScreen.ShowDeathScreen(); }
private void Client_OnKilledShared(bool killedBy, Character attacker, ref NetworkMessageInfo info) { Controllable controllable; bool flag2; AudioClipArray death = base.GetTrait <CharacterSoundsTrait>().death; death[Random.Range(0, death.Length)].Play(base.transform.position, (float)1f, (float)1f, (float)10f); bool localControlled = base.localControlled; if (localControlled) { base.rposLimitFlags = RPOSLimitFlags.HideSprites | RPOSLimitFlags.HideContext | RPOSLimitFlags.HideInventory | RPOSLimitFlags.KeepOff; DeathScreen.Show(); } BaseHitBox remote = base.idMain.GetRemote <BaseHitBox>(); if (remote != null) { remote.collider.enabled = false; } if (killedBy && (attacker != null)) { controllable = attacker.controllable; flag2 = (controllable != null) && controllable.localPlayerControlled; } else { controllable = null; flag2 = false; } base.AdjustClientSideHealth(0f); if (!localControlled && !flag2) { foreach (Collider collider in base.GetComponentsInChildren <Collider>()) { if (collider != null) { collider.enabled = false; } } InterpTimedEvent.Queue(this, "RAG", ref info); NetCull.DontDestroyWithNetwork((MonoBehaviour)this); } else { InterpTimedEvent.Queue(this, "ClientLocalDeath", ref info); if (localControlled) { InterpTimedEvent.Clear(true); } else { InterpTimedEvent.Remove(this, true); } } }
private void InitializeComponents() { PauseMenu.SetActive(false); SettingsMenu.SetActive(false); DeathScreen.SetActive(false); //Inventory.SetActive(false); //TimerPopup.SetActive(false); GamePlay.SetActive(worldStateOnLoad); }
void Start() { player = FindObjectOfType <Player>(); scoreAdditionSpawnPosition = scoreAddition; multiplierDisplay = FindObjectOfType <MultiplierDisplay>(); scoreDisplay = FindObjectOfType <ScoreDisplay>(); dead = false; audioManager = FindObjectOfType <AudioManager>(); deathScreen = FindObjectOfType <DeathScreen>(); deathScreen.ShowDeathScreen(false); pauseMenu = FindObjectOfType <PauseMenu>(); }
void Awake() { #region Singleton if (s_Instance != null) { Destroy(gameObject); return; } s_Instance = this; #endregion btnMainMenu.onClick.AddListener(OnMainMenu); }
public void TakeDamage(int dmg) { int armorDmg = Math.Min(Armor, dmg); Armor -= armorDmg; int HPdmg = dmg - armorDmg; HP -= HPdmg; if (Owner?.Player?.Equipment[Equipments.Equipment.EquipmentSlot.Armor] != null) { Owner.Player.Equipment[Equipments.Equipment.EquipmentSlot.Armor].Equipment.ArmorHP -= dmg; if (Owner.Player.Equipment[Equipments.Equipment.EquipmentSlot.Armor].Equipment.ArmorHP <= 0) { Owner.Player.Equipment[Equipments.Equipment.EquipmentSlot.Armor].Equipment.Break(); } } if (HPdmg > 0) { Color effectColor; if (Owner.Player != null) { effectColor = Color.DarkRed; } else { effectColor = Color.White; } Effect effect = new Effect("-" + HPdmg.ToString(), effectColor); Owner.AddEffect(effect); } if (HP <= 0) { if (Owner.Player != null) { DeathScreen.Initialize(); GameManager.CurrentState = GameManager.GameState.Dead; } else { GameManager.PlayerObject.Fighter.XP += this.XP; //if (GameManager.Objects.Contains(this.Owner)) //{ // GameManager.Objects.Remove(Owner); //} Owner.dieOnEffectsEnd = true; } } }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); throw new System.Exception("Only one instance of death screen may be alive at once, destroying the second one"); } DeathScreenCanvas.enabled = false; }
private void Awake() { gameState = GameObject.FindWithTag("GameState").GetComponent <GameState>(); meter_start = GameObject.FindWithTag("StartingArea").GetComponent <Meter_Start>(); odometer = GameObject.FindWithTag("ScoreCanvas").GetComponent <Odometer>(); deathScreen = GameObject.FindWithTag("DeathScreen").GetComponent <DeathScreen>(); SpawnPoint = new Vector3(-4.77f, -2.365f, 0f); CameraResetPoint = new Vector3(1.17f, 1.19f, -1f); }
void Awake() { if (instance == null) { instance = this; } else if (instance == this) { Destroy(gameObject); } animator = GetComponent <Animator>(); transform.localPosition = new Vector2(9999, 9999); animator.enabled = false; }
public void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; } if (SceneManager.GetSceneByName("Arena") == SceneManager.GetActiveScene()) { gameObject.SetActive(false); } }
public static void Main() { // This must be the exact name of the bitmap font file we are using or it will error. string fontFileName = "terminal8x8.png"; // The title will appear at the top of the console window string consoleTitle = "Hunter v0.0"; // Tell RLNet to use the bitmap font that we specified and that each tile is 8 x 8 pixels _rootConsole = new RLRootConsole(fontFileName, _screenWidth, _screenHeight, 8, 8, 1f, consoleTitle); // Initialize the sub consoles that we will Blit to the root console _mapConsole = new RLConsole(_mapWidth, _mapHeight); _messageConsole = new RLConsole(_messageWidth, _messageHeight); _statConsole = new RLConsole(_statWidth, _statHeight); Player = new Player(); CommandSystem = new CommandSystem(); QuestMenu = new QuestMenu(_menuWidth, _menuHeight); DeathScreen = new DeathScreen(_menuWidth, _menuHeight); WinMenu = new WinMenu(_menuWidth, _menuHeight); Menu = new Menu(_menuWidth, _menuHeight); SchedulingSystem = new SchedulingSystem(); // Create a new MessageLog and print the random seed used to generate the level MessageLog = new MessageLog(); MessageLog.Add("The rogue arrives on level 1"); MessageLog.Add("Prepare to fight for your life"); //Generate the map TownMap mapCreation = new TownMap(_mapWidth, _mapHeight); //SimpleBsp mapCreation = new SimpleBsp(_mapWidth, _mapHeight); //FullRoomBsp mapCreation = new FullRoomBsp(_mapWidth, _mapHeight); DungeonMap = mapCreation.CreateMap(); DungeonMap.UpdatePlayerFieldOfView(); // Set up a handler for RLNET's Update event _rootConsole.Update += OnRootConsoleUpdate; // Set up a handler for RLNET's Render event _rootConsole.Render += OnRootConsoleRender; // Begin RLNET's game loop _rootConsole.Run(); }
// Use this for initialization void Start() { if (instance != null) { Destroy(instance.gameObject); } instance = this; floatingTextManager = GetComponent <FloatingTextManager>(); healthBarManager = GetComponent <HealthBarManager>(); playerGUI = GetComponent <PlayerGUI>(); itemPopup = itemPopupObject.GetComponent <ItemPopup>(); loadScreen = GetComponent <LoadScreen>(); deathScreen = GetComponent <DeathScreen>(); bossGUI = GetComponent <BossGUI>(); }
// Update is called once per frame void Update() { if (HeroController.health <= 0) //Hero dies { //Spin transform.Rotate(new Vector3(0f, 0f, 1000f) * Time.deltaTime); //Shrink float newXScale = transform.localScale.x * 0.99f; float newYScale = transform.localScale.y * 0.99f; float newZScale = transform.localScale.z * 0.99f; if (newXScale > 0 && newYScale > 0 && newZScale > 0) { transform.localScale = new Vector3(newXScale, newYScale, newZScale); } //Make death screen visible DeathScreen.SetActive(true); TaskBar.SetActive(false); } }
public void ToggleMenu() { deathScreen = FindObjectOfType <DeathScreen>(); if (panel.activeInHierarchy) { deathScreen.HideDeathScreenWhenMenu(true); Time.timeScale = 1; menu = false; audioManager.ToggleMenu(menu); } else { deathScreen.HideDeathScreenWhenMenu(false); Time.timeScale = 0; menu = true; audioManager.ToggleMenu(menu); } panel.SetActive(menu); }
/// <summary> /// Builds a string for the final screens. /// </summary> /// <returns>String for the DSL</returns> public override string ToString() { string total; if (!String.IsNullOrEmpty(DeathScreen)) { DeathScreen = DeathScreen.Replace('\\', '/'); } if (!String.IsNullOrEmpty(EndScreen)) { EndScreen = EndScreen.Replace('\\', '/'); } total = "\t<screens>\r\n" + "\t\t<screen_end_game>" + EndScreen + "</screen_end_game>\r\n" + "\t\t<screen_dead_game>" + DeathScreen + "</screen_dead_game>\r\n" + "\t</screens>\r\n"; return(total); }
private void Update() { if (PlayerStats && PlayerStats.IsDead()) { DeathScreen.SetActive(true); Time.timeScale = 0; return; } if (Input.GetButtonDown("Pause") || Input.GetKeyDown(KeyCode.Escape)) { if (PauseMenu.activeSelf) { ResumeGame(); } else { PauseMenu.SetActive(true); Time.timeScale = 0; _lastVolumeValue = _backgroundMusic.volume; //BackgroundMusic.volume = 0; //Audio.SetActive(false); var music = GameObject.Find("BackgroundMusic").GetComponent <AudioSource>(); music.Pause(); var sound = GameObject.Find("AmbianceSound").GetComponent <AudioSource>(); sound.Pause(); } } if (!PauseMenu.activeSelf && Input.GetKeyDown(KeyCode.I)) { Inventory.SetActive(!Inventory.activeSelf); } }
protected override void LoadContent() { this.IsMouseVisible = true; this.graphics.PreferredBackBufferWidth = GlobalVariables.WindowWidthDefault; // set this value to the desired width of your window this.graphics.PreferredBackBufferHeight = GlobalVariables.WindowHeightDefault; // set this value to the desired height of your window this.graphics.ApplyChanges(); this.statPanel = new StatPanel(); this.startScreen = new StartScreen(); this.deathScreen = new DeathScreen(); this.stage = GameStages.Start_Stage; // Create a new SpriteBatch, which can be used to draw textures. this.spriteBatch = new SpriteBatch(this.GraphicsDevice); GfxHandler.Load(this.Content); this.startScreen.Load(this.Content); this.deathScreen.Load(this.Content); this.statPanel.Load(this.Content); }
private void Start() { DeathScreen.singleton = this; this.Hide(); }