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> /// Get the object. /// </summary> /// <param name="arg">Object to get</param> public void Get(string arg) { //TODO: Need to rewrite a bit to allow for the player to get the stone piece. GameObject hit = GetRaycastObject(); if (arg.ToUpper() == "KEY") { if (hit == null) { DialogueScript.ErrorText("There's nothing there"); return; } if (hit.transform.tag == "Key") { hit.transform.gameObject.GetComponent <AudioSource>().Play(); DialogueScript.GameInformationText("You picked up a shiny key!"); hit.transform.position = Vector3.one * 99999f; Destroy(hit.transform.gameObject, 2); MovementCommands.Forward("1"); Keys += 1; InterfaceScript.InfoKeyText.text = "Your Keys: " + Keys; } else { DialogueScript.ErrorText("You can't get that"); } } if (ItemNameListScript.StoneNameList.Any(s => s.Equals(arg, StringComparison.CurrentCultureIgnoreCase))) { if (hit.tag == "Tablet") { MovementCommands.Forward("1"); } } else { DialogueScript.ErrorText("Get what?"); } }
public override void Execute() { MovementCommands.ToggleForceWalk(); }
public override void Execute() { MovementCommands.SetForceWalk(false); }