public override bool ActionStart()
    {
        player = GetLinkedObject("target").GetComponent <CharactersManager>();

        if (player == null)
        {
            Debug.Log("[error] Attack Action Start: Player is null!");
        }

        anim_comp  = GetComponent <CompAnimation>();
        audio_comp = GetComponent <CompAudio>();

        if (player.dying == false)
        {
            anim_comp.SetClipDuration("Attack", attack_duration);
            anim_comp.PlayAnimationNode("Attack");
            Debug.Log("Back to Attack", Department.IA);
            audio_comp.PlayEvent("Enemy1_Slash");
        }


        damage_done   = false;
        shield_attack = false;

        //Interrupt player action
        return(true);
    }
Exemple #2
0
    public override bool ActionStart()
    {
        Debug.Log("PUSH ANIMATION", Department.PHYSICS, Color.ORANGE);
        arrive_comp = GetComponent <Arrive_Steering>();
        GetComponent <Align_Steering>().SetEnabled(false);
        Movement_Action.Direction dir = GetComponent <Movement_Action>().GetDirection();

        move      = GetComponent <Movement_Action>();
        anim_comp = GetComponent <CompAnimation>();

        GetComponent <PerceptionSightEnemy>().GetPlayerTilePos(out int player_x, out int player_y);
        int tile_x = move.GetCurrentTileX();
        int tile_y = move.GetCurrentTileY();

        int dif_x = player_x - tile_x;
        int dif_y = player_y - tile_y;

        animation_clip_push = "Push";
        anim_comp.PlayAnimationNode("Push");

        target_x = move.GetCurrentTileX();
        target_y = move.GetCurrentTileY();

        target_x += (int)push_direction.x;
        target_y += (int)push_direction.z;

        return(true);
    }
Exemple #3
0
 public override bool ActionStart()
 {
     animator.PlayAnimationNode("BlockIdle");
     blocking     = true;
     current_time = 0.0f;
     return(true);
 }
 public override bool ActionStart()
 {
     comp_animation = GetComponent <CompAnimation>();
     comp_audio     = GetComponent <CompAudio>();
     comp_animation.PlayAnimationNode("Draw");
     comp_animation.SetClipDuration("Draw", duration);
     return(true);
 }
Exemple #5
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);
    }
Exemple #6
0
 public override bool ActionStart()
 {
     GetComponent <Align_Steering>().SetEnabled(false);
     GetComponent <Arrive_Steering>().SetEnabled(false);
     GetComponent <Seek_Steering>().SetEnabled(false);
     //GetComponent<CompAnimation>().SetTransition("ToStun");
     anim_comp = GetComponent <CompAnimation>();
     anim_comp.SetClipDuration("Stun", stun_duration);
     anim_comp.PlayAnimationNode("Stun");
     return(true);
 }
    public override bool ActionStart()
    {
        anim_comp  = GetComponent <CompAnimation>();
        audio_comp = GetComponent <CompAudio>();

        anim_comp.PlayAnimationNode("Die");
        //TODO_AI: Die audio
        audio_comp.PlayEvent("Enemy_SwordDrop");

        //PLAY COMBAT MUSIC
        Audio.ChangeState("MusicState", "None");
        GetLinkedObject("event_manager").GetComponent <PerceptionManager>().player_seen = false;
        Debug.Log("COMBAT OFF", Department.PLAYER, Color.BLUE);

        StatsScore.KillEnemy();

        //Play Dead Audio
        if (GetComponent <EnemyShield_BT>() != null)
        {
            audio_comp.PlayEvent("Enemy3_Dead");
        }
        else if (GetComponent <EnemySpear_BT>() != null)
        {
            audio_comp.PlayEvent("Enemy2_Dead");
        }
        else if (GetComponent <EnemySword_BT>() != null)
        {
            audio_comp.PlayEvent("Enemy1_Dead");
        }

        //Deactivate Listener
        if (GetComponent <SpearGuard_Listener>() != null)
        {
            GetComponent <SpearGuard_Listener>().SetEnabled(false);
        }
        else if (GetComponent <ShieldGuard_Listener>() != null)
        {
            GetComponent <ShieldGuard_Listener>().SetEnabled(false);
        }
        else if (GetComponent <SwordGuard_Listener>() != null)
        {
            GetComponent <SwordGuard_Listener>().SetEnabled(false);
        }

        anim_comp.SetClipDuration("Die", duration);
        GetComponent <CompCollider>().CollisionActive(false);
        return(true);
    }
Exemple #8
0
    public override bool ActionStart()
    {
        state     = SWA_STATE.PRE_APPLY;
        anim_comp = GetComponent <CompAnimation>();

        player = GetLinkedObject("target").GetComponent <CharactersManager>();


        if (player.dying == false)
        {
            anim_comp.SetClipDuration("Attack", attack_duration);
            anim_comp.PlayAnimationNode("Attack");
            GetComponent <CompAudio>().PlayEvent("Enemy2_Slash");
        }

        //Interrupt player action
        return(true);
    }
    public override bool ActionStart()
    {
        interupt = false;

        /*CompAudio audio = GetComponent<CompAudio>();
         * audio.PlayEvent("Enemy2_Hurt");
         * audio.PlayEvent("SwordHit");*/
        move       = GetComponent <Movement_Action>();
        anim_comp  = GetComponent <CompAnimation>();
        audio_comp = GetComponent <CompAudio>();


        if (next_dmg_type == Enemy_BT.ENEMY_GET_DAMAGE_TYPE.DEFAULT)
        {
            int tile_x              = move.GetCurrentTileX();
            int tile_y              = move.GetCurrentTileY();
            int player_x            = tile_x;
            int player_y            = tile_y;
            MovementController temp = GetLinkedObject("player_obj").GetComponent <MovementController>();
            if (temp != null)
            {
                temp.GetPlayerPos(out int x, out int y);
                player_x = x;
                player_y = y;
            }

            int dif_x = player_x - tile_x;
            int dif_y = player_y - tile_y;

            Movement_Action.Direction dir = move.GetDirection();

            switch (dir)
            {
            case Movement_Action.Direction.DIR_EAST:
                if (dif_x < 0)
                {
                    animation_clip = "HitBack";
                    anim_comp.PlayAnimationNode("HitBack");
                }
                else if (dif_x > 0)
                {
                    animation_clip = "HitFront";
                    anim_comp.PlayAnimationNode("HitFront");
                }
                else if (dif_y < 0)
                {
                    animation_clip = "HitLeft";
                    anim_comp.PlayAnimationNode("HitLeft");
                }
                else if (dif_y > 0)
                {
                    animation_clip = "HitRight";
                    anim_comp.PlayAnimationNode("HitRight");
                }
                break;

            case Movement_Action.Direction.DIR_NORTH:
                if (dif_x < 0)
                {
                    animation_clip = "HitLeft";
                    anim_comp.PlayAnimationNode("HitLeft");
                }
                else if (dif_x > 0)
                {
                    animation_clip = "HitRight";
                    anim_comp.PlayAnimationNode("HitRight");
                }
                else if (dif_y < 0)
                {
                    animation_clip = "HitFront";
                    anim_comp.PlayAnimationNode("HitFront");
                }
                else if (dif_y > 0)
                {
                    animation_clip = "HitBack";
                    anim_comp.PlayAnimationNode("HitBack");
                }
                break;

            case Movement_Action.Direction.DIR_SOUTH:
                if (dif_x < 0)
                {
                    animation_clip = "HitRight";
                    anim_comp.PlayAnimationNode("HitRight");
                }
                else if (dif_x > 0)
                {
                    animation_clip = "HitLeft";
                    anim_comp.PlayAnimationNode("HitLeft");
                }
                else if (dif_y < 0)
                {
                    animation_clip = "HitBack";
                    anim_comp.PlayAnimationNode("HitBack");
                }
                else if (dif_y > 0)
                {
                    animation_clip = "HitFront";
                    anim_comp.PlayAnimationNode("HitFront");
                }
                break;

            case Movement_Action.Direction.DIR_WEST:
                if (dif_x < 0)
                {
                    animation_clip = "HitFront";
                    anim_comp.PlayAnimationNode("HitFront");
                }
                else if (dif_x > 0)
                {
                    animation_clip = "HitBack";
                    anim_comp.PlayAnimationNode("HitBack");
                }
                else if (dif_y < 0)
                {
                    animation_clip = "HitRight";
                    anim_comp.PlayAnimationNode("HitRight");
                }
                else if (dif_y > 0)
                {
                    animation_clip = "HitLeft";
                    anim_comp.PlayAnimationNode("HitLeft");
                }
                break;
            }
        }

        else if (next_dmg_type == Enemy_BT.ENEMY_GET_DAMAGE_TYPE.FIREWALL)
        {
            animation_clip = "HitFire";
            anim_comp.PlayAnimationNode("HitFire");
        }

        anim_comp.SetClipDuration(animation_clip, duration);
        //TODO_AI: Hurt audio
        //GetComponent<CompAudio>().PlayEvent("JaimeHurt");
        return(true);
    }
    public override bool ActionStart()
    {
        if (chase == false)
        {
            anim_comp.PlayAnimationNode("Patrol");
            anim_comp.SetFirstActiveBlendingClip("Idle");
        }
        else
        {
            anim_comp.PlayAnimationNode("Chase");
            anim_comp.SetFirstActiveBlendingClip("IdleAttack");

            if (moving_sideways == true)
            {
                MoveSideways(path[0]);
            }
        }

        if (path.Count != 0)
        {
            tile = new PathNode(0, 0);
            tile.SetCoords(path[0].GetTileX(), path[0].GetTileY());
        }

        fx_played = false;

        return(true);
    }