public void LineEnd()         // endof sent text.
    {
        switch (currentTalkState) ///NOTE: when line is over!!
        {
        case TalkingState.hello:  // starting pulls up menu!
            ChoiceScript c = GameObject.FindGameObjectWithTag("MainCanvas").GetComponent <MainCanvasScript>().GetDisplay("Choice").GetComponent <ChoiceScript>();
            c.NewChoice(menu, 0, gameObject, "ChoiceMade");
            currentTalkState = TalkingState.menu;
            break;

        case TalkingState.chat:                // chat over. event check.
            currentTalkState = TalkingState.none;
            break;

        case TalkingState.keyword:                // keyword over. event/quest check
            currentTalkState = TalkingState.none;
            break;

        case TalkingState.nevermind:                // end. thats all.
            currentTalkState = TalkingState.none;
            break;

        case TalkingState.none:
            Debug.LogError("Line end when not talking!!");
            break;
        }
    }
Beispiel #2
0
    /// <summary>
    /// Sets the state of the Player
    /// </summary>
    /// <param name="state">Which state to set</param>
    /// <exception cref="ArgumentOutOfRangeException"></exception>
    public void SetState(PlayerStates state)
    {
        PlayerBaseState playerState;

        switch (state)
        {
        case PlayerStates.Shoot:
            playerState = new ShootingState(this);
            break;

        case PlayerStates.Walking:
            playerState = new WalkingState(this);
            break;

        case PlayerStates.Talking:
            playerState = new TalkingState(this);
            break;

        case PlayerStates.Win:
            playerState = new WinState(this);
            break;

        default:
            throw new ArgumentOutOfRangeException(nameof(state), state, null);
        }

        _currentState?.ExitState();

        _currentState = playerState;

        _currentState.EnterState();
    }
    private void Awake()
    {
        m_playerCamera    = transform.parent.parent.GetComponentInChildren(typeof(Camera)) as Camera;
        m_stateMachine    = transform.parent.parent.GetComponentInChildren(typeof(StateMachine)) as StateMachine;
        m_inputController = transform.parent.parent.GetComponent(typeof(InputController)) as InputController;
        m_talkingNPC      = transform.parent.parent.GetComponent(typeof(TalkingNPC)) as TalkingNPC;

        m_talkingState = transform.parent.parent.Find("States").GetComponentInChildren(typeof(TalkingState)) as TalkingState;
    }
    private void SetTalkingState()
    {
        float myScreenSector = vizTrack.getCurrentScreenSector().x;
        float sectors        = gc.screenDivisions;

        if (myScreenSector < edgeSectorCount || sectors - myScreenSector <= edgeSectorCount)
        {
            myTalkStatus = TalkingState.WILLING_TO_CONVERSE;
        }
        else
        {
            myTalkStatus = TalkingState.TALKING_AMONG_SELVES;
        }
    }
 public void ChoiceMade(string s)
 {
     if (currentTalkState == TalkingState.menu)
     {
         if (s == chatOption)
         {
             // Event Check!
             bool end = true;
             // if event/quest, end = false;
             ///If no quest:
             dia.ChatStart(myName, chatLine, this.gameObject, end);                // chat line
             currentTalkState = TalkingState.chat;
             /// else hand off to quest!
         }
         else if (s == ShopOption)
         {
             // hand off to shoppingScript!!
             currentTalkState = TalkingState.none;
         }
         else if (s == keyOption)
         {
             dia.ChatStart(myName, keyLine, this.gameObject, false);                // ask about line.
             currentTalkState = TalkingState.keyword;
             // pull up keyword list.
         }
         else if (s == endOption)
         {
             dia.ChatStart(myName, nevermindLine, this.gameObject, true);                // send line. end.
             currentTalkState = TalkingState.none;
         }
         else
         {
             //for(int i = 0; i<quests.count;i++){
             // if(s == quest.QuestName){hand off to that script!}
             //}
             currentTalkState = TalkingState.none;
             // quest deeals with it now!
         }
     }
     else if (currentTalkState == TalkingState.keyword)
     {
         // check for keyword quest,
         //else :Check for event
         //check for text!
         dia.ChatStart(myName, "KeySTuff", this.gameObject, true);            // send line. end.
         currentTalkState = TalkingState.none;
     }
 }
    public void Interact()
    {
        if (isActiveAndEnabled)
        {
            if (dia == null)
            {
                dia = GameObject.FindGameObjectWithTag("GameController").GetComponent <ReadDialogueScript>();
            }
            // quest cycle+ check!
            // menu Setup
            menu = new List <string>();
            menu.Add(chatOption);
            // If shopscript, get it's line.
            menu.Add(keyOption);
            // IF ongoingQuest/TurnIn, getline(s)
            menu.Add(endOption);
            menu.Reverse();

            // if no auto...
            // send line to reader
            if (dia != null)
            {
                // send message.
                if (again)
                {
                    dia.ChatStart(myName, helloAgainLine, this.gameObject, false);
                }
                else
                {
                    dia.ChatStart(myName, helloLine, this.gameObject, false);
                }
                currentTalkState = TalkingState.hello;
            }
            else
            {
                Debug.LogError("ReadDialogueScript isn't on a thing w/ GameController tag!!");
            }                                                                                                    // just in case
        }
    }