Пример #1
0
    IEnumerator  NpcConversation(int conversationLength, float gapTime)
    {
        bool UserPressedKey = false;

        stopConversation = false;
        bool isStillTyping = false;


        for (int j = 0; j < conversationLength && KeyListener.ContinueListeningKeys;)
        {
            UserPressedKey = KeyListener.GetIsKeyPressed();
            //Debug.Log("user pressed key");
            //keep checking if the user pressed end key (n for this case)
            stopConversation = KeyListener.IsStopActionNow();


            //for loop will not end if no j++ or Stopconversation is not true
            if (UserPressedKey && !stopConversation)
            {
                //this is the beginning of real conversation, other messages are just basic message everyone has
                isStillTalking = true;
                isStillTyping  = screenMessage_Action.GetIsStillTyping();
                if (isStillTyping)
                {
                    //if previous sentence is still typing, speed up
                    screenMessage_Action.ChangeTypingGapTo(0f);
                }
                else
                {
                    //else, type next sentence
                    screenMessage_Action.ResetTypingGap();
                    screenMessage_Action.NpcConversation("", objectScript.npcDialogueList[j], messageLastTime: 3f);
                    j++;
                }
            }
            else if (stopConversation)
            {
                Debug.Log("stop it");
                screenMessage_Action.ShowMessage("", " :<", messageTime: 1.5f);
            }

            yield return(new WaitForSeconds(gapTime));
        }


        KeyListener.ContinueListeningKeys = false;
        isStillTalking = false;
    }
Пример #2
0
    IEnumerator doTeleport(float checkPeriod, Transform from, Transform to, Transform teleportTransform)
    {
        while (!jobDone)
        {
            if (keyListener.GetIsKeyPressed())
            {
                teleport_OneWay_Action.DoTeleport(from, to);
                //teleport_OneWay_Action.FollowAndExplode(teleportTransform, to,explodeAfterUse, followPlayerTeleport);
                jobDone = true;
                Debug.Log("teleport got key");
            }
            yield return(new WaitForSeconds(checkPeriod));
        }

        keyListener.ContinueListeningKeys = false;
    }