示例#1
0
    public override ACTION_RESULT ActionUpdate()
    {
        if (player.dying)
        {
            Debug.Log("DON'T ATTACK PLAYER", Department.PLAYER, Color.YELLOW);
            return(ACTION_RESULT.AR_FAIL); //Player is dead, don't attack
        }

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

            //Doing attack
            if (state == SWA_STATE.PRE_APPLY && anim_comp.IsAnimOverXTime(apply_damage_point))
            {
                state = SWA_STATE.POST_APPLY;
                if (player.GetDamage(damage) == true)
                {
                    GetComponent <CompAudio>().PlayEvent("SwordHit");
                }
            }
            else if (state == SWA_STATE.POST_APPLY && anim_comp.IsAnimationStopped("Attack"))
            {
                state = SWA_STATE.WAITING;
                return(ACTION_RESULT.AR_SUCCESS);
            }
            return(ACTION_RESULT.AR_IN_PROGRESS);
        }
        else
        {
            if (interupt == true)
            {
                return(ACTION_RESULT.AR_FAIL);
            }

            //Doing attack
            if (state == SWA_STATE.PRE_APPLY && anim_comp.IsAnimOverXTime(apply_damage_point))
            {
                state = SWA_STATE.POST_APPLY;
                if (player.GetDamage(damage) == true)
                {
                    GetComponent <CompAudio>().PlayEvent("SwordHit");
                }
            }
            else if (state == SWA_STATE.POST_APPLY && anim_comp.IsAnimationStopped("Attack"))
            {
                state = SWA_STATE.WAITING;
                return(ACTION_RESULT.AR_SUCCESS);
            }
            return(ACTION_RESULT.AR_IN_PROGRESS);
        }
    }
    public override ACTION_RESULT ActionUpdate()
    {
        if (comp_animation.IsAnimOverXTime(0.2f) && play_audio == false && GetComponent <EnemySpear_BT>() == null)
        {
            comp_audio.PlayEvent("Enemy_SwordDraw");
            play_audio = true;
        }

        if (comp_animation.IsAnimationStopped("Draw"))
        {
            return(ACTION_RESULT.AR_SUCCESS);
        }
        return(ACTION_RESULT.AR_IN_PROGRESS);
    }
示例#3
0
    public override ACTION_RESULT ActionUpdate()
    {
        // Debug.Log("[error]Is melee attack:" + melee_attack);
        if (melee_attack)
        {
            if (interupt == true)
            {
                return(ACTION_RESULT.AR_FAIL);
            }

            //Doing attack
            anim = GetComponent <CompAnimation>();
            if (state == SWA_STATE.PRE_APPLY && anim.IsAnimOverXTime(apply_damage_point))
            {
                state = SWA_STATE.POST_APPLY;
                player.GetDamage(damage);
                //Apply damage to the target
                //Play audio fx
            }
            else if (state == SWA_STATE.POST_APPLY && anim.IsAnimationStopped("Attack"))
            {
                state = SWA_STATE.WAITING;
                return(ACTION_RESULT.AR_SUCCESS);
            }
            return(ACTION_RESULT.AR_IN_PROGRESS);
        }
        else
        {
            if (interupt == true)
            {
                return(ACTION_RESULT.AR_FAIL);
            }

            //Doing attack
            anim = GetComponent <CompAnimation>();
            if (state == SWA_STATE.PRE_APPLY && anim.IsAnimOverXTime(apply_damage_point))
            {
                state = SWA_STATE.POST_APPLY;
                player.GetDamage(damage);
                //Apply damage to the target
                //Play audio fx
            }
            else if (state == SWA_STATE.POST_APPLY && anim.IsAnimationStopped("Attack"))
            {
                state = SWA_STATE.WAITING;
                return(ACTION_RESULT.AR_SUCCESS);
            }
            return(ACTION_RESULT.AR_IN_PROGRESS);
        }
    }