// Instantiates and begins the quick time event public void OnButtonPress() { GameObject QTArea = Instantiate(QTAreaPrefab, transform.parent) as GameObject; QTFramework QTFramework = QTArea.GetComponentInChildren <QTFramework>(); QTFramework.sequence = attackSequence; }
private void StartQuickTime() { GameObject QTArea = Instantiate(areaPrefab, transform.parent) as GameObject; QTFramework QTFramework = QTArea.GetComponent <QTFramework>(); QTFramework.sequence = quickTimeKeys; }
public void RunQuickTime(string attack) { // Initialises the sequence to pass to QTFramework. // Is initialised as a new list to prevent crashing on unknown attack List <KeyCode> quickTimeKeys = new List <KeyCode>(); // Instantiates the area that the quick time event will occur in as a child of the canvas. GameObject QTArea = Instantiate(areaPrefab, rootUI.transform) as GameObject; QTFramework = QTArea.GetComponentInChildren <QTFramework>(); // Checks which attack was selected and then sets the quick time button sequence accordingly. // Currently uses placeholder sequences switch (attack) { case "Light": { quickTimeKeys = new List <KeyCode> { KeyCode.L, KeyCode.I, KeyCode.G, KeyCode.H, KeyCode.T }; break; } case "Medium": { quickTimeKeys = new List <KeyCode> { KeyCode.M, KeyCode.E, KeyCode.D, KeyCode.I, KeyCode.U, KeyCode.M }; break; } case "Heavy": { quickTimeKeys = new List <KeyCode> { KeyCode.H, KeyCode.E, KeyCode.A, KeyCode.V, KeyCode.Y }; break; } case "Sheep": { quickTimeKeys = new List <KeyCode> { KeyCode.S, KeyCode.H, KeyCode.E, KeyCode.E, KeyCode.P }; break; } default: { Debug.Log("ERROR: Unkown attack \n" + attack); break; } } // Sends the selected sequence to the quick time area QTFramework.sequence = quickTimeKeys; }