示例#1
0
    public override ACTION_RESULT ActionUpdate()
    {
        if (GetComponent <Movement_Action>().NextToPlayer() == true || interupt == true)
        {
            move.Interupt();
        }

        timer += Time.deltaTime;

        if (timer >= check_player_timer && move.CenteredInTile())
        {
            timer = 0.0f;
            move.GoToPlayer(chase_range);
        }

        ///Make Move update
        ACTION_RESULT move_return = move.ActionUpdate();

        if (move_return != ACTION_RESULT.AR_IN_PROGRESS)
        {
            move.ActionEnd();
        }

        return(move_return);
    }
示例#2
0
    public override ACTION_RESULT ActionUpdate()
    {
        if (forgot_event == true || move.NextToPlayer() == true || interupt == true)
        {
            move.Interupt();
        }

        if (forgot_event == false)
        {
            timer += Time.deltaTime;

            if (timer >= check_player_timer && move.CenteredInTile())
            {
                if (player.GetComponent <CharactersManager>().GetCurrentCharacterName() == "Jaime")
                {
                    comp_anim.PlayAnimationNode("Chase");
                    SetBlocking(false);
                    move.SetBlocking(false);
                }
                else
                {
                    SetBlocking(true);
                    move.SetBlocking(true);
                }

                timer = 0.0f;

                if (bt == GetComponent <EnemySpear_BT>())
                {
                    move.GoToPlayer(1);
                }
                else
                {
                    move.GoToPlayer((uint)bt.range);
                }
            }

            if (percep_sight.player_seen == false)
            {
                event_to_react.start_counting = true;
            }
            else
            {
                event_to_react.start_counting = false;
            }
        }
        ///Make Move update
        move_return = move.ActionUpdate();

        if (move_return != ACTION_RESULT.AR_IN_PROGRESS)
        {
            move.ActionEnd();
        }

        return(move_return);
    }
    public override ACTION_RESULT ActionUpdate()
    {
        if (interupt == true)
        {
            move.Interupt();
        }

        move_return = move.ActionUpdate();
        if (move_return != ACTION_RESULT.AR_IN_PROGRESS)
        {
            move.ActionEnd();
        }

        return(move_return);
    }
示例#4
0
    public override ACTION_RESULT ActionUpdate()
    {
        if (GetComponent <Movement_Action>().NextToPlayer() == true || interupt == true)
        {
            move.Interupt();
        }

        move.GoTo((int)destiny_tile_x, (int)destiny_tile_y);
        move_return = move.ActionUpdate();
        // Debug.Log("[error]Separate action move return:"+ move_return);


        if (move_return != ACTION_RESULT.AR_IN_PROGRESS)
        {
            move.ActionEnd();
        }


        return(move_return);
    }
示例#5
0
    public override ACTION_RESULT ActionUpdate()
    {
        switch (my_state)
        {
        case INVESTIGATESTATE.GOING_TO_INVESTIGATE:

            if (interupt)
            {
                GetComponent <Movement_Action>().Interupt();
            }

            ///Make Move update
            move_return = GetComponent <Movement_Action>().ActionUpdate();

            if (move_return == ACTION_RESULT.AR_SUCCESS)
            {
                my_state = INVESTIGATESTATE.INVESTIGATE;
                Debug.Log("Investigate");
            }

            if (move_return == ACTION_RESULT.AR_FAIL)
            {
                GetComponent <Movement_Action>().ActionEnd();
                return(ACTION_RESULT.AR_FAIL);
            }

            break;

        case INVESTIGATESTATE.INVESTIGATE:

            //Trigger investigate animation

            event_to_react.start_counting = true;

            if (forgot_event == true)
            {
                int current_tile_x = GetComponent <Movement_Action>().GetCurrentTileX();
                int current_tile_y = GetComponent <Movement_Action>().GetCurrentTileY();

                GetComponent <Movement_Action>().GoTo(init_tile_x, init_tile_y);

                if (!GetComponent <Movement_Action>().ActionStart())
                {
                    return(ACTION_RESULT.AR_FAIL);
                }

                my_state = INVESTIGATESTATE.RETURNING_TO_START;
            }

            if (interupt)
            {
                //Need to change to add more enemies
                return(ACTION_RESULT.AR_FAIL);
            }

            break;

        case INVESTIGATESTATE.RETURNING_TO_START:

            if (interupt)
            {
                GetComponent <Movement_Action>().Interupt();
            }

            move_return = GetComponent <Movement_Action>().ActionUpdate();

            if (move_return == ACTION_RESULT.AR_SUCCESS)
            {
                Debug.Log("Arrived home");
                return(ACTION_RESULT.AR_SUCCESS);
            }

            if (move_return == ACTION_RESULT.AR_FAIL)
            {
                GetComponent <Movement_Action>().ActionEnd();
                return(ACTION_RESULT.AR_FAIL);
            }

            break;
        }

        return(ACTION_RESULT.AR_IN_PROGRESS);
    }
    public override ACTION_RESULT ActionUpdate()
    {
        switch (my_state)
        {
        case INVESTIGATESTATE.INVESTIGATE:
            //Trigger investigate animation

            if (interupt)
            {
                interupt = false;
                return(ACTION_RESULT.AR_FAIL);
            }

            event_to_react.start_counting = true;

            if (forgot_event == true)
            {
                move.GoTo(init_tile_x, init_tile_y);

                //Lost something audio
                //TODO_AI: Ivestigation audio
                //GetComponent<CompAudio>().PlayEvent("Dracarys");

                my_state = INVESTIGATESTATE.RETURNING_TO_START;

                if (move.ActionStart() == false)
                {
                    return(ACTION_RESULT.AR_FAIL);
                }
            }

            return(ACTION_RESULT.AR_IN_PROGRESS);

        case INVESTIGATESTATE.GOING_TO_INVESTIGATE:
        case INVESTIGATESTATE.RETURNING_TO_START:

            if (interupt)
            {
                interupt = false;
                move.Interupt();
            }

            move_return = move.ActionUpdate();

            if (move_return != ACTION_RESULT.AR_IN_PROGRESS)
            {
                move.ActionEnd();

                if (move_return == ACTION_RESULT.AR_FAIL)
                {
                    return(move_return);
                }
                else
                {
                    if (my_state == INVESTIGATESTATE.GOING_TO_INVESTIGATE)
                    {
                        my_state = INVESTIGATESTATE.INVESTIGATE;
                    }
                    else
                    {
                        return(move_return);
                    }
                }
            }

            break;
        }

        return(ACTION_RESULT.AR_IN_PROGRESS);
    }