public override void OnUpdate() { if (Time.timeSinceLevelLoad - m_sinceLastHit > FocusRegainDelay) { damageFocus(-FocusRegainRate * Time.deltaTime); } Vector2 inputDir = GetComponent <BasicMovement> ().m_inputMove; if (inputDir.x != LastDirectionHeld.x || inputDir.y != LastDirectionHeld.y) { LastDirectionHeld = inputDir; m_last_time_held_direction = Time.timeSinceLevelLoad; } m_msg_parry = new UIActionText(); m_msg_parry.text = "Parry"; m_msg_parry.textColor = Color.white; m_msg_parry.timeToDisplay = 1f; m_msg_perfectguard = new UIActionText(); m_msg_perfectguard.text = "Perfect Guard"; m_msg_perfectguard.textColor = Color.yellow; m_msg_perfectguard.timeToDisplay = 1f; m_msg_backstab = new UIActionText(); m_msg_backstab.text = "BackStabbed!!!"; m_msg_backstab.textColor = Color.red; m_msg_backstab.timeToDisplay = 1f; }
public void AddText(UIActionText uai) { uai.timeCreated = Time.timeSinceLevelLoad; GameObject go = Instantiate(ActionTextPrefab, transform.Find("ActionText")); go.GetComponent <TextMeshProUGUI>().text = uai.text.PadLeft(40); go.GetComponent <TextMeshProUGUI>().color = new Color(uai.textColor.r, uai.textColor.r, uai.textColor.b, 0f); uai.element = go; m_actionTextList.Add(uai); }
public void RemoveText(UIActionText uai) { List <UIActionText> newL = new List <UIActionText>(); foreach (UIActionText uat in m_actionTextList) { if (uai.id == uat.id) { Destroy(uat.element); } else { newL.Add(uat); } } m_actionTextList = newL; }
protected void init() { lastTimeTriggered = -TriggerRefresh; Actor = null; //Will become true if the interactor presses/holds the interaction key while in this interactable's area HoldTrigger = false; PressTrigger = false; m_prompt = new UIActionText(); m_prompt.text = "Press Enter to Interact"; m_prompt.textColor = Color.white; m_prompt.timeToDisplay = 2.0f; m_prompt.id = "intPrompt"; if (GetComponent <PersistentItem> () != null) { GetComponent <PersistentItem> ().InitializeSaveLoadFuncs(storeData, loadData); } }