Exemple #1
0
    public int CountHurtResult()
    {
        _currentStep   = 0;
        _frameCount    = 0;
        _stateWantToGo = AIAgent.STATE.NONE;
        float speedScale = ((float)_hitStrength) / 100;

#if PVP_ENABLED
        if (GameManager.Instance.IsPVPMode && _owner.ACOwner.IsClientPlayer)
        {
            //speedScale = 0.0f;
        }
#endif
        if (_owner.ACOwner.IsPlayerSelf && GameManager.Instance.IsPVPMode)
        {
            _hurtInfoForClient2.x = _hitDirection.x;
            _hurtInfoForClient2.y = _hitDirection.z;
            _hurtInfoForClient2.z = _effectTime;

            CommandManager.Instance.SendCommandToOthers(FCCommand.CMD.CLIENT_HURT,
                                                        _owner.ACOwner.ObjectID, _owner.ACOwner.ThisTransform.localPosition,
                                                        _hurtInfoForClient, FC_PARAM_TYPE.QUATERNION,
                                                        _hurtInfoForClient2, FC_PARAM_TYPE.QUATERNION,
                                                        null, FC_PARAM_TYPE.NONE);
        }

        if (!_owner.ACOwner.SelfMoveAgent.IsOnGround)
        {
            speedScale += 0.2f;
        }
        if (_currentHitType == AttackHitType.KnockDown)
        {
            _inSky = true;
            _owner.MoveByDirection(_hitDirection, _hitBackSpeed * speedScale, 99f, _hitBackDrag);
            if (_canBeHitDown)
            {
                _stateWantToGo = AIAgent.STATE.STAND;
            }
        }
        else if (_currentHitType == AttackHitType.KnockBack)
        {
            _owner.MoveByDirection(_hitDirection, _hitBackSpeed * speedScale, 99f, _hitBackDrag);
            if (_canBeHitFly)
            {
                _stateWantToGo = AIAgent.STATE.IDLE;
            }
        }
        else if (_currentHitType == AttackHitType.HitFly)
        {
            _inSky    = true;
            _isInFall = false;
            if (_canBeHitUp)
            {
                //Debug.LogError("FC_HIT_TYPE.UP" + Time.realtimeSinceStartup);
                //_owner.MoveByDirection(_hitDirection, _hitBackSpeed * speedScale, 1.2f, 0);
                //_owner.MoveByDirection(_hitDirection, 0.1f, 0.1f, 0);

                _owner.MoveByDirection(_hitDirection, _hitBackSpeed * speedScale, 99f, _hitBackDrag);

                _stateWantToGo = AIAgent.STATE.STAND;
                _owner.ACOwner.ACEffectByGravity(_hitUpSpeed, null, Vector3.up, 999, false, true);
            }
            else
            {
                _owner.MoveByDirection(_hitDirection, _hitBackSpeed * speedScale, 99f, _hitBackDrag);
            }
        }
        else if (_currentHitType == AttackHitType.HurtFlash)
        {
            _owner.MoveByDirection(_hitDirection, _flashHurtSpeed * speedScale, 1f, _hurtSpeedDrag);
        }
        else if (_currentHitType == AttackHitType.HurtNormal)
        {
            //Debug.Log("FC_HIT_TYPE.HURT_NORMAL _hitDirection = " + _hitDirection + ", _normalHurtSpeed :" +_normalHurtSpeed + ",speedScale : " + speedScale + " , _hurtSpeedDrag =" +_hurtSpeedDrag );
            _owner.MoveByDirection(_hitDirection, _normalHurtSpeed * speedScale, 1f, _hurtSpeedDrag);
        }
        else if (_currentHitType == AttackHitType.ParrySuccess)
        {
            _owner.MoveByDirection(_hitDirection, _parryBackSpeed * speedScale, 1f, _hurtSpeedDrag);
        }
        else if (_currentHitType == AttackHitType.ParryFail)
        {
            if (_sfxParryBreak != "")
            {
                SoundManager.Instance.PlaySoundEffect(_sfxParryBreak);
            }
            _owner.MoveByDirection(_hitDirection, _parryFailSpeed * speedScale, 0.3f, 6f);
        }
        else if (_currentHitType == AttackHitType.Dizzy)
        {
            _owner.StopMove();
        }
        else if (_currentHitType == AttackHitType.ForceBack)
        {
            //			if(_owner.ACOwner.IsClientPlayer)
            //			{
            //				_owner.MoveByDirection(_hitDirection,_normalHurtSpeed*speedScale,0.2f,_hurtSpeedDrag);
            //			}
            //			else
            //			{
            _owner.StopMove();
            //		}
        }
        else if (_currentHitType == AttackHitType.BlackHole)
        {
            _owner.StopMove();
        }
#if xingtianbo
        //else if(_currentHitType == AttackHitType.KnockDown)
        //{
        //    _owner.StopMove();
        //    _stateWantToGo = AIAgent.STATE.STAND;
        //}
#endif
        else
        {
            _owner.StopMove();
        }
        _currentStep = 1;
        _owner.IncreaseRage(RageAgent.RageEvent.HURT, _attackerType);

        return((int)_currentHitType);
    }