// Update is called once per frame void Update() { NewPoint(); if (Score > 0) { Time.timeScale = 1f; TimeLeft -= Time.deltaTime; float Display = Mathf.Round(TimeLeft); //TimeLeft = (float)Math.Round(TimeLeft, 2); Timer.GetComponent <TextMeshProUGUI>().text = Display.ToString(); } if (TimeLeft <= 0.0f) { Time.timeScale = 0f; GameDisplay.SetActive(false); ScoreDisplay.SetActive(true); ScoreObject.GetComponent <TextMeshProUGUI>().text = "Score: " + Score; if (!adShown) { Advertisement.Show(); adShown = true; } } }
//private void RecognizedSpeech(PhraseRecognizedEventArgs speech) //{ // Debug.Log(speech.text); // actions[speech.text].Invoke(); //} //private void Forward() //{ // //transform.Translate(1, 0, 0); // act = 1; //} //private void Left() //{ // //transform.Translate(1, 0, 0); // act = 2; //} //private void Right() //{ // act = 3; // //transform.Translate(1, 0, 0); //} //private void Back() //{ // act = 4; // //transform.Translate(1, 0, 0); //} //private void JumpAct() //{ // act = 5; // //transform.Translate(1, 0, 0); //} void Start() { //act = 0; //actions.Add("forward", Forward); //actions.Add("left", Left); //actions.Add("right", Right); //actions.Add("back", Back); //actions.Add("jump", JumpAct); //keywordRecognizer = new KeywordRecognizer(actions.Keys.ToArray()); //keywordRecognizer.OnPhraseRecognized += RecognizedSpeech; gameDisplayClass = GameObject.Find("GameManager").GetComponent <GameDisplay>(); tran = gameObject.GetComponent <Transform>(); playerAnimator = gameObject.GetComponent <Animator>(); m_rb = gameObject.GetComponent <Rigidbody>(); controller = GetComponent <CharacterController>(); currentState = 0; playerWeapon = GameObject.Find("Player/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Neck/Bip001 R Clavicle/Bip001 R UpperArm/Bip001 R Forearm/Bip001 R Hand/Weapon"); playerWeapon.SetActive(false); numWeaponNPCHave = 0; maxWeaponNum = 1; cam = GameObject.Find("Player/MainCamera").GetComponent <Camera>(); healthBar = Instantiate(healthBar, GameObject.Find("Canvas").transform); healthBar.transform.localScale *= 2; StartCoroutine("CheckInSafeZone"); }
internal static GameDisplay CreateGameDisplay(MatchDetail match) { GameDisplay gameDisplay = new GameDisplay() { SecondsElapsed = Convert.ToInt32(DateTime.Now.Subtract(LastChosen).TotalSeconds) * 1000, MatchInterval = Convert.ToInt32(ConfigurationManager.AppSettings["NewMatchInterval"]), BlueTeam = new List <ParticipantDisplay>(), PurpleTeam = new List <ParticipantDisplay>(), BetType = ChosenQuestion.BetType, BetQuestion = ChosenQuestion.BetQuestion }; foreach (Participant participant in ChosenMatch.Participants.Where(p => p.TeamId == 100)) { gameDisplay.BlueTeam.Add( new ParticipantDisplay() { ParticipantId = participant.ParticipantId, ChampionImage = champs.Data.Values.FirstOrDefault(c => c.Id == participant.ChampionId).Image.Full }); } foreach (Participant participant in ChosenMatch.Participants.Where(p => p.TeamId == 200)) { gameDisplay.PurpleTeam.Add( new ParticipantDisplay() { ParticipantId = participant.ParticipantId, ChampionImage = champs.Data.Values.FirstOrDefault(c => c.Id == participant.ChampionId).Image.Full }); } return(gameDisplay); }
// Use this for initialization void Awake() { TimeLeft = ShimmerTime; changeState(STATE_EMERGE_IDLE); animator = this.GetComponent <Animator>(); gamedisplay = GameObject.FindGameObjectWithTag("Game Display").GetComponent <GameDisplay>(); GUC = GameObject.Find("Canvas/Game UI").GetComponent <GameUIControl>(); }
private void DisplayTitle() { if (IsPlayerTeam) { GameDisplay.WriteRow(TeamBuilderConsts.PlayerTitle, TeamBuilderConsts.TitleRow); } else { GameDisplay.WriteRow(TeamBuilderConsts.ComputerTitle, TeamBuilderConsts.TitleRow); } }
public InterfaceManager(int width, int height, GameDisplay display, Engine engine) { State = MenueState.None; Width = width; Height = height; Bounds = new Rectangle(0, 0, this.Width, this.Height); Menus = new IControl[3]; this.display = display; escapeReset = true; }
public AbstractCharacter CharacterBuilderHome() { Console.Clear(); do { GameDisplay.WriteRow(CharacterBuilderConsts.Title, CharacterBuilderConsts.TitleRow); DisplayCharacterStatistics(); DisplayUserText(); AskUserForKey(); } while (IsBuilding); return(Builder.GetCharacter()); }
private void DisplayHomeText() { GameDisplay.ClearAndDisplayRow(TeamBuilderConsts.QuestionString, TeamBuilderConsts.DialogRow); if (Builder.GetTeam().IsFull()) { GameDisplay.ClearAndDisplayRow(TeamBuilderConsts.EditCharacterString, TeamBuilderConsts.SecondDialogRow); } else { GameDisplay.ClearAndDisplayRow(TeamBuilderConsts.OptionsString, TeamBuilderConsts.SecondDialogRow); } }
public void UpdateMap(List <MapItem> Map) { if (Map != null) { foreach (var obj in Map) { var test = GameDisplay.GetControlFromPosition(obj.CordY, obj.CordX); GameDisplay.Controls.Remove(test); GameDisplay.Controls.Add(AddPic(obj), obj.CordY, obj.CordX); } } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { GameDisplay = new GameDisplay(); MainMenuDisplay = new MainMenuDisplay(); LoadingScreenDisplay = new LoadingScreenDisplay(); CharacterSelectionDisplay = new CharacterSelectionDisplay(); Tutorial = new Tutorial(); Leaderboard = new Leaderboards(); this.Window.Title = "Volniir"; base.Initialize(); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { #if DEBUG base.Window.Title = GAME_NAME + "...FPS: " + FrameRate.getInstance().calculateFrameRate(gameTime) + " X:" + InputManager.getInstance().MouseX + " Y:" + InputManager.getInstance().MouseY; if (InputManager.getInstance().wasKeyPressed(Keys.R)) { SoundManager.getInstance().removeAllEmitters(); this.gameDisplay = new GameDisplay(GraphicsDevice, Content); } if (InputManager.getInstance().wasKeyPressed(Keys.Escape) || InputManager.getInstance().wasButtonPressed(PlayerIndex.One, Buttons.B)) { //SpawnGenerator.getInstance().Running = false; //this.Exit(); } #endif // start the transitions handleNewTransition(); if (StateManager.getInstance().CurrentGameState == GameState.Exit) { SpawnGenerator.getInstance().Running = false; this.Exit(); } base.IsMouseVisible = false; if (StateManager.getInstance().CurrentGameState == GameState.Options) { if (!InputManager.getInstance().isLeftButtonDown()) { base.IsMouseVisible = true; } } float elapsed = gameTime.ElapsedGameTime.Milliseconds; handleTransitionState(elapsed); SoundManager.getInstance().update(); this.activeDisplay.update(elapsed); this.transitionItem.update(elapsed); base.Update(gameTime); }
public void StartGame() { Board.Initialize(); GameDisplay.DisplayBoard(Board); int i = 0; while (!Validator.CheckMate(Board, i)) { Players[i].PerformMove(Board, GameDisplay); GameDisplay.DisplayBoard(Board); Clock.Reset(); Clock.Start(); i = i ^ 1; } Clock.Stop(); GameDisplay.DisplayMessage("H-eck mate!"); GameDisplay.DisplayBoard(Board); GameDisplay.EndGame(); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { SoundManager.getInstance().init(Content); IOHelper.loadConfiguration(IOHelper.getConfiguration()); this.cinematic = new Cinematic(Content); this.mainMenu = new MainMenu(Content); this.optionsMenu = new OptionsMenu(Content); this.fadeParams = new FadeEffectParams { OriginalColour = Color.Black, State = FadeEffect.FadeState.Out, TotalTransitionTime = TRANSITION_TIME }; this.fadeEffect = new FadeEffect(fadeParams); StaticDrawable2DParams transitionParms = new StaticDrawable2DParams { Texture = LoadingUtils.load <Texture2D>(Content, "Chip"), Scale = new Vector2(Constants.RESOLUTION_X, Constants.RESOLUTION_Y), LightColour = Color.Black }; this.transitionItem = new StaticDrawable2D(transitionParms); this.transitionItem.addEffect(this.fadeEffect); #if WINDOWS #if DEBUG ScriptManager.getInstance().LogFile = "Log.log"; if (StateManager.getInstance().CurrentGameState == GameState.Active || StateManager.getInstance().CurrentGameState == GameState.Waiting || StateManager.getInstance().CurrentGameState == GameState.GameOver) { this.gameDisplay = new GameDisplay(GraphicsDevice, Content); } #endif #endif }
public GameLoop() { window = WindowBuilder.CreateWindow(DisplayConsts.GameTitle, DisplayConsts.WindowWidth, DisplayConsts.WindowHeight); var mapTilemapConfiguration = new TilemapConfiguration(DisplayConsts.MainFontHeight, DisplayConsts.MainFontWidth, DisplayConsts.FontRows, DisplayConsts.FontColumns); var textTilemapConfiguration = new TilemapConfiguration(DisplayConsts.MainFontHeight, DisplayConsts.TextFontWidth, DisplayConsts.FontRows, DisplayConsts.FontColumns); mainDisplay = new GameDisplay(DisplayConsts.MainDisplaySize, DisplayConsts.MainDisplayOffset, mapTilemapConfiguration); borderDisplay = new GameDisplay(DisplayConsts.BorderDisplaySize, DisplayConsts.BorderDisplayOffset, mapTilemapConfiguration); hudDisplay = new GameDisplay(DisplayConsts.HudDisplaySize, DisplayConsts.HudDisplayOffset, textTilemapConfiguration); messageDisplay = new GameDisplay(DisplayConsts.MessageDisplaySize, DisplayConsts.MessageDisplayOffset, textTilemapConfiguration); for (var i = 0; i < DisplayConsts.MainDisplayHeightInTiles; i++) { borderDisplay.Draw(CP437Glyph.DoubleVerticalLine, (0, i), RogueColor.GreenYellow); } messageDisplay.Draw($"Hello to {DisplayConsts.GameTitle}", (1, 1)); gameState = new GameState(); inputHandler = new InputHandler(gameState); window.KeyPressed += inputHandler.Window_KeyPressed; window.MouseButtonPressed += Window_MouseButtonPressed; }
private void ClearChoiceAndResetCursor() { GameDisplay.ClearRow(CharacterBuilderConsts.SecongDialogRow); Console.SetCursorPosition(3, CharacterBuilderConsts.SecongDialogRow); }
private void DisplayCharacterHealth() { string health = GetHealthString(); GameDisplay.ClearAndDisplayRow(health, CharacterBuilderConsts.HealthRow); }
//Mono Funcitons private void Start() { display = GetComponentInChildren <GameDisplay>(); gameScreenManager = GameObject.FindObjectOfType <GameScreenManager>(); }
public void GameDisplayTest() { GameDisplay testGameDisplay = new GameDisplay(); }
private void Start() { gm = GetComponent <GridManager>(); // Setup level characteristics for GridManager if (currentLevel == 0) { currentLevel = 1; } if (overrideLevelData) { LevelData newLevelData = new LevelData(inspectorGridWidth, inspectorGridHeight, 4, 0); gm.ReceiveLevelData(newLevelData.LevelTable[0]); } else { gm.ReceiveLevelData(levelData.LevelTable[LevelDataIndex]); } gm.Init(); // Setup GridObjectManager gom = GetComponent <GridObjectManager>(); if (overrideSpawnSequence.Length > 0) { for (int i = 0; i < overrideSpawnSequence.Length; i++) { gom.insertSpawnSequences.Add(overrideSpawnSequence[i].Clone()); } } if (VerboseConsole) { debugHUD = GameObject.FindGameObjectWithTag("Debug HUD").GetComponent <DebugHUD>(); } display = GameObject.FindGameObjectWithTag("Game Display").GetComponent <GameDisplay>(); // Setup Player Vector2Int startLocation = new Vector2Int(0, 0); if (overrideSpawnSequence.Length > 0) { startLocation = overrideSpawnSequence[0].playerSpawnLocation; } GameObject player = Instantiate(gom.playerPrefab, gm.GridToWorld(startLocation), Quaternion.identity); if (VerboseConsole) { Debug.Log(player.name + " has been instantiated."); } if (VerboseConsole) { Debug.Log("Adding Player to Grid."); } gm.AddObjectToGrid(player, startLocation); this.player = player.GetComponent <Player>(); this.player.currentWorldLocation = gm.GridToWorld(startLocation); this.player.targetWorldLocation = gm.GridToWorld(startLocation); if (VerboseConsole) { Debug.Log("Player successfully added to Grid."); } this.player.NextLevel(levelData.LevelTable[LevelDataIndex].jumpFuelAmount); // Initialize Game Object Manager now that player exists gom.Init(); this.player.OnPlayerAdvance += OnTick; }
private void DisplayAbortText() { GameDisplay.ClearAndDisplayRow(TeamBuilderConsts.NotFinisedString, TeamBuilderConsts.DialogRow); GameDisplay.ClearAndDisplayRow(CharacterBuilderConsts.YesNoString, TeamBuilderConsts.SecondDialogRow); }
private void DisplayPlaceQuestion() { GameDisplay.ClearAndDisplayRow(TeamBuilderConsts.PlaceSelectText, TeamBuilderConsts.DialogRow); GameDisplay.ClearAndDisplayRow(TeamBuilderConsts.AvailablePlaces, TeamBuilderConsts.SecondDialogRow); }
public ConsoleGameController(Map map) { //създаваме модела game със тази карта game = new Game(map); //създаваме display с този модел game display = new GameDisplay(game); // коя карта е заредена display.MapLoaded(game.Map); game.Map.Validate(); try { // избор на герой game.MyHero = display.SelectHero(); // играта започва game.Started(); //повтаряме докато не приключи играта: while (!game.IsCompleted() && !game.IsOver()) { game.LoadLevel(); // съобщаваме в кое ниво сме влезли и кой го населява, колко опит ни е нужен за преминаване и т.н. display.ShowLevel(game.CurrentLevel); //повтаряме докато състоянието на играта е Playing while (game.State == GameState.Playing) { //преминаваме на следващ ход, ако можем(т.е.ако не сме убити, ако не сме завършили и т.н.), иначе прекъсва цикъла if (!game.NextMove()) { break; } // оповестяваме на кой ход от играта сме display.ShowMove(game.MoveNo); // проверяваме CanSelectMove - дали ходът е Съдба или Избор var canSelect = game.CanSelectMove; // извежда дали сме ход Съдба или ход Избор display.ShowMove(game.CanSelectMove); // ако сме на ход избор: if (canSelect) { // избираме с кой искаме да се срещнем и записваме кой е нашия Opponent game.Opponent = display.SelectOpponent(); } // ход съдба се избира нашия опонент if (!game.OpponentSelection() && canSelect == false) { continue; // ако не е успяло да ни избере противник } // показва ни характеристиките на който ни е избран за противник display.ShowOpponent(game.Opponent); // избираме какво действие ще извърши нашия герой HeroActionType action = display.SelectHeroAction(game.Opponent); // съобщаваме какво действие ще се извърши, срещу кого и т.н. display.ShowHeroAction(game.MyHero, action, game.Opponent); // изиграваме хода и определяме какъв е резултата bool success = game.Play(action); // премахваме вече победен злодей или добряк, с който сме направили сделка if (success) { if (game.Opponent is Enemy && action is HeroActionType.Fight) { game.CurrentLevel.Enemies.Remove(game.Opponent as Enemy); } else if (game.Opponent is Helper && action is HeroActionType.Deal) { game.CurrentLevel.Helpers.Remove(game.Opponent as Helper); } } // съобщаваме резултата от играта display.ShowHeroActionResult(action, game.Opponent, success); // съобщава новите характеристики на героя display.ShowHero(game.MyHero); } //ако състоянието е LevelCompleted: if (game.State == GameState.LevelCompleted) { // съобщаваме, че е преминато нивото display.LevelFinished(game.CurrentLevel); // преминаваме на следващо ниво game.NextLevel(); } //ако game.State e GameOver else if (game.State == GameState.GameOver) { //display: играта завърши със загуба display.GameOver(); break; } //ако game.State e GameCompleted else if (game.State == GameState.GameCompleted) { //display: играта завърши с победа display.GameCompleted(); } } } catch (GameStoppedException) { // display: играта е прекъсната game.State = GameState.GameStopped; display.GameStopped(); } }
private void DisplayCharacterAgility() { string agility = GetAgilityString(); GameDisplay.ClearAndDisplayRow(agility, CharacterBuilderConsts.AgilityRow); }
private void DisplayCharacterWeapon() { string power = GetWeaponString(); GameDisplay.ClearAndDisplayRow(power, CharacterBuilderConsts.WeaponRow); }
private void handleNewTransition() { if (StateManager.getInstance().CurrentTransitionState == TransitionState.InitTransitionIn) { this.fadeEffect.State = FadeEffect.FadeState.Out; this.fadeEffect.reset(); StateManager.getInstance().CurrentTransitionState = TransitionState.TransitionIn; this.elapsedTransitionTime = 0f; } else if (StateManager.getInstance().CurrentTransitionState == TransitionState.InitTransitionOut) { this.fadeEffect.State = FadeEffect.FadeState.In; // did we interrupt the previous transition if (StateManager.getInstance().PreviousTransitionState == TransitionState.TransitionIn) { this.fadeEffect.reset(); this.elapsedTransitionTime = 0f; } else { // we need to reverse the fade from its current position since we interrupted the previous transition this.fadeEffect.interruptFade(); this.elapsedTransitionTime = this.fadeEffect.ElapsedTransitionTime; } StateManager.getInstance().CurrentTransitionState = TransitionState.TransitionOut; } if (StateManager.getInstance().CurrentTransitionState == TransitionState.TransitionIn && this.elapsedTransitionTime == 0f) { // we just finished transitioning so we need to create our new Displays if (StateManager.getInstance().CurrentGameState == GameState.LoadGame) { SoundManager.getInstance().removeAllEmitters(); this.gameDisplay = new GameDisplay(GraphicsDevice, Content); StateManager.getInstance().CurrentGameState = GameState.Waiting; } else if (StateManager.getInstance().CurrentGameState == GameState.LoadOptions) { this.optionsMenu = new OptionsMenu(Content); StateManager.getInstance().CurrentGameState = GameState.Options; } // we need to change our display if (StateManager.getInstance().CurrentGameState == GameState.CompanyCinematic) { this.activeDisplay = this.cinematic; } else if (StateManager.getInstance().CurrentGameState == GameState.MainMenu) { this.activeDisplay = this.mainMenu; } else if (StateManager.getInstance().CurrentGameState == GameState.Waiting || StateManager.getInstance().CurrentGameState == GameState.Active || StateManager.getInstance().CurrentGameState == GameState.GameOver) { this.activeDisplay = this.gameDisplay; } else if (StateManager.getInstance().CurrentGameState == GameState.Options) { this.activeDisplay = this.optionsMenu; } } }
private void DisplayUserInfo(string message) { GameDisplay.ClearAndDisplayRow(message, CharacterBuilderConsts.SecongDialogRow); }
private void DisplayTeamSummary() { string summary = Builder.GetSummary(); GameDisplay.ClearAndDisplayRow(summary, TeamBuilderConsts.TeamSummaryRow); }
private void Awake() { Instance = this; gameObject.SetActive(false); }
public static void CheckForEntityInteractions(EntityList entityList) { //Check if player overlaps enemy foreach (var enemy in entityList.Enemies) { if (entityList.Player.XPosition == enemy.XPosition && entityList.Player.YPosition == enemy.YPosition && !HasSword) { Score -= 100; GameDisplay.DrawScore(); enemy.XPosition = 0; enemy.YPosition = 0; } else if (entityList.Player.XPosition == enemy.XPosition && entityList.Player.YPosition == enemy.YPosition && HasSword) { Score += 200; GameDisplay.DrawScore(); enemy.XPosition = 0; enemy.YPosition = 0; } } //Check if player overlaps coin foreach (var coin in entityList.Coins) { if (entityList.Player.XPosition == coin.XPosition && entityList.Player.YPosition == coin.YPosition) { Score += 100; GameDisplay.DrawScore(); coin.XPosition = 0; coin.YPosition = 0; GameDisplay.DrawMessage(coin); } } //Checks if player overlaps key if (entityList.Player.XPosition == entityList.Key.XPosition && entityList.Player.YPosition == entityList.Key.YPosition) { HasKey = true; entityList.Key.XPosition = 0; entityList.Key.YPosition = 0; GameDisplay.DrawMessage(entityList.Key); } //Checks if player unlocks door if (entityList.Player.XPosition == entityList.Door.XPosition - 1 && entityList.Player.YPosition == entityList.Door.YPosition && HasKey) { GameOver = true; GameDisplay.DrawWinScreen(); } else if (entityList.Player.XPosition == entityList.Door.XPosition - 1 && entityList.Player.YPosition == entityList.Door.YPosition && !HasKey) { GameDisplay.DrawMessage(entityList.Door); } //Checks if player collects sword if (entityList.Player.XPosition == entityList.Sword.XPosition && entityList.Player.YPosition == entityList.Sword.YPosition) { HasSword = true; } }