コード例 #1
0
    IEnumerator ObjectionTrigger(int min, int max, float timer)
    {
        //objectionAnim = objectionPanel.GetComponent<Animator>();
        objectionImage = objectionPanel.GetComponent <Image>();
        waitForSpace   = false;
        spaceFound     = false;
        inRange        = false;
        returnSeek     = false;
        objectionIndicator.gameObject.SetActive(true);
        yield return(new WaitForSeconds(2));

        objectionIndicator.gameObject.SetActive(false);
        objectionPanel.gameObject.SetActive(true);
        StartCoroutine(SlideTween(min, max, timer));
        yield return(StartCoroutine(WaitForUserSpacebar(timer)));

        if (spaceFound)
        {
            OnObjectionEnded?.Raise();
            //user clicked
        }
        else
        {
            // negative
        }
        objectionPanel.gameObject.SetActive(false);
    }
コード例 #2
0
 public void OnEndCutScene()
 {
     cutSceneOn = false;
     onCutSceneOver?.Raise();
     Debug.Log("CutScene Over");
     cutSceneAnimator.gameObject.SetActive(false);
 }
コード例 #3
0
    IEnumerator FadePanel(int fadeFrom)
    {
        Color final = fadePanel.color;

        final.a = 1 - fadeFrom;
        switch (fadeFrom)
        {
        case 0:
            for (float ft = 0f; ft <= 1; ft += 0.1f)
            {
                Color c = fadePanel.color;
                c.a             = ft;
                fadePanel.color = c;
                yield return(new WaitForSeconds(.1f));
            }
            break;

        case 1:
            for (float ft = 1f; ft >= 0; ft -= 0.1f)
            {
                Color c = fadePanel.color;
                c.a             = ft;
                fadePanel.color = c;
                yield return(new WaitForSeconds(.1f));
            }
            break;
        }
        fadePanel.color = final;
        yield return(new WaitForSeconds(1.5f));

        fadeComplete?.Raise();
        yield return(new WaitForSeconds(0.1f));
    }
コード例 #4
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (clickStart == true)
     {
         OnConversationClicked?.Raise();
         clickStart = false;
     }
 }
コード例 #5
0
 public void OnEventRaisedWithParameters(List <object> parameters)
 {
     dialogueIndex = -1;
     if (parameters != null)
     {
         foreach (object param in parameters)
         {
             string[] text = (string[])param as string[];
             dialogues = text;
             //text.Trim();
             //dialogues = text.Split(new Char[] { '?', '!', ',', '.', '\n' });
             if (dialogueCount > 0)
             {
                 OnConversationStarted?.Raise();
                 TryConversation();
             }
         }
     }
     else
     {
         Debug.Log("no conversation passed");
     }
 }
コード例 #6
0
    IEnumerator HighlighPanel(GameObject toHighlight, string guidanceString)
    {
        int       oldOrder      = toHighlight.GetComponentInChildren <SpriteRenderer>().sortingOrder;
        Transform currentParent = toHighlight.transform.parent;

        toHighlight.transform.SetParent(transform);
        toHighlight.transform.SetAsLastSibling();
        foreach (SpriteRenderer item in toHighlight.GetComponentsInChildren <SpriteRenderer>())
        {
            item.sortingOrder = GetComponent <Canvas>().sortingOrder + 1;
        }
        guidanceText.text = guidanceString;
        guidanceSystem.SetActive(true);
        for (float ft = 0f; ft <= 0.8; ft += 0.2f)
        {
            Color c = highlightPanel.color;
            c.a = ft;
            highlightPanel.color = c;
            yield return(new WaitForSeconds(.1f));
        }

        pointer.position = new Vector2(toHighlight.transform.position.x, toHighlight.transform.position.y) + pointerOffset;
        pointer.SetAsLastSibling();
        pointer.gameObject.SetActive(true);
        objectHighlighted = true;

        while (objectHighlighted)
        {
            yield return(null);
        }

        foreach (SpriteRenderer item in toHighlight.GetComponentsInChildren <SpriteRenderer>())
        {
            item.sortingOrder = oldOrder;
        }
        toHighlight.transform.SetParent(currentParent);
        pointer.gameObject.SetActive(false);
        guidanceText.text = "";
        for (float ft = 0.8f; ft >= 0; ft -= 0.2f)
        {
            Color c = highlightPanel.color;
            c.a = ft;
            highlightPanel.color = c;
            yield return(new WaitForSeconds(.1f));
        }
        Debug.Log("Highlight Complete");
        highlightComplete?.Raise();
        yield return(new WaitForSeconds(0.1f));
    }
コード例 #7
0
        public override void OnInspectorGUI()
        {
            using (new EditorGUI.DisabledScope(true))
            {
                EditorGUILayout.ObjectField("Asset", target, typeof(Event), false);
            }

            base.OnInspectorGUI();

            using (new EditorGUI.DisabledScope(!Application.isPlaying))
            {
                Event e = target as Event;
                if (GUILayout.Button("Raise"))
                {
                    e.Raise();
                }

                GUILayout.Label(string.Format("{0} delegate handler(s) registered", e.ActiveListenerCount));
            }
        }
コード例 #8
0
 IEnumerator WordGameCoroutine(WordGameData wordGameData)
 {
     for (int i = 0; i < wordGameData.wordGameRows.Length; i++)
     {
         string[] buttonRowString = { wordGameData.wordGameRows[i].words[0], wordGameData.wordGameRows[i].words[1], wordGameData.wordGameRows[i].words[2] };
         buttonRow.SetRow(buttonRowString);
         for (int j = 0; j < buttonList.Length; j++)
         {
             buttonList[j].GetComponent <Image>().color = normalColor;
             buttonList[j].interactable = true;
         }
         mainPanel.SetActive(true);
         currentAnswerIndex = wordGameData.wordGameRows[i].correctOption;
         awaitingInput      = true;
         while (awaitingInput)
         {
             yield return(null);
         }
         yield return(new WaitForSeconds(2));
     }
     onGameComplete?.Raise();
     yield return(null);
 }
コード例 #9
0
 public void Conversation(bool isHappening)
 {
     anim.SetBool(convoString, true);
     mainGameObject.gameObject.SetActive(true);
     OnStartClick?.Raise();
 }