Пример #1
0
    public override bool HandleCommand(ref FCCommand ewd)
    {
        switch (ewd._cmd)
        {
        case FCCommand.CMD.ATTACK_HIT_TARGET:
        {
            ActionController target = ewd._param1 as ActionController;
            HandleHitTarget.HandleHit(_owner, this, _damageType, target);

            if (GetAttackInfo()._hitType == AttackHitType.ForceBack)
            {
                AIAgent aiAgent = _owner.gameObject.GetComponentInChildren <AIAgent>();
                if (aiAgent != null)
                {
                    aiAgent.AddHitBackList(target);
                }
            }
            if (_hitSound != "")
            {
                SoundManager.Instance.PlaySoundEffect(_hitSound);
            }
        }
        break;

        case FCCommand.CMD.ATTACK_OUT_OF_RANGE:
        {
            ActionController target = ewd._param1 as ActionController;

            if (GetAttackInfo()._hitType == AttackHitType.ForceBack)
            {
                AIAgent aiAgent = _owner.gameObject.GetComponentInChildren <AIAgent>();
                if (aiAgent != null)
                {
                    if (!GameManager.Instance.IsPVPMode)
                    {
                        aiAgent.RemoveHitBackList(target);
                    }
                }
            }
        }
        break;
        }
        return(true);
    }