public static GameObject Create(string message, System.Action action) { GameObject dialog = Instantiate(Prefab) as GameObject; InteractPrompt prompt = dialog.GetComponent <InteractPrompt>(); prompt.setText(message); prompt.action = action; return(dialog); }
protected IEnumerator setupInteractPrompt() { if (interactPrompt != null) { yield return(null); } interactPrompt = InteractPrompt.Create(string.Format("({0}) {1}", InteractKey, promptText), () => executeAction()); yield return(null); }
public void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>(); canvas = GameObject.FindGameObjectWithTag("Canvas"); interactPrompt = canvas.transform.Find("InteractPrompt").GetComponent <InteractPrompt>(); dialogueBox = canvas.transform.Find("DialogueBox").GetComponent <DialogueBox>(); ui = GameObject.FindGameObjectWithTag("Canvas").GetComponent <UI>(); dialogue = new List <Page>(); dialogue.Add(new Page("NPC does not have dialogue set")); }
// Start is called before the first frame update void Start() { interactPrompt = GameObject.Find("PlayerObject").GetComponentInChildren <InteractPrompt>(); //Get the player pref for if their island is named //If nothing then set it to empty string if (PlayerPrefs.GetInt("allies") == 0) { PlayerPrefs.SetInt("allies", 0); PlayerPrefs.Save(); numAllies = PlayerPrefs.GetInt("allies"); } else { numAllies = PlayerPrefs.GetInt("allies"); } //Get the player pref for if their island is named //If nothing then set it to empty string if (PlayerPrefs.GetInt("alliesRange") == 0) { PlayerPrefs.SetInt("alliesRange", 0); PlayerPrefs.Save(); numAlliesRange = PlayerPrefs.GetInt("alliesRange"); } else { numAlliesRange = PlayerPrefs.GetInt("alliesRange"); } //Calc number of enemies to spawn numCurrentEnemies = (numAllies + numAlliesRange) * 2 + 10; SpawnAllies(); SpawnEnemies(numCurrentEnemies); SpawnChests(); }
IEnumerator cast() { while (true) { if (Physics.Raycast(transform.position, transform.forward, out hit, interactLength)) { ip = hit.transform.GetComponent <InteractPrompt>(); if (ip != null && ip != current) { if (current && current != ip) { current.promptToggle(false); } ip.promptToggle(true); current = ip; } else if (ip == null && current) { current.disableAllPrompts(); current = null; } //vlp = hit.transform.GetComponent<VoiceLinePromt>(); //if (vlp != null) //{ // vlp.PlayVoiceLine(); // vlp = null; //} } else if (current) { current.disableAllPrompts(); current = null; } yield return(new WaitForSeconds(0.15f)); } }
private void Start() { inv = Inventory.instance; ip = GetComponent <InteractPrompt>(); }
private void Awake() { Instance = this; anim = GetComponent <Animator>(); }