예제 #1
0
    public override void Initialize()
    {
        base.Initialize();

        float  timeToStartToEnqueue = Random.Range(minTimeToStart, maxTimeToStart);
        float  timeToCloseToEnqueue = Random.Range(minTimeToClose, maxTimeToClose);
        string keyToEnqueue         = validEvents[Mathf.FloorToInt(Random.Range(0, validEvents.Length))];

        quickdrawEvent = new QuickdrawEvent(keyToEnqueue, timeToStartToEnqueue, timeToCloseToEnqueue);

        // Create gameobjects where the prompt holder will live
        GameObject promptHolder = new GameObject("QTE Prompt Holder");
        GameObject buttonPrompt = new GameObject("ButtonPrompt");

        closingCirclePrompt = new GameObject("ClosingCircle");
        closingCirclePrompt.transform.parent = promptHolder.transform;
        buttonPrompt.transform.parent        = promptHolder.transform;

        promptHolder.transform.position = blacksmithCenter.position;
        promptHolder.transform.position = new Vector3(blacksmithCenter.position.x, blacksmithCenter.position.y, transform.position.z);

        buttonPromptRenderer         = buttonPrompt.AddComponent <SpriteRenderer>();
        buttonPromptRenderer.enabled = false;

        closingCircleRenderer        = closingCirclePrompt.AddComponent <SpriteRenderer>();
        closingCircleRenderer.sprite = circleSprite;
        //closingCircleRenderer.color = circleColor;
        closingCircleRenderer.enabled = false;

        // Show the first button prompt
        DisplayButtonPrompt(quickdrawEvent);
    }
예제 #2
0
    void DisplayButtonPrompt(QuickdrawEvent eventToDisplay)
    {
        string buttonToDisplay = eventToDisplay.key;

        initialClosingCircleTimer = closingCircleTimer = eventToDisplay.timeToClose;
        timeToDraw = eventToDisplay.timeToStart;
        helpPrompt.GetComponent <TextMesh>().text = "Wait...";
        helpPrompt.SetActive(true);

        // Show the prompt
        switch (buttonToDisplay)
        {
        case "A":
            buttonPromptRenderer.sprite = buttonSprites[0];
            break;

        case "B":
            buttonPromptRenderer.sprite = buttonSprites[1];
            break;

        case "X":
            buttonPromptRenderer.sprite = buttonSprites[2];
            break;

        case "Y":
            buttonPromptRenderer.sprite = buttonSprites[3];
            break;

        default:
            Debug.Log("What the hell is button " + buttonToDisplay);
            break;
        }
    }
예제 #3
0
 void ShutdownQTE()
 {
     if (closingCirclePrompt)
     {
         Destroy(closingCirclePrompt.transform.parent.gameObject);
     }
     quickdrawEvent = null;
     helpPrompt.SetActive(false);
 }