Beispiel #1
0
    private void ProcessEffective(SkillConfigData frameData)
    {
        if (frameData.Affecttype == AFFECT_TYPE_CURE)
        {
            string effectName = null;
            if (frameData.Effectname.Length > 0 && !frameData.Effectname.Equals(""))
            {
                var EffectNameAndParams = frameData.Effectname.Split('|');
                effectName = EffectNameAndParams[0];
            }

            if (_skillTpl.Targettype == TARGET_TYPE_SELF_TEAM)
            {
                List <Role> roles = _role.Map.GetRolesBySide(_role.Side);
                for (int i = 0; i < roles.Count; i++)
                {
                    Role role = roles[i];
                    if (InBombZone(_role.transform.position, role.transform.position))
                    {
                        if (effectName != null)
                        {
                            Vector2 pos = Vector2.zero;
                            if (frameData.Others.Length > 0)
                            {
                                pos.x = float.Parse(frameData.Others[0]);
                            }
                            if (frameData.Others.Length > 1)
                            {
                                pos.y = float.Parse(frameData.Others[1]);
                            }
                            role.AddEffect(SystemConsts.SKILL_EFF_PREFIX + effectName, pos);
                        }
                        role.DoSkillAffect(this);
                    }
                }
            }
            else if (_skillTpl.Targettype == TARGET_TYPE_SELF)
            {
                _role.DoSkillAffect(this);
            }
        }
        else if (frameData.Affecttype == AFFECT_TYPE_HURT)
        {
            bool inSightFlag = true;
            if (_skillTpl.Needinsight == 1)
            {
                inSightFlag = _role.IsFactTo(_targetRole.transform.position.x);
            }

            if (inSightFlag && InHurtZone(_role.transform.position, _targetRole))
            {
                Damage damage = _targetRole.DoSkillAffect(this);
                if (!damage.isMiss && frameData.Others.Length > 2)
                {
                    string hitEffect = frameData.Others[0];
                    float  offsetX   = float.Parse(frameData.Others[2]);
                    float  offsetY   = float.Parse(frameData.Others[3]);
                    _targetRole.addHitEffect(hitEffect, offsetX, offsetY, _role);
                }
            }
        }
        else if (frameData.Affecttype == AFFECT_TYPE_BUFF)
        {
            if (_skillTpl.Targettype == TARGET_TYPE_SELF_TEAM)
            {
                List <Role> roles = _role.Map.GetRolesBySide(_role.Side);
                for (int i = 0; i < roles.Count; i++)
                {
                    Role role = roles[i];
                    if (InBombZone(_role.transform.position, role.transform.position))
                    {
                        role.DoSkillAffect(this);
                    }
                }
            }
            else if (_skillTpl.Targettype == TARGET_TYPE_SELF)
            {
                _role.DoSkillAffect(this);
            }
        }
        else if (frameData.Affecttype == AFFECT_TYPE_SHOOT)
        {
            if (_skillTpl.Selecttype == UserSkillMgr.SELECT_TYPE_GROUND)
            {
                var action = new ShootToPoint(_role, _targetPoint, frameData, this);
                _role.Map.addAction(action);
            }
            else
            {
                Role to = _targetRole;
                if (to == null)
                {
                    to = UnityEngine.Object.FindObjectOfType <Monster>();
                }
                if (to != null)
                {
                    var action = new ShootToRoleAction(_role, to, frameData, this);
                    _role.Map.addAction(action);
                }
            }
        }
        else if (frameData.Affecttype == AFFECT_TYPE_SHELL)
        {
            var action = new ShellToAction(_role, _targetRole, _shellDest, this, frameData);
            _role.Map.addAction(action);
        }
        else if (frameData.Affecttype == AFFECT_TYPE_SHOOT_BOMB)
        {
            var action = new ShellToAction(_role, _targetRole, _lockPosition, this, frameData, true);
            _role.Map.addAction(action);
        }
        else if (frameData.Affecttype == AFFECT_TYPE_MULTI)
        {
            var action = new MultiGroundAttackAction(_role, _targetRole, this, frameData, _lockPosition);
            _role.Map.addAction(action);
            _canCancelAction = action;
        }
        else if (frameData.Affecttype == AFFECT_TYPE_RANDOM_SHOOT)
        {
            RandomShoot();
        }
    }