public void findAllDialogElements() { //Find the button script buttonEvents = GameObject.Find("GameControl").GetComponent <GameButtons> (); //Pause the game buttonEvents.pause(); //Activate all dialog elements for (int i = 0; i < GameObject.Find("dialogue_elements").transform.childCount; i++) { GameObject.Find("dialogue_elements").transform.GetChild(i).gameObject.SetActive(true); } //Find dialogelements and give them references dialogTextBox = GameObject.Find("dialogue_ingame").GetComponent <Text> (); characterName = GameObject.Find("dialogue_name").GetComponent <Text> (); questInfo = GameObject.Find("quest_info_text").GetComponent <Text> (); nextButton = GameObject.Find("dialogue_next"); //Placement characetername nameLeftPos = new Vector3(215.0f, -25.0f); nameRightPos = new Vector3(570.0f, -25.0f); //Character text color. Made to destinct who is talking. Color match character animation color textColorPlayer = "#173E3CFF"; textColorBoss = "#4F3430FF"; //all dialog is here setDialog(); //Starts first dialog. dialogBoss(0); }
void Update() { if (Ball_Controller.B_Lose) { I_EdgeFillAmount.fillAmount += F_speed * Time.deltaTime; //timer if (I_EdgeFillAmount.fillAmount >= 1) //player will die { SoundManagerGame.V_PlaySoundLose(); Ball_Controller.I_AdShow++; if (Advertisement.IsReady() && Ball_Controller.I_AdShow % 5 == 0) { Advertisement.Show(); } Ball_Controller.B_Lose = false; GameController.V_AdMoney(); print("test Bar"); StartCoroutine(LoseEffect.I_LoseEffect( C_FromColor: new Color32(0, 0, 0, 0), C_ToColor: new Color32(0, 0, 0, 113), F_OverTime: 1f)); StartCoroutine(GameButtons.I_RestartButtonCur( C_ToColor: 203, F_OverTime: 1)); StartCoroutine(AdTotalCoinText.I_AdCoinCur( C_ToColor: 203, F_OverTime: 1)); } } }
public bool GetButton(GameButtons button, int player = -1) { if (player < 0) { if (globalInputEnabled) { foreach (InputPlayer pl in players) { if (pl.GetButton(button)) { return(true); } } } } else { if (players.Count > player) { return(players[player].inputEnabled && players[player].GetButton(button)); } else { return(false); } } return(false); }
public Button(GameButtons gameButton, KeyCode keycode, Action action, Action releaseAction = null) { this.gameButton = gameButton; this.keycode = keycode; this.action = action; this.releaseAction = releaseAction; }
// Use this for initialization void Start() { feedback = ""; bossQ = FindObjectOfType <BossQuestions> (); fbPanel = FindObjectOfType <FeedbackPanel> (); Health = FindObjectOfType <HealthBar> (); bossHealth = FindObjectOfType <BossHealthBar> (); player = FindObjectOfType <PlayerController> (); clear = FindObjectOfType <GameButtons> (); correctFB = new string[] { "Way to go!", "You rock at this!", "Lookin’ good!", "Wow! I’m impressed!", "Keep at it!", "Good going!", "You were born a winner!", "Victory is yours!", "That was awesome!", "Great Job!", "Knew you could do it", "Great Job!", "You’re so good at this!", "That answer was perfect!" }; wrongFB = new string[] { "That was terrible", "Better luck next time!", "You really went with that answer?", "FAIL" }; }
private void Awake() { G_GameButtonsClass = this; I_RestartButton = gameObject.GetComponent <Image>(); B_RestartButton = gameObject.GetComponent <Button>(); B_ToMainButton = G_ToMainButton.GetComponent <Button>(); T_ToMainText = G_ToMainText.GetComponent <Text>(); }
private static IEnumerable <Buttons> GetGamePadButtons(GameButtons button) { try { var toReturn = new List <Buttons>(); switch (button) { case GameButtons.Down: toReturn.Add(Buttons.LeftThumbstickDown); toReturn.Add(Buttons.DPadDown); toReturn.Add(Buttons.RightThumbstickDown); break; case GameButtons.Accept: toReturn.Add(Buttons.A); break; case GameButtons.Left: toReturn.Add(Buttons.LeftThumbstickLeft); toReturn.Add(Buttons.DPadLeft); toReturn.Add(Buttons.RightThumbstickLeft); break; case GameButtons.Right: toReturn.Add(Buttons.LeftThumbstickRight); toReturn.Add(Buttons.DPadRight); toReturn.Add(Buttons.RightThumbstickRight); break; case GameButtons.Up: toReturn.Add(Buttons.LeftThumbstickUp); toReturn.Add(Buttons.DPadUp); toReturn.Add(Buttons.RightThumbstickUp); break; case GameButtons.Menu: toReturn.Add(Buttons.Start); break; case GameButtons.Decline: toReturn.Add(Buttons.B); toReturn.Add(Buttons.Back); break; case GameButtons.Restart: toReturn.Add(Buttons.Start); toReturn.Add(Buttons.X); break; } return(toReturn); }catch (Exception exception) { ErrorLog.Add(exception); return(null); } }
public static bool GameButtonPressedOrHeld(GameButtons button) { if (waitValue > DataManager.AutoRepeatDelay) { if (GameButtonPressed(button) || GameButtonHeld(button)) { return(true); } } return(false); }
public bool ButtonPressed(GameButtons b) { Keys k = GetKeyFromGameButton(b); if (keyboardInput.IsKeyDown(k) && (!oldKeyboardInput.IsKeyDown(k))) { oldKeyboardInput = keyboardInput; return(true); } return(false); }
void GetPlayerAttackOptions() { foreach (Enemy enemy in Save.GetRoom().Entities.FindAll(entity => entity is Enemy)) { if (enemy.Side != Save.Kevin.Side) { if (Math.Abs(enemy.Position.X - Save.Kevin.Position.X) + Math.Abs(enemy.Position.Y - Save.Kevin.Position.Y) == 1) { GameButtons.Add(new Attack(enemy)); } } } }
public override bool GetButtonReleased(GameButtons button) { switch (button) { case GameButtons.NONE: return(Input.GetKeyUp(KeyCode.None)); case GameButtons.JUMP: return(Input.GetKeyUp(jumpKey)); case GameButtons.ACTION: return(Input.GetKeyUp(throwKey)); } return(false); }
private static List <Buttons> GetGamePadButtons(GameButtons button) { var toReturn = new List <Buttons>(); switch (button) { case GameButtons.Down: toReturn.Add(Buttons.LeftThumbstickDown); toReturn.Add(Buttons.DPadDown); toReturn.Add(Buttons.RightThumbstickDown); break; case GameButtons.Accept: toReturn.Add(Buttons.A); break; case GameButtons.Left: toReturn.Add(Buttons.LeftThumbstickLeft); toReturn.Add(Buttons.DPadLeft); toReturn.Add(Buttons.RightThumbstickLeft); break; case GameButtons.Right: toReturn.Add(Buttons.LeftThumbstickRight); toReturn.Add(Buttons.DPadRight); toReturn.Add(Buttons.RightThumbstickRight); break; case GameButtons.Up: toReturn.Add(Buttons.LeftThumbstickUp); toReturn.Add(Buttons.DPadUp); toReturn.Add(Buttons.RightThumbstickUp); break; case GameButtons.Menu: toReturn.Add(Buttons.Start); break; case GameButtons.Decline: toReturn.Add(Buttons.B); toReturn.Add(Buttons.Back); break; } return(toReturn); }
private void OnTriggerEnter2D(Collider2D other) { var player = other.GetComponent <PlayerMovement>(); if (player != null) { if (Globals.IsEditorScene) { GameButtons.ClearGameScene(); } else { ExitCollisionEvent(gameObject); SceneManager.LoadScene(Globals.LevelSelectionSceneName); } } }
public static bool GameButtonHeld(GameButtons button) { try { var gamepad = GetGamePadButtons(button); if (gamepad.Any(ButtonHeld)) { _waitValue = 0; return(true); } return(false); }catch (Exception exception) { ErrorLog.Add(exception); return(false); } }
private void AddBombs() { var rand = new Random(); for (var i = 0; i < BombsCount; i++) { var numX = rand.Next(1, GameButtons.GetLength(0)); var numY = rand.Next(1, GameButtons.GetLength(1)); if (GameButtons[numX, numY].Value == "BOMB") { i--; continue; } GameButtons[numX, numY].Value = "BOMB"; } }
public static bool GameButtonPressedOrHeld(GameButtons button) { try { if (_waitValue > DataManager.AutoRepeatDelay) { if (GameButtonPressed(button) || GameButtonHeld(button)) { return(true); } } return(false); }catch (Exception exception) { ErrorLog.Add(exception); return(false); } }
private void OnUpgradeClick(GameButtons button) { if (SelectedStation == null) { return; } switch (button) { case GameButtons.BUTTON_DESK: if (Money >= DeskCost) { GameObject desk = (GameObject)Instantiate(deskPrefab, SelectedStation.transform.position, Quaternion.identity); desk.transform.SetParent(SelectedStation.transform); desk.transform.position = new Vector3(desk.transform.position.x, desk.transform.position.y - 5); GetButton(GameButtons.BUTTON_DESK).interactable = false; SetMoney(Money - DeskCost); DeskCost += DeskCostMultiplier; SetCost(0, DeskCost, true); GetButton(GameButtons.BUTTON_WORKER).interactable = true; } break; case GameButtons.BUTTON_WORKER: if (Money >= WorkerCost) { GameObject worker = (GameObject)Instantiate(workerPrefab, SelectedStation.transform.position, Quaternion.identity); worker.transform.SetParent(SelectedStation.transform); worker.transform.position = new Vector3(worker.transform.position.x, worker.transform.position.y + 25); GetButton(GameButtons.BUTTON_WORKER).interactable = false; SetMoney(Money - WorkerCost); WorkerCost += WorkerCostMultiplier; SetCost(0, WorkerCost); } break; } }
private static List <Keys> GetKeyboardButtons(GameButtons button) { var toReturn = new List <Keys>(); switch (button) { case GameButtons.Down: toReturn.Add(Keys.Down); break; case GameButtons.Accept: toReturn.Add(Keys.Enter); break; case GameButtons.Left: toReturn.Add(Keys.Left); break; case GameButtons.Right: toReturn.Add(Keys.Right); break; case GameButtons.Up: toReturn.Add(Keys.Up); break; case GameButtons.Menu: toReturn.Add(Keys.F1); break; case GameButtons.Decline: toReturn.Add(Keys.Escape); break; case GameButtons.Restart: toReturn.Add(Keys.F1); break; } return(toReturn); }
private void loadWorldMaster() { //Finds dialogboxes dialogTextBox = GameObject.Find("dialogue_ingame").GetComponent <Text> (); characterName = GameObject.Find("dialogue_name").GetComponent <Text> (); questInfo = GameObject.Find("quest_info_text").GetComponent <Text> (); pauseText = GameObject.Find("pause"); buttonEvents = GameObject.Find("GameControl").GetComponent <GameButtons> (); //Finds characterportretts marineCharacterWindow = GameObject.Find("Portrett2_marine"); shopKeeperCharacterWindow = GameObject.Find("Portrett2_shopkeeper"); bossCharacterWindow = GameObject.Find("Portrett2_boss"); //Find new nextbutton and add function to happen with click nextButton = GameObject.Find("dialogue_next"); nextButton.GetComponent <Button> ().onClick.AddListener(nextDialog); //Get the bubble and the windows around talkBubble = GameObject.Find("bubble_ingame"); avatarWindow = GameObject.Find("avatar1"); avatarWindow2 = GameObject.Find("avatar2"); //pause game buttonEvents.pause(); }
// TODO: options for multiple input modes private Keys GetKeyFromGameButton(GameButtons b) { switch (b) { case GameButtons.Down: return(Keys.Down); case GameButtons.Up: return(Keys.Up); case GameButtons.Left: return(Keys.Left); case GameButtons.Right: return(Keys.Right); case GameButtons.A: return(Keys.Enter); case GameButtons.Esc: return(Keys.Escape); case GameButtons.Tab: return(Keys.Tab); case GameButtons.B: return(Keys.Space); } return(Keys.None); }
void Start() { //Find all objects needed dialogTextBox = GameObject.Find("dialogue_ingame").GetComponent <Text> (); characterName = GameObject.Find("dialogue_name").GetComponent <Text> (); questInfo = GameObject.Find("quest_info_text").GetComponent <Text> (); buttonEvents = GameObject.Find("GameControl").GetComponent <GameButtons> (); compass = GameObject.Find("compass_needle").GetComponent <PointTowards> (); //Position characternames nameLeftPos = new Vector3(217.0f, -25.0f); nameRightPos = new Vector3(612.0f, -25.0f); //position shopkeeper name in shop nameShop = new Vector3(215.4f, 73.2f); //Textcolor based on character textColorPlayer = "#173E3CFF"; textColorShopkeeper = "#631911FF"; textColorMarine = "#323A46FF"; //Arrays to check if player has pressed all buttons wadCheck [0] = false; wadCheck [1] = false; wadCheck [2] = false; qeCheck [0] = false; qeCheck [1] = false; //Pause at startup buttonEvents.pause(); //Turn off shooting shootingAllowed(false, "NULL"); //Fill arrays with text dialogInArray(); //set quest info questInfo.text = "Talk to Shopkeeper."; //Trigger dialog here dialog(0); //The speed the buttons blink at blinkingButtonSpeed = 0.025f; }
public static bool GameButtonHeld(GameButtons button) { var keyboard = GetKeyboardButtons(button); var gamepad = GetGamePadButtons(button); foreach (Keys btn in keyboard) { if (KeyHeld(btn)) { waitValue = 0; return(true); } } foreach (Buttons btn in gamepad) { if (ButtonHeld(btn)) { waitValue = 0; return(true); } } return(false); }
private Button GetButton(GameButtons button) { return(Buttons[(int)button].GetComponent <Button>()); }
public bool ButtonDown(GameButtons b) { return(keyboardInput.IsKeyDown(GetKeyFromGameButton(b))); }
void Update() { transform.position = new Vector3(x: GameController.F_X, y: GameController.F_Y, z: transform.position.z); //Ball will be do bigger into the circle, near the Touch #region hold if (B_Lose) { if (Touch.S_Touch == "true" && !B_Second) { //Do ball bigger F_Speed += F_SpeedValue; transform.localScale = new Vector2(x: transform.localScale.y + F_Speed, y: transform.localScale.y + F_Speed); } //What happened (haw big ball when pleyer stop do it bigger) if (Touch.S_Touch == "false" && !B_First && !B_Second) //Middle { SoundManagerGame.V_PlaySoundLose(); I_AdShow++; if (Advertisement.IsReady() && I_AdShow % 5 == 0) { Advertisement.Show(); } print("test Middle"); Touch.S_Touch = "nope"; GameController.V_AdMoney(); StartCoroutine(LoseEffect.I_LoseEffect( C_FromColor: new Color32(0, 0, 0, 0), C_ToColor: new Color32(0, 0, 0, 113), F_OverTime: 1f)); StartCoroutine(GameButtons.I_RestartButtonCur( C_ToColor: 203, F_OverTime: 1)); StartCoroutine(AdTotalCoinText.I_AdCoinCur( C_ToColor: 203, F_OverTime: 1)); B_Lose = false; } if (Touch.S_Touch == "false" && B_First && !B_Second) //Win { SoundManagerGame.V_PlaySoundPassLevel(); LevelText.ChangeLevelText(); print("test Win"); Touch.S_Touch = "nope"; I_level++; LevelText.ChangeLevelText(); V_NewLevel(); if (I_level >= I_WhenMoveCircle) //If level >= level after what value u d'like to move circle { GameController.I_NewPos( width: Random.Range( //Random range X (Screen.width / 128.113f / 2 * -1) + (F_RandomScale * 3.25f), //From(smoller) (Screen.width / 128.113f / 2) - (F_RandomScale * 3.25f)), //To(bigger) height: Random.Range( //Random range Y (Screen.height / 128 / 2 * -1) + (F_RandomScale * 3.25f), //From(smoller) (Screen.height / 128 / 2) - (F_RandomScale * 3.25f))); //To(bigger) } if (I_level <= 100) { F_SpeedValue += 0.000003f; } ProgressBar.V_Win(); } if ((Touch.S_Touch == "false" && B_Second) || B_Second) //Lose { SoundManagerGame.V_PlaySoundLose(); I_AdShow++; if (Advertisement.IsReady() && I_AdShow % 5 == 0) { Advertisement.Show(); } print("test Lose"); Touch.S_Touch = "nope"; GameController.V_AdMoney(); StartCoroutine(LoseEffect.I_LoseEffect( C_FromColor: new Color32(0, 0, 0, 0), C_ToColor: new Color32(0, 0, 0, 113), F_OverTime: 1f)); StartCoroutine(GameButtons.I_RestartButtonCur( C_ToColor: 203, F_OverTime: 1)); StartCoroutine(AdTotalCoinText.I_AdCoinCur( C_ToColor: 203, F_OverTime: 1)); B_Lose = false; } if (Touch.S_Touch == "exit") //Exit { SoundManagerGame.V_PlaySoundLose(); I_AdShow++; if (Advertisement.IsReady() && I_AdShow % 5 == 0) { Advertisement.Show(); } print("test Exit"); Touch.S_Touch = "nope"; GameController.V_AdMoney(); StartCoroutine(LoseEffect.I_LoseEffect( C_FromColor: new Color32(0, 0, 0, 0), C_ToColor: new Color32(0, 0, 0, 113), F_OverTime: 1f)); StartCoroutine(GameButtons.I_RestartButtonCur( C_ToColor: 203, F_OverTime: 1)); StartCoroutine(AdTotalCoinText.I_AdCoinCur( C_ToColor: 203, F_OverTime: 1)); B_Lose = false; } } #endregion if (B_IsScale) { G_LevelCircle.transform.localScale = Vector3.Lerp( a: V_LocalScale, b: G_LevelCircle.transform.localScale = new Vector3(F_RandomScale, F_RandomScale, transform.localScale.z), t: Time.deltaTime * F_SpeedScale); V_LocalScale = new Vector3(G_LevelCircle.transform.localScale.x, G_LevelCircle.transform.localScale.x, G_LevelCircle.transform.localScale.x); } }
public void setBind( GameButtons button, int bind, Type type = Type.pressing ) { foreach ( var bnd in binds ) { if ( bnd.Key.button == button ) { throw new Exception ( "InputManager.setBind(...): Button have binded yet!" ); } } binds.Add ( new PressButtonType ( button, type ), bind ); }
public void unsetBind( GameButtons button ) { foreach ( var bnd in binds ) { if ( bnd.Key.button == button ) { toRemoveFromBinds.Add ( bnd.Key ); } } }
public void findAllDialogElements() { //Find the button script buttonEvents = GameObject.Find ("GameControl").GetComponent<GameButtons> (); //Pause the game buttonEvents.pause (); //Activate all dialog elements for (int i = 0; i < GameObject.Find("dialogue_elements").transform.childCount; i++) { GameObject.Find("dialogue_elements").transform.GetChild (i).gameObject.SetActive (true); } //Find dialogelements and give them references dialogTextBox = GameObject.Find ("dialogue_ingame").GetComponent<Text> (); characterName = GameObject.Find ("dialogue_name").GetComponent<Text> (); questInfo = GameObject.Find ("quest_info_text").GetComponent<Text> (); nextButton = GameObject.Find ("dialogue_next"); //Placement characetername nameLeftPos = new Vector3(215.0f, -25.0f); nameRightPos = new Vector3 (570.0f, -25.0f); //Character text color. Made to destinct who is talking. Color match character animation color textColorPlayer = "#173E3CFF"; textColorBoss = "#4F3430FF"; //all dialog is here setDialog (); //Starts first dialog. dialogBoss (0); }
public virtual bool GetButtonReleased(GameButtons button) { return(false); }
protected override void Update(GameTime gameTime) { CurrentMouseState = Mouse.GetState(); CurrentKeyboard = Keyboard.GetState(); ScaledMousePosition.X = CurrentMouseState.X / Scale; ScaledMousePosition.Y = CurrentMouseState.Y / Scale; switch (GameState) { case State.TITLE: CheckTitleScreenInput(); break; case State.EDITOR: CheckEditorInput(); break; case State.GAME: if (IsStartSoundPlaying()) { break; } //else if (StartSoundEnded()) // PlayGameMusic(); CheckGameInput(); if (MegaMapMode) { CheckMegaMapButtons(); CheckSkillButtons(); } CheckActiveSkills(); if (InteractingWithNPC()) { CheckNPCButtons(); } if (DescriptionList.Count == 0) { CheckItemDragging(); } CheckMouseHover(); CheckDescriptions(); if (ChangedFloors) { if (Save.Depth == 1) { Button megamap = new Button("4x", Keys.Tab); GameButtons.Add(megamap); } BuildMegaMap(); ChangedFloors = false; } break; case State.OPTIONS: CheckOptionScreenInput(); break; case State.CLASSSELECTION: CheckClassSelectionScreenInput(); break; } CheckWindowDragging(); LastMouseState = CurrentMouseState; LastKeyboard = CurrentKeyboard; base.Update(gameTime); }
public PressButtonType( GameButtons btn, Type t ) { button = btn; type = t; }