Esempio n. 1
0
    public void TriggerPlayerSeenEvent(float time_in_memory, int player_x, int player_y, GameObject enemy_who_saw, int enemy_x, int enemy_y)
    {
        PerceptionPlayerSeenEvent new_event = new PerceptionPlayerSeenEvent(time_in_memory, player_x, player_y, enemy_who_saw);

        new_event.SetOrigin(enemy_x, enemy_y);
        new_event.SetDestiny(player_x, player_y);

        event_manager.GetComponent <PerceptionManager>().GenEvent(new_event);
    }
Esempio n. 2
0
    public override void OnEventRecieved(PerceptionEvent event_recieved)
    {
        if (IsPriotitaryEvent(event_recieved) == true)
        {
            ClearEvents();
        }
        else
        {
            return;
        }

        switch (event_recieved.type)
        {
        case PERCEPTION_EVENT_TYPE.HEAR_EXPLORER_EVENT:
        case PERCEPTION_EVENT_TYPE.HEAR_WALKING_PLAYER:
            PerceptionHearEvent tmp = (PerceptionHearEvent)event_recieved;

            if (OnHearRange(tmp) && GetComponent <EnemyShield_BT>().InCombat() == false)
            {
                PerceptionHearEvent event_to_memory = new PerceptionHearEvent(tmp);
                GetComponent <EnemyShield_BT>().heard_something  = true;
                GetComponent <Investigate_Action>().forgot_event = false;
                GetComponent <Investigate_Action>().SetEvent(event_to_memory);
                GetComponent <EnemyShield_BT>().InterruptAction();
                GetComponent <EnemyShield_BT>().SetAction(Action.ACTION_TYPE.INVESTIGATE_ACTION);
                events_in_memory.Add(event_to_memory);
                event_to_memory.start_counting = false;
            }
            break;

        case PERCEPTION_EVENT_TYPE.PLAYER_SEEN:

            PerceptionPlayerSeenEvent seen_event_tmp = (PerceptionPlayerSeenEvent)event_recieved;

            if (gameObject == seen_event_tmp.enemy_who_saw)
            {
                GetComponent <EnemyShield_BT>().InterruptAction();
                GetComponent <EnemyShield_BT>().player_detected = true;

                if (GetComponent <EnemyShield_BT>().InCombat() == false)
                {
                    GetComponent <EnemyShield_BT>().SetAction(Action.ACTION_TYPE.ENGAGE_ACTION);
                }

                player_seen = true;

                PerceptionPlayerSeenEvent new_event_to_memory = new PerceptionPlayerSeenEvent(seen_event_tmp);
                events_in_memory.Add(new_event_to_memory);
                GetComponent <ChasePlayer_Action>().SetEvent(new_event_to_memory);
                GetComponent <ChasePlayer_Action>().forgot_event = false;
                new_event_to_memory.start_counting = false;
            }
            break;
        }
    }
    public override void OnEventRecieved(PerceptionEvent event_recieved)
    {
        if (IsPriotitaryEvent(event_recieved) == true)
        {
            ClearEvents();
        }
        else
        {
            return;
        }

        switch (event_recieved.type)
        {
        case PERCEPTION_EVENT_TYPE.HEAR_EXPLORER_EVENT:
        case PERCEPTION_EVENT_TYPE.HEAR_WALKING_PLAYER:

            break;

        case PERCEPTION_EVENT_TYPE.PLAYER_SEEN:

            PerceptionPlayerSeenEvent seen_event_tmp = (PerceptionPlayerSeenEvent)event_recieved;


            if (gameObject.IsEquals(seen_event_tmp.enemy_who_saw))
            {
                GetComponent <Boss_BT>().InterruptAction();
                GetComponent <Boss_BT>().player_detected = true;

                if (GetComponent <Boss_BT>().InCombat() == false)
                {
                    GetComponent <Boss_BT>().SetAction(Action.ACTION_TYPE.ENGAGE_ACTION);
                }

                GetComponent <ChasePlayer_Action>().SetInterupt(false);

                player_seen = true;

                PerceptionPlayerSeenEvent new_event_to_memory = new PerceptionPlayerSeenEvent(seen_event_tmp);
                events_in_memory.Add(new_event_to_memory);
                GetComponent <ChasePlayer_Action>().SetEvent(new_event_to_memory);
                GetComponent <ChasePlayer_Action>().forgot_event = false;
                new_event_to_memory.start_counting = false;
            }
            break;
        }
    }
 public PerceptionPlayerSeenEvent(PerceptionPlayerSeenEvent e) : base(e)
 {
     player_seen_in_x = e.player_seen_in_x;
     player_seen_in_y = e.player_seen_in_y;
     enemy_who_saw    = e.enemy_who_saw;
 }
Esempio n. 5
0
    public override void OnEventRecieved(PerceptionEvent event_recieved)
    {
        if (IsPriotitaryEvent(event_recieved) == true)
        {
            ClearEvents();
        }
        else
        {
            return;
        }

        switch (event_recieved.type)
        {
        case PERCEPTION_EVENT_TYPE.HEAR_EXPLORER_EVENT:
        case PERCEPTION_EVENT_TYPE.HEAR_WALKING_PLAYER:
            PerceptionHearEvent tmp = (PerceptionHearEvent)event_recieved;

            if (OnHearRange(tmp) && GetComponent <EnemySword_BT>().InCombat() == false)
            {
                PerceptionHearEvent event_to_memory = new PerceptionHearEvent(tmp);
                GetComponent <EnemySword_BT>().heard_something   = true;
                GetComponent <Investigate_Action>().forgot_event = false;
                GetComponent <Investigate_Action>().SetEvent(event_to_memory);
                GetComponent <EnemySword_BT>().InterruptAction();
                GetComponent <EnemySword_BT>().SetAction(Action.ACTION_TYPE.INVESTIGATE_ACTION);
                events_in_memory.Add(event_to_memory);
                event_to_memory.start_counting = false;
            }
            break;

        case PERCEPTION_EVENT_TYPE.PLAYER_SEEN:

            PerceptionPlayerSeenEvent seen_event_tmp = (PerceptionPlayerSeenEvent)event_recieved;


            if (gameObject.IsEquals(seen_event_tmp.enemy_who_saw))
            {
                if (GetLinkedObject("event_manager").GetComponent <PerceptionManager>().player_seen == false)
                {
                    //PLAY COMBAT MUSIC
                    Audio.ChangeState("MusicState", "Combat");
                    if (Audio.prank)
                    {
                        Audio.ChangeState("MusicState", "AlternateCombat");
                    }
                    GetLinkedObject("event_manager").GetComponent <PerceptionManager>().player_seen = true;
                    Debug.Log("COMBAT ON", Department.PLAYER, Color.ORANGE);
                }

                GetComponent <EnemySword_BT>().InterruptAction();
                GetComponent <EnemySword_BT>().player_detected = true;

                if (GetComponent <EnemySword_BT>().InCombat() == false)
                {
                    GetComponent <EnemySword_BT>().SetAction(Action.ACTION_TYPE.ENGAGE_ACTION);
                }

                GetComponent <ChasePlayer_Action>().SetInterupt(false);

                player_seen = true;

                PerceptionPlayerSeenEvent new_event_to_memory = new PerceptionPlayerSeenEvent(seen_event_tmp);
                events_in_memory.Add(new_event_to_memory);
                GetComponent <ChasePlayer_Action>().SetEvent(new_event_to_memory);
                GetComponent <ChasePlayer_Action>().forgot_event = false;
                new_event_to_memory.start_counting = false;
            }
            break;
        }
    }