Esempio n. 1
0
 public void Begin(ISkillHoster hoster, XHitData data, Vector3 dir, bool bAttackOnHitDown)
 {
     if (_attr != null)
     {
         _attr.Begin(hoster, data, dir, bAttackOnHitDown);
     }
 }
Esempio n. 2
0
 public void Begin(ISkillHoster hoster, XHitData data, Vector3 dir, bool bAttackOnHitDown)
 {
     if (_attr != null && _entity.CurState != XStateDefine.XState_Death)
     {
         _entity.OnHit(true);
         _attr.Begin(hoster, data, dir, bAttackOnHitDown);
     }
 }
Esempio n. 3
0
    public void Cancel()
    {
        elapsed = 0;
        rticalV = 0;
        gravity = 0;
        data    = null;
        hoster  = null;

        ator.speed = 1;
        DestroyFx();
        //ator.SetTrigger(AnimTriger.EndSkill);
        ator.SetTrigger(AnimTriger.ToStand);
    }
Esempio n. 4
0
 public XSkillAttributes(ISkillHoster host, Transform tran)
 {
     _tranform = tran;
     skills.Clear();
     skillResult  = new XSkillResult(host);
     skillMob     = new XSkillMob(host);
     skillFx      = new XSkillFx(host);
     skillManip   = new XSkillManipulate(host);
     skillWarning = new XSkillWarning(host);
     skills.Add(skillResult);
     skills.Add(skillMob);
     skills.Add(skillFx);
     skills.Add(skillManip);
     skills.Add(skillWarning);
 }
Esempio n. 5
0
    public XBulletData(ISkillHoster firer, XSkillData data, GameObject target, int idx, float diviation, int wid, IHitHoster[] hits)
    {
        _sequnce     = idx;
        _data        = data;
        _hoster      = firer;
        _hits        = hits;
        _warning_pos = Vector3.zero;

        if (data.Result[idx].Attack_All)
        {
            _warning_pos = target.transform.position;
        }
        else if (data.Result[idx].Warning)
        {
            _warning_pos = firer.Attribute.skillWarning.warningPosAt[data.Result[idx].Warning_Idx][wid];
        }

        _warning = _warning_pos.sqrMagnitude > 0;
        float   height = _hoster.Present_data.BoundHeight;
        Vector3 begin  = _hoster.Transform.position; begin.y += height * 0.5f;
        Vector3 dir    = _warning ? (_warning_pos - _hoster.Transform.position) : firer.Transform.forward;

        begin += firer.Transform.rotation * new Vector3(
            data.Result[idx].LongAttackData.At_X,
            data.Result[idx].LongAttackData.At_Y,
            data.Result[idx].LongAttackData.At_Z);
        dir.y = 0;
        Vector3 flyTo = XCommon.singleton.HorizontalRotateVetor3(dir.normalized, diviation);
        float   h     = (_data.Result[_sequnce].LongAttackData.AimTargetCenter && firer.Target != null) ? (begin.y - height * 0.5f) : 0;

        _velocity = Warning ? (WarningPos - begin).magnitude / Runningtime : _data.Result[_sequnce].LongAttackData.Velocity;
        flyTo     = (h == 0 || _velocity == 0) ? flyTo : (h * Vector3.down + _velocity * Runningtime * flyTo).normalized;

        BulletRay = new Ray(begin, flyTo);
        _target   = _data.Result[_sequnce].LongAttackData.Follow ? firer.Target : null;
    }
Esempio n. 6
0
    public void Begin(ISkillHoster host, XHitData da, Vector3 d, bool bAttackOnHitDown)
    {
        if (da.State == XBeHitState.Hit_Free)
        {
            return;
        }
        hoster        = host;
        deltaH        = transform.position.y;
        data          = da;
        change_to_fly = (data.State == XBeHitState.Hit_Back || data.State == XBeHitState.Hit_Roll) && deltaH > 0.1f;

        DestroyFx();
        BuildAnimation(data);

        if (data.State == XBeHitState.Hit_Freezed)
        {
            time_total = data.FreezeDuration;
            present_animation_factor = 1;
        }
        else
        {
            float OffsetTimeScale_Offset  = 1;
            float OffsetTimeScale_Height  = 1;
            float OffsetTimeScale_Present = 1;
            float OffsetTimeScale_Hard    = 1;

            switch (data.State)
            {
            case XBeHitState.Hit_Back:
                if (change_to_fly)
                {
                    OffsetTimeScale_Offset  = present.HitFlyOffsetTimeScale[0] == 0 ? 1 : present.HitFlyOffsetTimeScale[0];
                    OffsetTimeScale_Height  = present.HitFlyOffsetTimeScale[1] == 0 ? 1 : present.HitFlyOffsetTimeScale[1];
                    OffsetTimeScale_Present = present.HitFlyOffsetTimeScale[2] == 0 ? 1 : present.HitFlyOffsetTimeScale[2];
                    OffsetTimeScale_Hard    = present.HitFlyOffsetTimeScale[3] == 0 ? 1 : present.HitFlyOffsetTimeScale[3];
                }
                else
                {
                    OffsetTimeScale_Offset  = present.HitBackOffsetTimeScale[0] == 0 ? 1 : present.HitBackOffsetTimeScale[0];
                    OffsetTimeScale_Present = present.HitBackOffsetTimeScale[1] == 0 ? 1 : present.HitBackOffsetTimeScale[1];
                    OffsetTimeScale_Hard    = present.HitBackOffsetTimeScale[2] == 0 ? 1 : present.HitBackOffsetTimeScale[2];
                }
                break;

            case XBeHitState.Hit_Fly:
                OffsetTimeScale_Offset  = present.HitFlyOffsetTimeScale[0] == 0 ? 1 : present.HitFlyOffsetTimeScale[0];
                OffsetTimeScale_Height  = present.HitFlyOffsetTimeScale[1] == 0 ? 1 : present.HitFlyOffsetTimeScale[1];
                OffsetTimeScale_Present = present.HitFlyOffsetTimeScale[2] == 0 ? 1 : present.HitFlyOffsetTimeScale[2];
                OffsetTimeScale_Hard    = present.HitFlyOffsetTimeScale[3] == 0 ? 1 : present.HitFlyOffsetTimeScale[3];
                break;

            case XBeHitState.Hit_Roll:
                if (change_to_fly)
                {
                    OffsetTimeScale_Offset  = present.HitFlyOffsetTimeScale[0] == 0 ? 1 : present.HitFlyOffsetTimeScale[0];
                    OffsetTimeScale_Height  = present.HitFlyOffsetTimeScale[1] == 0 ? 1 : present.HitFlyOffsetTimeScale[1];
                    OffsetTimeScale_Present = present.HitFlyOffsetTimeScale[2] == 0 ? 1 : present.HitFlyOffsetTimeScale[2];
                    OffsetTimeScale_Hard    = present.HitFlyOffsetTimeScale[3] == 0 ? 1 : present.HitFlyOffsetTimeScale[3];
                }
                else
                {
                    OffsetTimeScale_Offset  = present.HitRollOffsetTimeScale[0] == 0 ? 1 : present.HitRollOffsetTimeScale[0];
                    OffsetTimeScale_Present = present.HitRollOffsetTimeScale[1] == 0 ? 1 : present.HitRollOffsetTimeScale[1];
                    OffsetTimeScale_Hard    = present.HitRollOffsetTimeScale[2] == 0 ? 1 : present.HitRollOffsetTimeScale[2];
                }
                break;
            }

            present_straight = (change_to_fly ? data.Additional_Hit_Time_Present_Straight : data.Time_Present_Straight) * OffsetTimeScale_Present;
            hard_straight    = (change_to_fly ? data.Additional_Hit_Time_Hard_Straight : data.Time_Hard_Straight) * OffsetTimeScale_Hard;
            height           = (change_to_fly ? data.Additional_Hit_Height : data.Height) * OffsetTimeScale_Height;
            offset           = (change_to_fly ? data.Additional_Hit_Offset : data.Offset) * OffsetTimeScale_Offset;

            dir        = d;
            time_total = present_straight + landing_time + hard_straight + getup_time;
            bcurve     = data.CurveUsing;
            present_animation_factor = present_anim_time / present_straight;

            //need re-calculate between hurt and broken
            if (bcurve)
            {
                if (present.HitFly != null && present.HitCurves != null)
                {
                    IXCurve raw_h = ((change_to_fly || data.State == XBeHitState.Hit_Fly) && present.HitFly.Length > 0) ?
                                    XResources.Load <XCurve>("Curve/" + present.CurveLocation + present.HitCurves[4], AssetType.Prefab) : null;
                    IXCurve raw_v = ((change_to_fly || data.State == XBeHitState.Hit_Fly) && present.HitFly.Length > 0) ?
                                    XResources.Load <XCurve>("Curve/" + present.CurveLocation + present.HitCurves[3], AssetType.Prefab) :
                                    ((data.State == XBeHitState.Hit_Roll && present.Hit_Roll.Length > 0) ?
                                     XResources.Load <XCurve>("Curve/" + present.CurveLocation + present.HitCurves[5], AssetType.Prefab) :
                                     (data.State == XBeHitState.Hit_Back ? XResources.Load <XCurve>("Curve/" + present.CurveLocation + present.HitCurves[(int)data.State_Animation], AssetType.Prefab) :
                                      XResources.Load <XCurve>("Curve/" + present.CurveLocation + present.HitCurves[0], AssetType.Prefab)));

                    curve_h            = raw_h != null ? raw_h : null;
                    curve_v            = raw_v;
                    curve_height_scale = (raw_h == null || raw_h.GetMaxValue() == 0) ? 1 : height / raw_h.GetMaxValue();
                    curve_offset_scale = (raw_v == null || raw_v.GetMaxValue() == 0) ? 1 : offset / raw_v.GetMaxValue();
                }
            }
        }

        if (data.Fx != null)
        {
            PlayHitFx(transform, data.Fx, data.Fx_Follow);
        }
        ReadyToGo();
        ator.speed = trigger == null ? 0 : present_animation_factor;
    }
Esempio n. 7
0
 public XSkillFx(ISkillHoster _host) : base(_host)
 {
 }
Esempio n. 8
0
 public XSkill(ISkillHoster _host)
 {
     host = _host;
 }
Esempio n. 9
0
 public XSkillMob(ISkillHoster _host) : base(_host)
 {
 }
Esempio n. 10
0
 public XSkillWarning(ISkillHoster _host) : base(_host)
 {
 }
Esempio n. 11
0
 public XSkillManipulate(ISkillHoster _host) : base(_host)
 {
 }
Esempio n. 12
0
 public XSkillResult(ISkillHoster _host) : base(_host)
 {
 }