Esempio n. 1
0
 public override bool ActionStart()
 {
     state = SWA_STATE.PRE_APPLY;
     anim  = GetComponent <CompAnimation>();
     anim.SetTransition("ToAttack");
     anim.SetClipDuration("Attack", attack_duration);
     player = GetLinkedObject("target").GetComponent <CharactersManager>();
     //Interrupt player action
     return(true);
 }
Esempio n. 2
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);
        }
    }
Esempio n. 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);
        }
    }
Esempio n. 4
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);
    }