예제 #1
0
 private void Neutral_Request_AskPlayerToStandStill()
 {
     Debug.LogError("about to close doors in cell standstill");
     maze.CloseDoorsInCell(playerCurrentCoords);
     currentInterchange = new StayStillInterchange(aiAlignmentState);
     SendMessageToPlayer(currentInterchange.GetQuestionText(), stillnessTimedComm);
 }
예제 #2
0
    //Hostile AI actions
    #region

    private void Hostile_Request_LockPlayerInRoom()
    {
        Debug.LogError("about to close doors in cell LockPlayerInRoom");
        maze.CloseDoorsInCell(playerCurrentCoords);
        var interchange = new LockPlayerInRoomInterchange(aiAlignmentState);

        interchange.timeLocked = 5.0f;
        currentInterchange     = interchange;

        oneWayTimedComm.SetTimeToWait(5.0f);

        SendMessageToPlayer(currentInterchange.GetQuestionText(), oneWayTimedComm);
    }
예제 #3
0
    //useful for restarting the game. destroy everything the AI could have active
    public void HaltAllActivityAndSelfDestruct()
    {
        if (currentCommChannel != null)
        {
            currentCommChannel.EndCommuncation();
        }

        if (currentInterchange != null)
        {
            currentInterchange = null;
        }

        Destroy(gameObject);
    }
예제 #4
0
    /// <summary>
    /// Handle a response from a communcation channel (to be expanded)
    /// </summary>
    /// <param name="response"></param>
    private void HandleResponse(PlayerResponse response)
    {
        if (!openingDone)
        {
            openingDone = true;
            maze.OpenDoorsInCell(playerCurrentCoords);
        }


        //if there was no interchange, no response was expected, so do nothing
        if (currentInterchange == null)
        {
            return;
        }
        //otherwise, check response, change state, and respond as needed
        else
        {
            //reopen doors if they were closed
            maze.OpenDoorsInCell(playerCurrentCoords);

            ThreeState wasResponseCorrect = currentInterchange.CheckIfCorrectResponse(response);
            Debug.Log(wasResponseCorrect.ToBool());
            Debug.Log(response.responseStr);
            string responseText = currentInterchange.GetResponseToPlayerText(wasResponseCorrect.ToBool());
            SendMessageToPlayer(responseText, oneWayCommChannel);

            //ending condition for veryhostile
            if (aiAlignmentState == AIAlignmentState.VeryHostile)
            {
                if (wasResponseCorrect == ThreeState.True)
                {
                    AscendPlayer();
                    gameOver = true;
                }
                else
                {
                    ReduceMazeToOneRoom();
                }
            }
            //otherwise do state transition if need be
            else if (wasResponseCorrect != ThreeState.Neutral &&
                     !aiAlignmentState.ToString().StartsWith("Very"))
            {
                StateTransition(wasResponseCorrect.ToBool());
            }

            //reset current interchange to get caught by above conditional.
            currentInterchange = null;
        }
    }
예제 #5
0
    /// <summary>
    /// Given a generic text interchange object, executes the interchange on the 2 way commchannel
    /// and closes doors on the player
    /// </summary>
    /// <param name="interchange"></param>
    private void ExecTextInterchange(GenericTextInterchange interchange)
    {
        if (interchange == null)
        {
            Debug.LogError("interchange was null in ExecTextInterchange");
            return;
        }

        Debug.LogError("about to close doors in cell exectextinterchange");
        maze.CloseDoorsInCell(playerCurrentCoords);

        currentInterchange = interchange;

        SendMessageToPlayer(currentInterchange.GetQuestionText(), textCommChannel);
    }
예제 #6
0
 private void RequestPlayerToFollowPath(PathInterchange pathInterchange, PathCommuncationChannel channel)
 {
     currentInterchange = pathInterchange;
     channel.SetPathForPlayer(pathInterchange.expectedResponse.playerPath);
     SendMessageToPlayer(pathInterchange.GetQuestionText(), channel);
 }
예제 #7
0
    //useful for restarting the game. destroy everything the AI could have active
    public void HaltAllActivityAndSelfDestruct() {
        if (currentCommChannel != null) {
            currentCommChannel.EndCommuncation();
        }

        if (currentInterchange != null) {
            currentInterchange = null;
        }

        Destroy(gameObject);
    }
예제 #8
0
    //Hostile AI actions
    #region

    private void Hostile_Request_LockPlayerInRoom() {
        Debug.LogError("about to close doors in cell LockPlayerInRoom");
        maze.CloseDoorsInCell(playerCurrentCoords);
        var interchange = new LockPlayerInRoomInterchange(aiAlignmentState);
        interchange.timeLocked = 5.0f;
        currentInterchange = interchange;

        oneWayTimedComm.SetTimeToWait(5.0f);

        SendMessageToPlayer(currentInterchange.GetQuestionText(), oneWayTimedComm);
    }
예제 #9
0
 private void Neutral_Request_AskPlayerToStandStill() {
     Debug.LogError("about to close doors in cell standstill");
     maze.CloseDoorsInCell(playerCurrentCoords);
     currentInterchange = new StayStillInterchange(aiAlignmentState);
     SendMessageToPlayer(currentInterchange.GetQuestionText(), stillnessTimedComm);
 }
예제 #10
0
    /// <summary>
    /// Given a generic text interchange object, executes the interchange on the 2 way commchannel
    /// and closes doors on the player
    /// </summary>
    /// <param name="interchange"></param>
    private void ExecTextInterchange(GenericTextInterchange interchange) {
        if (interchange == null) {
            Debug.LogError("interchange was null in ExecTextInterchange");
            return;
        }

        Debug.LogError("about to close doors in cell exectextinterchange");
        maze.CloseDoorsInCell(playerCurrentCoords);

        currentInterchange = interchange;

        SendMessageToPlayer(currentInterchange.GetQuestionText(), textCommChannel);
    }
예제 #11
0
    private void RequestPlayerToFollowPath(PathInterchange pathInterchange, PathCommuncationChannel channel) {
        currentInterchange = pathInterchange;
        channel.SetPathForPlayer(pathInterchange.expectedResponse.playerPath);
        SendMessageToPlayer(pathInterchange.GetQuestionText(), channel);

    }
예제 #12
0
    /// <summary>
    /// Handle a response from a communcation channel (to be expanded)
    /// </summary>
    /// <param name="response"></param>
    private void HandleResponse(PlayerResponse response) {
        if (!openingDone) {
            openingDone = true;
            maze.OpenDoorsInCell(playerCurrentCoords);
        }


        //if there was no interchange, no response was expected, so do nothing
        if (currentInterchange == null) {
            return;
        }
        //otherwise, check response, change state, and respond as needed
        else {
            //reopen doors if they were closed
            maze.OpenDoorsInCell(playerCurrentCoords);

            ThreeState wasResponseCorrect = currentInterchange.CheckIfCorrectResponse(response);
            Debug.Log(wasResponseCorrect.ToBool());
            Debug.Log(response.responseStr);
            string responseText = currentInterchange.GetResponseToPlayerText(wasResponseCorrect.ToBool());
            SendMessageToPlayer(responseText, oneWayCommChannel);

            //ending condition for veryhostile
            if (aiAlignmentState == AIAlignmentState.VeryHostile) {
                
                if (wasResponseCorrect == ThreeState.True) {
                    AscendPlayer();
                    gameOver = true;
                }
                else {
                    ReduceMazeToOneRoom();

                }
            }
            //otherwise do state transition if need be
            else if (wasResponseCorrect != ThreeState.Neutral && 
                !aiAlignmentState.ToString().StartsWith("Very")) {
                StateTransition(wasResponseCorrect.ToBool());
            }
            
            //reset current interchange to get caught by above conditional.
            currentInterchange = null;
        }
    }