// Use this for initialization void Start() { // get Interface Script gui_script = GameObject.Find("GUI").gameObject.GetComponent <InterfaceScript>(); osc = GameObject.Find("osc_script").gameObject.GetComponent <OSCReceiver1> (); spheres = GameObject.Find("spheres_script").gameObject.GetComponent <Spheres> (); }
public void setData(InterfaceScript _master, ObjectInSpace _owner, ObjectInSpace _target, InterfaceOverviewItemScript _interfaceOverviewItem) { master = _master; owner = _owner; target = _target; interfaceOverviewItem = _interfaceOverviewItem; }
void Awake() { Notifications = GameObject.Find("GameManager").GetComponent <NotificationsManager>(); //get references randomizedData = GetComponent <RandomizedData>(); //get array of goblins in the scene goblins = GameObject.FindGameObjectsWithTag("Goblin"); uiScript = GameObject.Find("GameManager").GetComponent <InterfaceScript>(); array_bedroomsInScene = GameObject.FindGameObjectsWithTag("Bedroom"); array_goblinMats = Resources.LoadAll("Materials", typeof(Material)).Cast <Material>().ToArray(); array_hatsInFolder = Resources.LoadAll("Prefabs/Hats", typeof(GameObject)).Cast <GameObject>().ToArray(); //can only get contents of folder into array, I guess array_containersInFolder = Resources.LoadAll("Prefabs/Containers", typeof(GameObject)).Cast <GameObject>().ToArray(); ChooseMurderer(); //done first so we can choose who knows who the murderer is in the next function call SetGoblinBasicInfo(); //names all goblins and stores names and scripts in dict, knowsMurderer, weapon, bedroom SetGoblinDialogue1_and_2(); //sets victim name, feelings, and dialogue options 1 and 2 SetGoblinDialogue3(); //sets dialogue option 3. Must come after 1 & 2 because all feelings must be set for this to work. //TestDialogues(); SetGoblinHats(); SetUpContainers(); SetUpVictim(); SetUserInterfaceData(); }
/// <summary> /// Shows the help. /// </summary> /// <param name="arg"></param> /// <param name="arg2"></param> public void ShowHelp(string arg, string arg2) { //TODO: Currently this is being done both in InputValidation.cs and here. Simplify? string[] panelNames = { "MOVE", "TUTORIAL", "INTERACT", "COMMAND", "COMBAT" }; //Check if the Player gave any additional input CheckString("Help", arg); //If not, send "null" to the InterfaceScript so that will show the help panel if (NoInput) { InterfaceScript.ShowHelp("null"); //InterfaceScript.ActivateInput(); return; } //If there are arguments, it should either be "with" + a valid help opion // or just a valid help option. if (arg.Equals("with", StringComparison.CurrentCultureIgnoreCase) && CommandListScript.AllCommandsList.Any(s => s.Equals(arg2, StringComparison.CurrentCultureIgnoreCase))) { InterfaceScript.ShowHelp(arg2); return; } if (CommandListScript.AllCommandsList.Any(s => s.Equals(arg, StringComparison.CurrentCultureIgnoreCase)) || panelNames.Any(s => s.Equals(arg, StringComparison.CurrentCultureIgnoreCase))) { InterfaceScript.ShowHelp(arg); return; } //Or if no valid command was given as an argument, let the Player know. else { DialogueScript.ErrorText("No help for that."); } }
public void Awake() { //Get all of the scripts InteractionScript = GetComponent <InteractionCommands>(); CommandScript = GetComponent <Commands>(); CombatCommands = GetComponent <CombatCommands>(); MovementCommands = GetComponent <MovementCommands>(); DissectingScript = GetComponent <DissectInputScript>(); DialogueScript = GameObject.FindGameObjectWithTag("UI").GetComponent <Dialogue>(); PlayerScript = GetComponent <Player>(); InterfaceScript = GameObject.FindGameObjectWithTag("UI").GetComponent <InterfaceScript>(); ItemNameListScript = GameObject.FindGameObjectWithTag("ScriptHolder").GetComponent <ItemNameList>(); GameTurnController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameTurnController>(); if (!GameObject.FindGameObjectWithTag("CommandListHolder")) { Instantiate(gameObject, Vector3.zero, Quaternion.identity); gameObject.tag = "CommandListHolder"; gameObject.name = "CommandListHolder"; gameObject.AddComponent <CommandList>(); CommandListScript = gameObject.GetComponent <CommandList>(); } else { CommandListScript = GameObject.FindGameObjectWithTag("CommandListHolder").GetComponent <CommandList>(); } LevelScript = GameObject.FindGameObjectWithTag("ScriptHolder").GetComponent <LevelScript>(); }
/// <summary> /// Changes the turn after a combat move has finished checking for hit or miss /// </summary> /// <param name="ability">The ability.</param> /// <param name="hit">The hit.</param> public void ChangeTurn(string ability, string hit) { GameObject.FindGameObjectWithTag("Player").GetComponent <WarriorClass>().chargeAmount--; //If the ability was Slam and it hit (or crit) if (ability == "Slam" && (hit == "Hit" || hit == "Crit")) { //Inform the Player that the enemy is stunned DialogueScript.CombatTextPlayer("Your foe seems stunned by your shield!"); DialogueScript.CombatTextPlayer("Quickly strike again before he regains his whereabouts!"); //Return the state to Combat, add one to Turn counter and activate input GameTurnController.CurrentState = GameTurnController.PlayerState.Combat; CurrentTurn++; InterfaceScript.ActivateInput(); return; } //Else, if the ability was null (i.e. missed) if (ability == null) { //Change state to Enemy turn, do 0 damage and add one to turn counter GameTurnController.CurrentState = GameTurnController.PlayerState.EnemyCombatTurn; StartCoroutine(DoDamage(0, "null")); CurrentTurn++; return; } //Otherwise, just change to enemy turn and add one to turn counter GameTurnController.CurrentState = GameTurnController.PlayerState.EnemyCombatTurn; CurrentTurn++; }
void Awake() { sound = GetComponent <AudioSource>(); gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); Notifications = GameObject.Find("GameManager").GetComponent <NotificationsManager>(); uiScript = GameObject.Find("GameManager").GetComponent <InterfaceScript>(); playerState = PlayerState.none; }
void Start() { if (point == Vector3.zero) { destroy(); } startTime = Time.time; master = GameObject.Find("InterfaceGame").GetComponent <InterfaceScript>(); }
void Awake() { //UI = GameObject.Find ("UI"); UIscript = GameObject.Find("GameManager").GetComponent <InterfaceScript>(); Notifications = GameObject.Find("GameManager").GetComponent <NotificationsManager>(); //gameManager = GameObject.Find("GameManager").GetComponent<GameManager>(); //mainMenu = GameObject.Find ("MainMenu"); //mainMenuScript = mainMenu.GetComponent<MenuScript>(); }
private void Awake() { GameObject userInterface = GameObject.FindGameObjectWithTag("UI"); _uScript = userInterface.GetComponent <InterfaceScript>(); _uScript.FindPlayerScript(); Level = 1; SetPlayerStats(); _uScript.InfoKeyText.text = "Your Keys: " + GetComponent <Commands>().Keys; }
internal bool OnCooldown(string function) { if (CooldownList.Any(s => s.Equals(function, StringComparison.CurrentCultureIgnoreCase))) { DialogueScript.ErrorText("You're currently cooling down from using that ability."); InterfaceScript.ActivateInput(); return(true); } return(false); }
private void Start() { canvas = GameObject.Find("Canvas"); interfaceScript = canvas.GetComponent <InterfaceScript>(); viewMesh = new Mesh(); viewMesh.name = "View Mesh"; viewMeshFilter.mesh = viewMesh; StartCoroutine("FindTargetsWithDelay", .2f); }
void Awake() { _gameTurnController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameTurnController>(); _uiScript = GameObject.FindGameObjectWithTag("UI").GetComponent <InterfaceScript>(); _levelScript = GameObject.FindGameObjectWithTag("ScriptHolder").GetComponent <LevelScript>(); _enemyName = this.name.Remove(1, name.Length - 1); if (SceneManager.GetActiveScene().name == "Tutorial") { GetScripts(); } }
void Awake() { //If this is the tutorial, so the very first level, set the number of commands available to 4 //Otherwise the Player should receive whatever they had left from the previous level. if (SceneManager.GetActiveScene().name == "Tutorial") { PlayerPrefs.SetInt("CommandsPool", 4); } GameObject userInterface = GameObject.FindGameObjectWithTag("UI"); _uScript = userInterface.GetComponent <InterfaceScript>(); CommandHistoryList = new List <string>(); }
void Start() { //guarda todas as referências necessárias player = FindObjectOfType <PlayerController>(); interfaceScript = FindObjectOfType <InterfaceScript>(); cameraController = FindObjectOfType <CameraController>(); miniGameController = FindObjectOfType <MiniGameController>(); Invoke("DelayStart", 0.1f); //carrega qual foi o último vírus jogado //irá setar o currentVirusID no playerController LoadData(); }
public static void StopADS() { if (!HipFirePositionReached && WeaponSwitch.Wapens[WeaponSwitch.CurrentWeapon].Recoil == 0) { WeaponSwitch.Wapens[WeaponSwitch.CurrentWeapon].WeaponObject.transform.localPosition = Vector3.Slerp(WeaponSwitch.Wapens[WeaponSwitch.CurrentWeapon].WeaponObject.transform.localPosition, HipFirePosition, Time.deltaTime * 25f); Camera.main.fieldOfView = Mathf.Lerp(Camera.main.fieldOfView, NormalFOV, Time.deltaTime * 25f); try { InterfaceScript.EnableCrosshair(); } catch { } } }
void FinishTurn() { if (currentHp < lastTurnHp) { cowardness++; } //if it lost hp this turn, make it more likley to block if (currentHp <= 0) //if it has no hp { if (enemyName != "Boss") { Animate(); } //die else { DialogueScript.CombatTextEnemy("NO YOU FOILED MY PLANS! BUT I WILL BE BACK!"); } switch (enemyName) { case "D": GetComponent <Animator>().SetBool("TrollDeath", true); break; case "S": GetComponent <Animator>().SetTrigger("DeathAnimationTrigger"); break; } Invoke("EndOfMe", 2f); //get deadededed } if (hasRegen == true && currentHp < maxHp && currentHp > 0) //if it has regen, and it hp is less than max, and more than 0 { currentHp += regenSpeed; //if the enemy has regen, add regen to health DialogueScript.CombatTextEnemy("Some of the " + enemyName + "s wounds close up!"); } if (currentHp > maxHp) { currentHp = maxHp; } //if health exeeds max health set it to max health lastTurnHp = currentHp; //ends the turn, and stores how much hp this used to have if (PlayerPrefs.GetInt("Health") <= 0) { KillPlayer(); } //if the player has 0 hp kill it CurrentTurn++; //add to current turn GameTurnController.CurrentState = GameTurnController.PlayerState.Combat; //change turn InterfaceScript.ActivateInput(); }
private float dim = 1.42f; //initial dimensions //private var sphere = GameObject.Find(gameReceiver); // Use this for initialization void Start() { // get Interface Script gui_script = GameObject.Find("GUI").gameObject.GetComponent <InterfaceScript>(); //Initializes on start up to listen for messages //make sure this game object has both UDPPackIO and OSC script attached UDPPacketIO udp = GetComponent <UDPPacketIO>(); udp.init(RemoteIP, SendToPort, ListenerPort); handler = GetComponent <Osc>(); handler.init(udp); handler.SetAllMessageHandler(AllMessageHandler); }
public void GettingLoot(string potionType) { StopCoroutine("ActivatingCommands"); ClearCommandPool(); if (LootedPermPotion) { DialogueScript.GameInformationText("You looted a " + potionType + " potion!"); DialogueScript.GameInformationText("If you want to use it, write yes! Otherwise write anything else."); InterfaceScript.IsGettingLoot = true; InterfaceScript.ActivateInput(); GameTurnController.CurrentState = GameTurnController.PlayerState.PlayerTurn; return; } StartChain(); }
/// <summary> /// Activates the instant command. /// </summary> /// <param name="instantCommand">The instant command.</param> /// <returns></returns> public IEnumerator ActivateInstantCommand(string instantCommand) { //Change the state to CommandChain if (GameTurnController.CurrentState == GameTurnController.PlayerState.PlayerTurn) { GameTurnController.CurrentState = GameTurnController.PlayerState.CommandChain; } //Deactivate the input and run the command through the dissecting script InterfaceScript.DeActivateInput(); DissectingScript.DissectPlayerInput(instantCommand, 2); //For the commands that needs it (like Rest), wait until they are done before moving on if (MovementCommands.MovementHappening) { while (MovementCommands.MovementHappening) { yield return(new WaitForEndOfFrame()); } } yield return(new WaitForSeconds(0.2f)); //Check if it is dark, and check of rest was used which will take up the entire turn then move to enemyturn if (LevelScript.Darkness) { LevelScript.DarknessHealthLoss(); } if (instantCommand.ToUpper() == "REST") { if (CheckForEnemies() == 0 || SceneManager.GetActiveScene().name == "Level20") { DialogueScript.GameInformationText("It's your turn."); GameTurnController.CurrentState = GameTurnController.PlayerState.PlayerTurn; InterfaceScript.ActivateInput(); yield break; } DialogueScript.GameInformationText("Enemies are moving."); GameTurnController.CurrentState = GameTurnController.PlayerState.EnemyTurn; yield break; } //Or return to playerturn and activate the input if (GameTurnController.CurrentState == GameTurnController.PlayerState.CommandChain) { GameTurnController.CurrentState = GameTurnController.PlayerState.PlayerTurn; } InterfaceScript.ActivateInput(); }
void Update() { if (Input.GetKeyUp(KeyCode.Return)) { if (GameTurnController.CurrentState == GameTurnController.PlayerState.EnemyCombatTurn || GameTurnController.CurrentState == GameTurnController.PlayerState.CommandChain || GameTurnController.CurrentState == GameTurnController.PlayerState.EnemyTurn) { DialogueScript.ErrorText("Can't do anything now."); InterfaceScript.DeActivateInput(); } else if (GameTurnController.CurrentState == GameTurnController.PlayerState.Combat || GameTurnController.CurrentState == GameTurnController.PlayerState.PlayerTurn) { if (InterfaceScript.CommandInputField.text == "") { DialogueScript.ErrorText("Nothing saved."); InterfaceScript.ActivateInput(); return; } InterfaceScript.PlayerInput(); } } //Make sure that if people hit their mouse buttons or escape, the input is still active if (Input.GetKeyUp(KeyCode.Mouse0) || Input.GetKeyUp(KeyCode.Mouse1) || Input.GetKeyUp(KeyCode.Escape)) { InterfaceScript.ActivateInput(); } //If Player hit the up-arrow, the last thing they wrote will be placed back into the input field if (Input.GetKeyUp(KeyCode.UpArrow) && (GameTurnController.CurrentState == GameTurnController.PlayerState.PlayerTurn || GameTurnController.CurrentState == GameTurnController.PlayerState.Combat)) { if (InterfaceScript.LastCommands == null) { return; } InterfaceScript.ActivateInput(); InterfaceScript.CommandInputField.text = InterfaceScript.LastCommands; InterfaceScript.CommandInputField.MoveTextEnd(true); InterfaceScript.LastCommands = null; } }
void Awake() { //Get the other scripts _gameTurnController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameTurnController>(); _commandListScript = GameObject.FindGameObjectWithTag("CommandListHolder").GetComponent <CommandList>(); _dialogueScript = GameObject.FindGameObjectWithTag("UI").GetComponent <Dialogue>(); _commandsScript = GetComponent <Commands>(); _interfaceScript = GameObject.FindGameObjectWithTag("UI").GetComponent <InterfaceScript>(); //Fill up the command lists _tutorialCommands = new List <string> { "NEXT", "FINISHED", "PREVIOUS", "RESPAWN", "INFO" }; _instantCommands = new List <string> { "ALIAS", "UNALIAS", "LEVEL", "RESTART", "HELP", "LIST", "EXPERIENCE", "STATS", "REST", "GAINLEVEL", "GETKEY", "CLOSE" }; _nillOneTwoArgumentCommands = new List <string>() { "KICK", "WEAR", "LICK", "JUMP", "HIDE", "LOOK", "PUSH", "PULL", "GO", "HELP" }; //Get the player class _className = PlayerPrefs.GetString("Class"); }
private void Start() { databaseAccess = FindObjectOfType <DatabaseScript>(); interfaceScriptAccess = FindObjectOfType <InterfaceScript>(); }
void Start() { databaseAccess = FindObjectOfType <DatabaseScript>(); variableAccess = FindObjectOfType <Initialisation>(); interfaceScriptAccess = FindObjectOfType <InterfaceScript>(); }
// Use this for initialization void Start () { inter = gameController.GetComponent<InterfaceScript>(); soundCtrl = GameObject.FindGameObjectWithTag("SoundController").GetComponent<SoundController>(); lvlCtrl = gameController.GetComponent<LevelController>(); }
public void setData(InterfaceScript _master, ObjectInSpace _owner, ObjectInSpace _target) { master = _master; owner = _owner; target = _target; }
void Awake() { //sound = GameObject.Find("SoundManager").GetComponent<SoundManager>(); uiScript = GameObject.Find("UI").GetComponent <InterfaceScript>(); }
void Start() { CommandListScript.UpdateAllCommandsList(); InterfaceScript.ActivateInput(); InterfaceScript.LevelText.text = LevelScript.LevelCounter.ToString(); }
/// <summary> /// IEnumerator that will go through the command chain until it is done, then reset everything that needs resetting to be ready for next turn. /// This is called from the function Start in the in-game commands list /// </summary> /// <returns></returns> public IEnumerator ActivatingCommands() { GameTurnController.CurrentState = GameTurnController.PlayerState.CommandChain; int textToRemove = 0; InterfaceScript.DeActivateInput(); if (DialogueScript.CommandHistoryList.Count > 0) { foreach (string s in DialogueScript.CommandHistoryList) { DialogueScript.MovementText("You perform " + s); DissectingScript.DissectPlayerInput(s, 2); InterfaceScript.CommandPoolTexts[textToRemove].color = Color.green; if (MovementCommands.MovementHappening) { while (MovementCommands.MovementHappening) { yield return(new WaitForEndOfFrame()); } } if (MetObstacle) { DialogueScript.MovementText("You appear too disoriented to continue."); MetObstacle = false; break; } if ( CommandListScript.EmoteList.Any( x => string.Equals(InterfaceScript.CommandPoolTexts[textToRemove].text, x, StringComparison.CurrentCultureIgnoreCase))) { InterfaceScript.CommandPoolTexts[textToRemove].text = ""; textToRemove++; yield return(new WaitForSeconds(1.7f)); } else { InterfaceScript.CommandPoolTexts[textToRemove].text = ""; textToRemove++; yield return(new WaitForSeconds(0.7f)); } } } ClearCommandPool(); if (LevelScript.Darkness) { LevelScript.DarknessHealthLoss(); } if (GameTurnController.CurrentState == GameTurnController.PlayerState.Combat || GameTurnController.CurrentState == GameTurnController.PlayerState.EnemyCombatTurn) { yield break; } if (SceneManager.GetActiveScene().name == "Tutorial") { GameTurnController.CurrentState = GameTurnController.PlayerState.PlayerTurn; InterfaceScript.ActivateInput(); yield break; } if (LevelFinished) { GameTurnController.CurrentState = GameTurnController.PlayerState.PlayerTurn; yield break; } if (CheckForEnemies() == 0 || SceneManager.GetActiveScene().name == "Level20") { DialogueScript.GameInformationText("It's your turn."); GameTurnController.CurrentState = GameTurnController.PlayerState.PlayerTurn; InterfaceScript.ActivateInput(); yield break; } DialogueScript.GameInformationText("Enemies are moving."); GameTurnController.CurrentState = GameTurnController.PlayerState.EnemyTurn; }
private void Start() { canvas = GameObject.Find("Canvas"); interfaceScript = canvas.GetComponent <InterfaceScript>(); }
/// <summary> /// Print out a list of argument /// </summary> /// <param name="arg">The argument.</param> new public void List(string arg) { CheckString("List", arg); if (NoInput) { return; } if (arg.ToUpper() == "ALIAS") { //Make sure that the Player has actually saved an alias if (CommandListScript.AliasDictionary.Count != 0) { //Inform the Player that these are the aliases created DialogueScript.GameInformationText( "Here's a list of aliases. "); //Iterate through the dictionary and print out each alias alongside the function foreach (string s in CommandListScript.AliasDictionary.Keys) { string value = CommandListScript.AliasDictionary[s]; DialogueScript.MovementText(s + " : " + value); } } else { DialogueScript.ErrorText("No aliases saved."); } } if (arg.ToUpper() == "COMMANDS") { StringBuilder builtString = new StringBuilder(); foreach (var list in CommandListScript.ValidCommandsList) { foreach (string s in list) { builtString.Append(s).Append(" | "); } } foreach (string s in CommandListScript.CommandsList) { builtString.Append(s).Append(" | "); } foreach (string s in CommandListScript.CombatCommands) { builtString.Append(s).Append(" | "); } InterfaceScript.PlaceText(builtString.ToString(), new Color(0, 255, 200), 15); } if (string.Equals(arg, "emotes", StringComparison.CurrentCultureIgnoreCase)) { var builtString = new StringBuilder(); foreach (string s in CommandListScript.EmoteList) { builtString.Append(s).Append(" - "); } InterfaceScript.PlaceText(builtString.ToString(), new Color(0, 255, 200), 15); } if (GameTurnController.CurrentState == GameTurnController.PlayerState.Combat) { InterfaceScript.ActivateInput(); } }