Exemplo n.º 1
0
    /*
     * Attack Action
     */
    protected IEnumerator Action_Attack(Actor target, ElementType attackKind)
    {
        SendMessage("OnPreAttack", SendMessageOptions.DontRequireReceiver);

        GUIManager.GetManager().DebugMessage("[Actor][Attack]" + charName + " attacks " + target.charName );

        GUIManager.GetManager().Message(charName + " は " + target.charName + " に こうげき!" );

        FaceDirection( (target.step.index > step.index) ? DirectionType.LEFT : DirectionType.RIGHT);
        string animName = (target.step.index > step.index) ? "AttackLeft" : "AttackRight";
        spriteAnim.Play(animName);

        yield return new WaitForSeconds(0.3f);

        bool alive = true;

        if(TestAttackHit(target, armedWeapon)) {
            alive = ItemEntity.AttackBy(armedWeapon, target, this, 1.0f);
            effects.Spawn(AttackEffect, target.transform.position + effectOffset);
            while(target.gauge.IsAnimating) {
                yield return new WaitForEndOfFrame();
            }

            if(!alive) {
                _BeatActor(target);
                yield return new WaitForSeconds(0.3f);
            }
        } else {
            target._ActivateDuck();
        }

        SendMessage("OnPostAttack", SendMessageOptions.DontRequireReceiver);

        GetHungerAfterAction(ActionType.Attack);

        m_isOnActionNow = false;
    }