public static void setInitWinLose() { if (m_Instance == null) m_Instance = GameManager.m_Instancce.m_PanelGameOver.GetComponent<GameOver>(); // m_isWin = true; m_Instance.m_TextState.text = "STATE " + ScoreManager.m_CurrentLevel.ToString(); if (m_isWin) { m_Instance.m_Index = 0; m_Instance.m_Postion[0].gameObject.SetActive(true); m_Instance.m_TankImagePostion.position = m_Instance.m_Postion[0].position;// new Vector3(m_TankImagePostion.position.x, m_Postion[m_Index].position.y, m_TankImagePostion.position.z); m_Instance.m_Title.sprite = m_Instance.m_ImageCompleted; if (ScoreManager.m_CurrentLevel + 1 > ScoreManager.m_LevelUNblock.NUM) { ScoreManager.m_LevelUNblock.NUM++; ScoreManager.Save(); } } else { m_Instance.m_Index = 1; m_Instance.m_Postion[0].gameObject.SetActive(false); m_Instance.m_TankImagePostion.position = m_Instance.m_Postion[1].position; m_Instance.m_Title.sprite = m_Instance.m_ImageGameOver; GameManager.m_TanksStarSave[0] = GameManager.m_TanksStarSave[1] = 0; } GameManager.ShowADS(); }
public virtual void Execute() { // PublishEventNode var PublishEventNode19_Event = new GameOver(); System.Publish(PublishEventNode19_Event); PublishEventNode19_Result = PublishEventNode19_Event; }
internal void game_over(int punkty,bool muzik) { GameOver gameover = new GameOver(punkty, muzik); gameover.Show(); //okienko game over, wprwaoadzanie wyniku }
void Start() { SpawnPlayers(); m_lifeBarManager_1.GenerateLifeBar(m_maxLives, m_playerMaterial_1); m_lifeBarManager_2.GenerateLifeBar(m_maxLives, m_playerMaterial_2); m_gameOver = FindObjectOfType<GameOver>(); m_cameraShake = FindObjectOfType<CameraShake>(); }
public void OutOfTime(GameOver model) { var session = GameHelper.GetSession(model.SessionID); foreach (var user in session.Users) { user.gameOver(String.Format("Player {0} ran out of time!", model.PlayerIndex)); this.LeaveGame(new LeaveGame { SessionID = model.SessionID }); } }
void Start() { spawnController = GameObject.Find("Spawner").GetComponent<Spawner_Script>(); distanceController = GameObject.Find("_DistanceController").GetComponent<DistanceController>(); fadeController = GameObject.Find("Fader").GetComponent<FadeInOut>(); gameOver = GameObject.Find("GameOver").GetComponent<GameOver>(); Invoke("stageStart", 0.25f); Invoke("startGame", 3.0f); }
public MainGame() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; // Create objects loading = new Loading(Content); mainMenu = new MainMenu(); gameStage = new GameStage(); gameOver = new GameOver(); }
public void GameOver(List<King> kings) { Debug.Log ("Game over"); gameOverKings = kings; Button[] bs = GameObject.FindObjectsOfType<Button>(); foreach(Button b in bs) b.interactable = false; gameOver = GameObject.FindObjectOfType<GameOver>(); if(gameOver != null) gameOver.UpdateValues(); }
//Game Over public void GameOver() { ReadyGo.Instance.Reset(); #if UNITY_ANDROID || UNITY_IOS //Debug.Log("Show Banner"); //GoogleAds_J60s.Instance.HideBanner(); //ChartboostAndroid.Instance.ShowInterstitial(ChartboostSDK.CBLocation.Default); //StartCoroutine(ShowChartbook()); Invoke("ShowChartbook", 0.5f); #endif MyApplication.Instance.googleAnalytics.LogEvent("GameOver", "Over", "", (int)Time.fixedTime); //MyApplication.Instance.googleAnalytics.LogScreen ("GameOver"); gameOver.gameObject.SetActive(true); gameOverController = gameOver.GetComponent<GameOver>(); if (gameOverController != null) { gameOverController.SaveScore(); gameOverController.SetMeo(); hightPointScore = gameOverController.GetHightScore(); _uiController.ResetFillAmount(); } }
private void Awake() { gM = FindObjectOfType <GameOver> (); //spikes = FindObjectsOfType<> }
public GameWorld(int width, int height, ContentManager Content) { screenWidth = width; screenHeight = height; random = new Random(); gameState = GameState.Menu; inputHelper = new InputHelper(); block = Content.Load<Texture2D>("block"); reset = Content.Load<Texture2D>("reset"); font = Content.Load<SpriteFont>("SpelFont"); font2 = Content.Load<SpriteFont>("SpriteFont1"); font3 = Content.Load<SpriteFont>("SpriteFont2"); playButton = Content.Load<Texture2D>("Play"); optionsButton = Content.Load<Texture2D>("Options"); backButton = Content.Load<Texture2D>("Back"); polytris = Content.Load<Texture2D>("Polytris"); grid = new TetrisGrid(block); level = 1; levelspeed = 1; score = 0; i = (int)random.Next(7) + 1; i2 = (int)random.Next(7) + 1; blockcounter = 1; blocks = new BlockList(block, Content); //Voegen de verschillende blockobjecten toe aan de lijst block1 = new Block1(block, Content); blocks.Add(block1, 1); block2 = new Block2(block, Content); blocks.Add(block2, 2); block3 = new Block3(block, Content); blocks.Add(block3, 3); block4 = new Block4(block, Content); blocks.Add(block4, 4); block5 = new Block5(block, Content); blocks.Add(block5, 5); block6 = new Block6(block, Content); blocks.Add(block6, 6); block7 = new Block7(block, Content); blocks.Add(block7, 7); //Voegen de verschillende blockobjecten toe aan een tweede lijst voor het tekenen van het volgende blokje block1res = new Block1(block, Content); blocks.AddToReserve(block1res, 1); block2res = new Block2(block, Content); blocks.AddToReserve(block2res, 2); block3res = new Block3(block, Content); blocks.AddToReserve(block3res, 3); block4res = new Block4(block, Content); blocks.AddToReserve(block4res, 4); block5res = new Block5(block, Content); blocks.AddToReserve(block5res, 5); block6res = new Block6(block, Content); blocks.AddToReserve(block6res, 6); block7res = new Block7(block, Content); blocks.AddToReserve(block7res, 7); options = new Options(block, reset, backButton, width, height, font, blocks); menu = new Menu(playButton, optionsButton, polytris, width, height); gameOver = new GameOver(backButton, width, height); }
public override void Initialize() { Name = "brass lantern"; Synonyms.Are("lamp", "headlamp", "headlight", "lantern", "light", "shiny", "brass"); Article = "the"; On = false; Switchable = true; DaemonStarted = true; PowerRemaining = 330; FoundIn <InsideBuilding>(); Describe = () => { if (On) { return("Your lamp is here, gleaming brightly."); } return("There is a shiny brass lamp nearby."); }; Daemon = () => { if (!On) { DaemonStarted = false; return; } int t = --PowerRemaining; if (t == 0) { Light = false; On = false; } var freshBatteries = Objects.Get <FreshBatteries>(); if (Inventory.Contains(this) || InScope) { string message = null; if (t == 0) { message = "\nYour lamp has run out of power."; if (!freshBatteries.InInventory && !CurrentRoom.Location.Light) { // TODO: deadflag = 3; message += " You can't explore the cave without a lamp. So let's call it a day."; Print(message); GameOver.Dead(); return; } else { message += ReplaceBatteries(); Print(message); } Print("\n"); return; } if (t == 30) { message = "\nYour lamp is getting dim."; if (freshBatteries.HaveBeenUsed) { message += " You're also out of spare batteries. You'd best start wrapping this up."; Print(message); return; } if (freshBatteries.InVendingMachine && Room <DeadEnd14>().Visited) { message += " You'd best start wrapping this up, " + "unless you can find some fresh batteries. " + "I seem to recall there's a vending machine in the maze. " + "Bring some coins with you."; Print(message); return; } if (!freshBatteries.InVendingMachine && !freshBatteries.InScope) { message += " You'd best go back for those batteries."; } Print(message); Print("\n"); return; } } }; Before <Examine>(() => { string result = "It is a shiny brass lamp"; if (!On) { result += ". It is not currently lit."; } else if (PowerRemaining < 30) { result += ", glowing dimly."; } else { result += ", glowing brightly."; } return(Print(result)); }); Before <Rub>(() => "Rubbing the electric lamp is not particularly rewarding. Anyway, nothing exciting happens."); Receive((obj) => { if (obj.Is <OldBatteries>()) { return("Those batteries are dead; they won't do any good at all."); } else if (obj.Is <FreshBatteries>()) { return(ReplaceBatteries()); } return("The only thing you might successfully put in the lamp is a fresh pair of batteries."); }); Before <SwitchOn>(() => { if (PowerRemaining <= 0) { return(Print("Unfortunately, the batteries seem to be dead.")); } return(false); }); After <SwitchOn>(() => { Light = true; DaemonStarted = true; }); After <SwitchOff>(() => { Light = false; }); }
public virtual void OnGameOver() { GameOver?.Invoke(this, Score); }
public void OnDestruction() { Debug.Log("MenuViewModel:OnDestroy"); GameStart.RemoveListener(OnGameStart); GameOver.RemoveListener(OnGameOver); }
private Vector2 respawnPosition = new Vector2(100,100); // Should set to map start point initially #endregion Fields #region Constructors public Lives(Game game, SpriteBatch spriteBatch, SpriteFont spriteFont) { gameOver = new GameOver(game,spriteBatch,spriteFont); game.Components.Add(gameOver); }
private bool OnGameOver(GameOver signal) { _isTimerActive = false; return(true); }
// Use this for initialization void Start() { //プレイヤー初期位置 PlayerInitialSetting(); clsGameOver = GetComponent< GameOver > (); clsBoxCreator = GetComponent< BoxCreator > (); clsBoxCreator.SetParam (boxPrefabs, labelPrefab, normalLabelMat, dangerLabelMat, boxLineNum, boxScale); //ボックスとラベルの設置 clsBoxCreator.CreateBoxesAndLabels (); }
private void OnGameOver(object sender, bool e) { GameOver?.Invoke(sender, e); }
// Use this for initialization void Start() { m_iState = 0; m_animator = GetComponent<Animator>(); m_YJump = transform.position.y; ObGameOver = FindObjectOfType<GameOver>(); Time.timeScale = 1; }
// Use this for initialization void Start () { gameOver = FindObjectOfType<GameOver>(); }
void Awake() { gameOver = GameObject.FindObjectOfType<GameOver>(); }
// Use this for initialization void Start() { myState = iDungIm; myBody2d = this.rigidbody2D; myAnimator = GetComponent<Animator> (); mainCamera = FindObjectOfType<MainCamera>(); ObGameOver = FindObjectOfType<GameOver>(); Time.timeScale = 1; }
// Use this for initialization void Start () { m_Instance = this; }
// Use this for initialization void Start() { crystal = GameObject.FindGameObjectWithTag("crystal"); gameObject.transform.position = new Vector3(crystal.transform.position.x, -10, crystal.transform.position.z); gameObject.transform.rotation = Quaternion.identity; player1 = GameObject.FindGameObjectWithTag("blue"); player2 = GameObject.FindGameObjectWithTag("red"); player3 = GameObject.FindGameObjectWithTag("green"); StartCoroutine(enablePlayersStart()); StartCoroutine(disablePlayersStart()); lastPlaying = player1; worldCenterY = this.GetComponent<Transform>().eulerAngles.y; Isgameover = GameObject.FindGameObjectWithTag("plane").GetComponent<GameOver>(); mainCamera = GameObject.Find("Main Camera"); }
void Update() { // calculation of time for eating the apple///////////////////////////////////// timeToEat += Time.deltaTime; timePlayed += Time.deltaTime; speed += timePlayed / 50; //////////////////////////////////////////////////////////////////////////////// // manipulation inputs///////////////////////////////////// transform.Translate(Vector3.forward * speed * Time.deltaTime); if (Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D)) { turnRight(); } if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A)) { turnLeft(); } if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.LeftAlt)) { speedUp(); } else { speedDown(); } if (Input.GetKey(KeyCode.Space)) { jump(); } scoreText.text = score.ToString(); if (score < PlayerPrefs.GetFloat("HighScore")) { highScore.text = PlayerPrefs.GetFloat("HighScore").ToString(); } else { highScore.text = score.ToString(); } /////////////////////////////////////////////////////////// // pause game////////////// if (Input.GetKeyDown(KeyCode.Escape) && level1.isPaused) { level1.ResumeGame(); level1.isPaused = false; } else if (Input.GetKeyDown(KeyCode.Escape) && !level1.isPaused) { level1.PauseGame(); level1.isPaused = true; } ////////////////////////// /////// GameOver process ////////////////////////////////// if (!isAlive) { musicSource.Stop(); GameOver.OnGameOver(this); } //////////////////////////////////////////////////////////// ////////// Touch inputs ///////////////////////////////// if (Input.touchCount == 1) { var touch = Input.touches[0]; if (touch.position.x < Screen.width / 2) { turnLeft(); } else if (touch.position.x > Screen.width / 2) { turnRight(); } } else if (Input.touchCount == 2) { speedUp(); } ////////////////////////////////////////////////////////////// }
// Use this for initialization void Start() { animationTest = this.GetComponent<SkeletonAnimation>(); m_transform = this.transform; gameOverObj = GameObject.Find("GameOver"); gameOverScript = gameOverObj.GetComponent<GameOver>(); furyBarObj = GameObject.Find("FuryBar"); furyBarScript = furyBarObj.GetComponent<FuryBarManager>(); enemyManagerObj = GameObject.Find("EnemyCreator"); enemyManagerScript = enemyManagerObj.GetComponent<EnemyManager>(); //mainScreenObj = GameObject.Find("MainCamera"); shakeScreenScript = mainScreenObj.GetComponent<ShakeScreen>(); attackAudioObj = GameObject.Find("AttackAudios"); attackAudioScript = attackAudioObj.GetComponent<attackAudio>(); AudioObj = GameObject.Find("Audios"); m_audioManager = AudioObj.GetComponent<AudioManager>(); scoreManagerObj = GameObject.Find("Kill"); m_scoreManager = scoreManagerObj.GetComponent<ScoreManager>(); minPosX = Screen.width / 16f * 6.5f; maxPosX = Screen.width / 16f * 9f; minPosY = Screen.height / 16f * 6.5f; maxPosY = Screen.height / 16f * 9f; animationTest.state.Event += Event; animationTest.state.End += state_End; //animationTest.state.End += (state, trackIndex) => //{ // Debug.Log("start: " + state.GetCurrent(trackIndex)); //}; //animationTest.state.End += ActionChange; }
// Use this for initialization void Start() { crystal = GameObject.FindGameObjectWithTag("crystal"); gameObject.transform.position = new Vector3(crystal.transform.position.x, -10, crystal.transform.position.z); gameObject.transform.rotation = Quaternion.identity; player1 = GameObject.FindGameObjectWithTag("blue"); player2 = GameObject.FindGameObjectWithTag("red"); player3 = GameObject.FindGameObjectWithTag("green"); player1.GetComponent<UnitySampleAssets.Characters.ThirdPerson.ThirdPersonCharacter>().enabled = true; player2.GetComponent<UnitySampleAssets.Characters.ThirdPerson.ThirdPersonCharacter>().enabled = false; player3.GetComponent<UnitySampleAssets.Characters.ThirdPerson.ThirdPersonCharacter>().enabled = false; player1.GetComponent<UnitySampleAssets.Characters.ThirdPerson.ThirdPersonUserControl>().enabled = true; player2.GetComponent<UnitySampleAssets.Characters.ThirdPerson.ThirdPersonUserControl>().enabled = false; player3.GetComponent<UnitySampleAssets.Characters.ThirdPerson.ThirdPersonUserControl>().enabled = false; lastPlaying = player1; worldCenterY = this.GetComponent<Transform>().eulerAngles.y; Isgameover = GameObject.FindGameObjectWithTag("plane").GetComponent<GameOver>(); }
public void Die() { GameOver?.Invoke(_isWinGame); }
private BallControl playerControl; // Reference to the player control script. #endregion Fields #region Methods void Awake() { pauser = GameObject.Find("Pauser").GetComponent<Pauser>(); gameOver = GameObject.Find ("GM").GetComponent<GameOver> (); }
// Update is called once per frame void Update() { if (!PauseMenuUI.activeInHierarchy) { CountTime(); } players = GameObject.FindGameObjectsWithTag("Player"); Player1 = players[0]; Player2 = players[1]; p1Lose = (HealthBarP1.Health <= 0); p2Lose = (HealthBarP2.Health <= 0); if (PauseMenuUI.activeInHierarchy) { Player1.GetComponent <PlayerControl>().enabled = false; Player2.GetComponent <PlayerControl>().enabled = false; if (Input.GetKeyDown(KeyCode.P) || Input.GetButtonDown("Pause1") || Input.GetButtonDown("Pause2")) { Resume(); } } else { Player1.GetComponent <PlayerControl>().enabled = true; Player2.GetComponent <PlayerControl>().enabled = true; if (Input.GetKeyDown(KeyCode.P) || Input.GetButtonDown("Pause1") || Input.GetButtonDown("Pause2")) { if (!GameOver.activeInHierarchy) { Pause(); } } } if (pp1Lose || pp2Lose || ppn) { i = 0; Time.timeScale = 0; Player1.GetComponent <PlayerControl>().enabled = false; Player2.GetComponent <PlayerControl>().enabled = false; GameOver.SetActive(true); TimerO.SetActive(false); if (pp1Lose) { if (Player2.name == "FedorP2(Clone)") { Fedor.SetActive(true); Natalya.SetActive(false); Marcus.SetActive(false); FedorSkin.SetActive(false); NatalyaSkin.SetActive(false); MarcusSkin.SetActive(false); ppn = pp1Lose = pp2Lose = false; } else if (Player2.name == "NataliaP2(Clone)") { Fedor.SetActive(false); Natalya.SetActive(true); Marcus.SetActive(false); FedorSkin.SetActive(false); NatalyaSkin.SetActive(false); MarcusSkin.SetActive(false); ppn = pp1Lose = pp2Lose = false; } else if (Player2.name == "MarcusP2(Clone)") { Fedor.SetActive(false); Natalya.SetActive(false); Marcus.SetActive(true); ppn = pp1Lose = pp2Lose = false; FedorSkin.SetActive(false); NatalyaSkin.SetActive(false); MarcusSkin.SetActive(false); } else if (Player2.name == "FedorP2skin(Clone)") { Fedor.SetActive(false); Natalya.SetActive(false); Marcus.SetActive(false); ppn = pp1Lose = pp2Lose = false; FedorSkin.SetActive(true); NatalyaSkin.SetActive(false); MarcusSkin.SetActive(false); } else if (Player2.name == "NataliaP2skin(Clone)") { Fedor.SetActive(false); Natalya.SetActive(false); Marcus.SetActive(false); ppn = pp1Lose = pp2Lose = false; FedorSkin.SetActive(false); NatalyaSkin.SetActive(true); MarcusSkin.SetActive(false); } else if (Player2.name == "MarcusP2skin(Clone)") { Fedor.SetActive(false); Natalya.SetActive(false); Marcus.SetActive(false); ppn = pp1Lose = pp2Lose = false; FedorSkin.SetActive(false); NatalyaSkin.SetActive(false); MarcusSkin.SetActive(true); } winner.SetActive(true); doubleKO.SetActive(false); } else if (pp2Lose) { Debug.Log(Player1.name); if (Player1.name == "FedorP1(Clone)") { Fedor.SetActive(true); Natalya.SetActive(false); Marcus.SetActive(false); ppn = pp1Lose = pp2Lose = false; FedorSkin.SetActive(false); NatalyaSkin.SetActive(false); MarcusSkin.SetActive(false); } else if (Player1.name == "NataliaP1(Clone)") { Fedor.SetActive(false); Natalya.SetActive(true); Marcus.SetActive(false); ppn = pp1Lose = pp2Lose = false; FedorSkin.SetActive(false); NatalyaSkin.SetActive(false); MarcusSkin.SetActive(false); } else if (Player1.name == "MarcusP1(Clone)") { Fedor.SetActive(false); Natalya.SetActive(false); Marcus.SetActive(true); ppn = pp1Lose = pp2Lose = false; FedorSkin.SetActive(false); NatalyaSkin.SetActive(false); MarcusSkin.SetActive(false); } else if (Player1.name == "FedorP1skin(Clone)") { Fedor.SetActive(false); Natalya.SetActive(false); Marcus.SetActive(false); ppn = pp1Lose = pp2Lose = false; FedorSkin.SetActive(true); NatalyaSkin.SetActive(false); MarcusSkin.SetActive(false); } else if (Player1.name == "NataliaP1skin(Clone)") { Fedor.SetActive(false); Natalya.SetActive(false); Marcus.SetActive(false); ppn = pp1Lose = pp2Lose = false; FedorSkin.SetActive(false); NatalyaSkin.SetActive(true); MarcusSkin.SetActive(false); } else if (Player1.name == "MarcusP1skin(Clone)") { Fedor.SetActive(false); Natalya.SetActive(false); Marcus.SetActive(false); ppn = pp1Lose = pp2Lose = false; FedorSkin.SetActive(false); NatalyaSkin.SetActive(false); MarcusSkin.SetActive(true); } winner.SetActive(true); doubleKO.SetActive(false); } else if (ppn) { Fedor.SetActive(false); Natalya.SetActive(false); Marcus.SetActive(false); FedorSkin.SetActive(false); NatalyaSkin.SetActive(false); MarcusSkin.SetActive(false); ppn = pp1Lose = pp2Lose = false; } GameObject.FindGameObjectWithTag("AudioManager").GetComponent <AudioSource>().mute = true; } else { Time.timeScale = 1; Player1.GetComponent <PlayerControl>().enabled = true; Player2.GetComponent <PlayerControl>().enabled = true; } if (GameOver.activeInHierarchy) { HUD1.SetActive(false); HUD2.SetActive(false); triangle.SetActive(false); counter.SetActive(false); Player1.GetComponent <PlayerControl>().enabled = false; Player2.GetComponent <PlayerControl>().enabled = false; } }
void Awake() { Instance = this; m_allEntities = new List<Entity>(); m_activeEnemies = new List<Enemy>(); m_activeNPCs = new List<NPC>(); m_player = null; m_spawners = new List<EnemySpawner>(FindObjectsOfType<EnemySpawner>()); m_gameOver = GameOverType.None; m_gameOverScreen = FindObjectOfType<GameOver>(); if (m_gameOverScreen != null) { m_gameOverScreen.gameObject.SetActive(false); } m_killedCreatureCount = m_killedNPCCount = 0; m_spawnedCreatures = m_spawnedNPCCount = 0; m_elapsed = 0.0f; m_boundaries = new Rect(); Camera cam = Camera.main; float camHHeight = cam.orthographicSize; float camHWidth = camHHeight * cam.aspect; cam.transform.position.Set(0,0,cam.transform.position.z); m_boundaries.x = -camHWidth; m_boundaries.width = camHWidth * 2; m_boundaries.y = 2 * camHHeight; m_boundaries.height = camHHeight * 4; // At the moment there are two areas on top of each other }
public override void LoadContent() { //Finish HIM! base.LoadContent(); Background = TheLastSliceGame.Instance.Content.Load <Texture2D>("UI/GameOverScreen"); GameOver = TheLastSliceGame.Instance.Content.Load <SpriteFont>("Fonts/Joystix_40"); MenuTexture = TheLastSliceGame.Instance.Content.Load <Texture2D>("UI/game-over"); Bubble = TheLastSliceGame.Instance.Content.Load <Texture2D>("UI/Bubble"); ArrowLeftAnim = new Animation(TheLastSliceGame.Instance.Content.Load <Texture2D>("UI/arrow-left"), 6); ArrowRightAnim = new Animation(TheLastSliceGame.Instance.Content.Load <Texture2D>("UI/arrow-right"), 6); GameOverText = "Game Over"; NoTipForYouText = "No Tip For You."; ArrowPadding = 50; ArrrowYOffset = 45; BubbleYCenterOffset = 20; BubbleLineOffset = 10; BubbleOffsetX = 90; BubbleOffsetY = 30; GameOverY = 230; NoTipForYouY = 290; ArrowLeft = new UIEntity(Vector2.Zero, ArrowLeftAnim); ArrowRight = new UIEntity(Vector2.Zero, ArrowRightAnim); Menu = new UIEntity(Vector2.Zero, MenuTexture); //line everything up MenuX = TheLastSliceGame.Instance.GameWidth / 2 - MenuTexture.Width / 2; MenuY = 475; Menu0Width = 300; Menu1Width = 134; MenuXCenter = TheLastSliceGame.Instance.GameWidth / 2; GameOverTextSize = GameOver.MeasureString(GameOverText); NoTipForYouTextSize = Text.MeasureString(NoTipForYouText); GameOverX = (int)(MenuXCenter - GameOverTextSize.X / 2); NoTipForYouX = (int)(MenuXCenter - NoTipForYouTextSize.X / 2); BubbleX = GameOverX - BubbleOffsetX; BubbleY = GameOverY - Bubble.Height + BubbleOffsetY; BubbleXCenter = BubbleX + (Bubble.Width / 2); BubbleYCenter = BubbleY - BubbleYCenterOffset + (Bubble.Height / 2); Frog = new Ingredient(new Vector2(700, 375), "UIFRL"); Frog.LoadTexture(); ArrowLeftX0 = MenuXCenter - Menu0Width / 2 - ArrowPadding; ArrowLeftX1 = MenuXCenter - Menu1Width / 2 - ArrowPadding; ArrowRightX0 = MenuXCenter + (Menu0Width / 2) + ArrowPadding - ArrowRight.Width; ArrowRightX1 = MenuXCenter + (Menu1Width / 2) + ArrowPadding - ArrowRight.Width; ArrowY0 = MenuY + 16 - ArrowLeft.HalfHeight; ArrowY1 = ArrowY0 + ArrrowYOffset; MenuIndex = 0; ArrowLeft.Position = new Vector2(ArrowLeftX0, ArrowY0); ArrowRight.Position = new Vector2(ArrowRightX0, ArrowY0); Menu.Position = new Vector2(MenuX, MenuY); Score = 0; }
protected override void OnUpdate() { Entities.ForEach((Entity entity, ref GUIComponent guiComp) => { if (guiComp.id == uiState) { return; } var guiPreset = EntityManager.GetSharedComponentData <GUIPresetComponent>(Utility.SystemEntity); guiPreset.preset.GUIUpdate(guiComp.id); switch (guiComp.id) { case IdUtility.GUIId.Title: GameStart.Stop(); if (false == EntityManager.HasComponent <FadeInComponent>(Utility.SystemEntity)) { EntityManager.AddComponentData(Utility.SystemEntity, new FadeInComponent() { time = 0.0f }); } EntityManager.AddComponentData(EntityManager.CreateEntity(), new SubSceneLoadComponent { id = IdUtility.GUIId.Title, delay = 0.0f }); break; case IdUtility.GUIId.InGame: GameStart.Play(); GameOver.Play(); if (false == EntityManager.HasComponent <FadeOutComponent>(Utility.SystemEntity)) { EntityManager.AddComponentData(Utility.SystemEntity, new FadeOutComponent() { time = 0.5f }); } EntityManager.AddComponentData(EntityManager.CreateEntity(), new SubSceneUnLoadComponent { id = IdUtility.GUIId.Title, delay = 0.0f }); EntityManager.AddComponentData(EntityManager.CreateEntity(), new SubSceneUnLoadComponent { id = IdUtility.GUIId.Result, delay = 0.0f }); EntityManager.AddComponentData(EntityManager.CreateEntity(), new SubSceneLoadComponent { id = IdUtility.GUIId.InGame, delay = 0.0f }); break; case IdUtility.GUIId.Over: GameStart.Stop(); if (false == EntityManager.HasComponent <FadeInComponent>(Utility.SystemEntity)) { EntityManager.AddComponentData(Utility.SystemEntity, new FadeInComponent() { time = 2.0f }); } EntityManager.AddComponentData(EntityManager.CreateEntity(), new SubSceneUnLoadComponent { id = IdUtility.GUIId.InGame, delay = 2.0f }); EntityManager.AddComponentData(EntityManager.CreateEntity(), new SubSceneLoadComponent { id = IdUtility.GUIId.Result, delay = 1.0f }); break; case IdUtility.GUIId.Result: break; } uiState = guiComp.id; EntityManager.RemoveComponent <GUIComponent>(entity); }); }
private void StartGameLoop() { bool needToRender = true; do { while (Console.KeyAvailable) { ConsoleKeyInfo pressedChar = Console.ReadKey(true); int hashCode = pressedChar.Key.GetHashCode(); switch (pressedChar.Key) { case ConsoleKey.Escape: if (!stopGame) { needToRender = false; } break; case ConsoleKey.RightArrow: if (!stopGame) { myGame.MoveHeroRight(); } else { gameOver?.SelectMenu(true); } break; case ConsoleKey.LeftArrow: if (!stopGame) { myGame.MoveHeroLeft(); } else { gameOver?.SelectMenu(false); } break; case ConsoleKey.Enter: if (stopGame) { switch (gameOver?.GetMenuLabel()) { case "Restart": Console.Clear(); StartGame(); break; case "Menu": needToRender = false; break; default: break; } } break; case ConsoleKey.Spacebar: int id = _bulletsCounter++; myGame.AddBullet(new Bullet(id, myGame.GetHeroX(), myGame.Height - 3, "Bullet" + id, BULLET_MARKER)); break; } } if (!stopGame) { int killBulletEnemysTime = myGame.CheckEnemyPositionWithBullet(); if (killBulletEnemysTime > 0) { myScore.SetScore(killBulletEnemysTime * 100); int enemyGenerate = rnd.Next(1, MAX_RANDOM_APPEND_ENEMY); for (int i = 0; i < enemyGenerate; i++) { myGame.AddEnemy(new Enemy(_enemysCounter, rnd.Next(1, myGame.ScreenWidth - 2), rnd.Next(1, 5), "enemy" + _enemysCounter, ENEMY_MARKER, GenerateSpeed(0.01, 0.02))); _enemysCounter++; } } if (myGame.CheckEnemyWithHeroPosition() > -1) { stopGame = true; gameOver = new GameOver(28, 10, 60, 10, '#', myScore.Score, "Jus nuzude enemy."); gameOver.Render(); continue; } int killWorldEnemy = myGame.CheckEnemyWorldPosition(); if (killWorldEnemy > 0) { if (worldLive.GetLive(killWorldEnemy) <= 0) { stopGame = true; gameOver = new GameOver(28, 10, 60, 10, '#', myScore.Score, "Miestas sugriautas"); gameOver.Render(); continue; } } myGame.MoveAllEnemiesDown(); myGame.MoveAllBulletsUp(); myGame.Render(); } System.Threading.Thread.Sleep(20); } while (needToRender); }
private static void EndGame() { GameOver.GameOverinRed(); }
public void OnCreation() { Debug.Log("MenuViewModel:Start"); GameStart.AddListener(OnGameStart); GameOver.AddListener(OnGameOver); }
public Statistics() { instance = this; gameOver = new GameOver(); }
// Start is called before the first frame update void Start() { gameOverScript = GameObject.Find("Main Camera").GetComponent <GameOver>(); }
public void OnGameOver() { GameOver?.Invoke(); }
void End() { IsStarted = false; GameOver?.Invoke(); }
protected override void OnGameOver() { GameOver?.Invoke(this); }
private void FinirPartie() { tmrDrop.Stop(); GameOver.Invoke(this, EventArgs.Empty); AfficherAuCentre("FIN PARTIE"); }
//GameOver einleiten private void EndGame(string Grund) { Chat.chatbox.AppendText(DateTime.Now.ToShortTimeString() + ": Jim: Sorry Chef, ich konnt' nichts mehr machen...\n"); ersatzpumpe_fehlertimer.Enabled = false; ersatzpumpe_randomizer.Enabled = false; ersatzpumpe_statustimer.Enabled = false; rep_ersatzpumpe.Enabled = false; pumpe1_fehlertimer.Enabled = false; pumpe1_randomizer.Enabled = false; pumpe1_statustimer.Enabled = false; rep_pumpe1.Enabled = false; pumpe2_fehlertimer.Enabled = false; pumpe2_randomizer.Enabled = false; pumpe2_statustimer.Enabled = false; rep_pumpe2.Enabled = false; temprandomizer.Enabled = false; leistungsrandomizer.Enabled = false; halbsekundengeber.Enabled = false; fehlerfarbe_timer.Enabled = false; ein_sekundengeber.Enabled = false; finanzen.refreshzeitgeber.Enabled = false; ein_sekundengeber.Enabled = false; Statics.Temperatur = 0; GameOver gameover = new GameOver(); gameover.reason_label.Text = Grund; gameover.ShowDialog(); if (gameover.DialogResult == DialogResult.Retry) { if (connectionAvailable) //Wenn eine Verbindung zum Server besteht -> Highscore anzeigen und eintragen lassen { highscore.guthaben_label.Text = ((int)(Statics.Guthaben)).ToString() + "$"; highscore.erwirtschaftetes_guthaben_panel.Visible = true; highscore.HighscoreEintragen_panel.Visible = true; highscore.ShowDialog(); } Application.Restart(); this.Close(); } else { if (connectionAvailable) { highscore.guthaben_label.Text = ((int)(Statics.Guthaben)).ToString() + "$"; highscore.erwirtschaftetes_guthaben_panel.Visible = true; highscore.HighscoreEintragen_panel.Visible = true; highscore.ShowDialog(); } Application.Exit(); this.Close(); } }
private void GameOverMessage(string msg) { GameOver?.Invoke(msg); }
public void Die() { GameOver?.Invoke(); }
private void Awake() { instance = this; }
private void OnGameOver(GameOverEventArgs e) { GameOver?.Invoke(this, e); }
// Update is called once per frame void Awake() { gameover = gameOver.GetComponent <GameOver>(); }
public void Die() { _animator.SetTrigger("Dead"); GameOver?.Invoke(); }
public void InvokeGameOver(bool isWin) { AudioManager.Instance.Play(isWin ? "Win" : "Lose"); GameOver?.Invoke(isWin); }
public GameOverEventArgs(GameOver gameOver) { this.GameOver = gameOver; }
// Initialization. void Awake() { Debug.Log("Initialisation"); startTime = Time.realtimeSinceStartup; Debug.Log("Awake Time ---> " + startTime); GameObject.Find("Main Camera").AddComponent<AudioListener>(); GameObject cam = GameObject.Find("Main Camera"); if (cam.GetComponent<AudioListener>() == null) cam.AddComponent<AudioListener>(); //boardArray keeps track of which positions on the board is occupied. boardArray = new bool[nx,ny,nz]; Array.Clear(boardArray, 0, boardArray.Length); blockCtrl = GetComponent<BlockControl>(); blockCtrl.enterPressed = false; //pinsPerShape = blockCtrl.getShapeSize(); blocksLayer = new GameObject [ny]; blocksInLayer = new int[ny]; Array.Clear(blocksInLayer, 0, blocksInLayer.Length); //creating the bounding walls in the array for(int i=0; i< ny;i++){ for(int j=0;j < nx;j++){ boardArray[j,i,0] = true; boardArray[j,i,nz-1] = true; boardArray[0,i,j] = true; boardArray[nx-1,i,j] = true; //print (boardArray[j,i,0]); } } for (int i=0; i<ny; i++){ blocksLayer[i] = new GameObject(); String layerName = "Layer" + i; blocksLayer[i].name = layerName; addToScene(blocksLayer[i]); } //initialise textures for the GUI. initTextures(); //Creates an array to store the 4 images of the lego pieces. //Number of pieces that are suggested and number of total pieces // are currently hard-coded. lego = new Texture2D[4]; lego[0] = Resources.Load("L2x1lit") as Texture2D; lego[1] = Resources.Load("L2x2lit") as Texture2D; lego[2] = Resources.Load("L3x2lit") as Texture2D; lego[3] = Resources.Load("L4x2lit") as Texture2D; legoSuggestions = new int[3]; //shadow layer GameObject slayer = new GameObject(); String lName = "ShadowLayer"; slayer.name = lName; addToScene(slayer); flashPass = 0; grid = Resources.LoadAssetAtPath("Assets/Resources/grid_square.prefab", typeof(GameObject)); DrawBoard(); createTopCamera(); //first = true; audio_source = GameObject.Find("Main Camera").GetComponent<AudioSource>(); wrong_piece_sound = GameObject.Find("Main Camera").AddComponent<AudioSource>(); wrong_piece_sound.clip = (AudioClip) Resources.LoadAssetAtPath("Assets/Music/error.wav", typeof(AudioClip)); // Only uncomment if you want to *change* the music // startMusic("Theme1"); //start gameplay gOver = GetComponent<GameOver>(); lboard = GetComponent<Leaderboard>(); blockCtrl.assignTimeGap(timeGap); }
void Start() { win = FindObjectOfType <Win>(); gameOver = FindObjectOfType <GameOver>(); slomoController = FindObjectOfType <SlomoController>(); }
void Start() { ps = GetComponent <ParticleSystem>(); scoreLogic = GameObject.FindGameObjectWithTag("GameController").GetComponent <ScoreLogic> (); gameOver = GameObject.FindObjectOfType <GameOver> (); }
void Start() { onWaterComeToTree += onWaterComeToTreeListener; onGameOver+=onGameOverListener; }