예제 #1
0
        private void ProcessTargets()
        {
            foreach (var hit in this._data.FatalHits)
            {
                if (hit.Data.Target.Current.GetType().Equals(typeof(CChar)))
                {
                    var tgt = hit.Data.Target.Current as CChar;

                    var scaleData = new SScaleData();
                    scaleData.ScalePerFrame = 0.99f;
                    scaleData.Target        = tgt.GameHandle;
                    var scale = tgt.GameHandle.AddComponent <SScale>();
                    scale.Init(scaleData);

                    var rotateData = new SRotationData();
                    var roll       = RNG.Instance.RandomNegOrPos();
                    if (roll > 0)
                    {
                        rotateData.SpinRight = true;
                    }
                    else
                    {
                        rotateData.SpinRight = false;
                    }
                    rotateData.Speed  = Mathf.Abs(RNG.Instance.GetRandomBetweenRange(12f));
                    rotateData.Target = tgt.GameHandle;
                    var rotate = tgt.GameHandle.AddComponent <SRotation>();
                    rotate.Init(rotateData);

                    var trackData = new STrackMoveData();
                    trackData.Epsilon = FatalityParams.DEFAULT_EPSILON;
                    trackData.Handle  = tgt.GameHandle;
                    trackData.Speed   = 1.2f;
                    trackData.Target  = this._data.Source.GameHandle;
                    var track = tgt.GameHandle.AddComponent <STrackMoveThenDelete>();
                    track.Init(trackData);

                    var callbackDelay = tgt.GameHandle.AddComponent <SDelayCallback>();
                    callbackDelay.AddCallback(this.ProcessPostFatality);
                    callbackDelay.AddCallback(hit.CallbackHandler);
                    callbackDelay.AddCallback(rotate.Done);
                    callbackDelay.Init(FatalityParams.DEFAULT_DUR);

                    VCharUtil.Instance.AssignDeadLayer(tgt);
                }
            }
        }
예제 #2
0
        private void ProcessHead(object o)
        {
            foreach (var hit in this._data.FatalHits)
            {
                if (hit.Data.Target.Current != null &&
                    hit.Data.Target.Current.GetType().Equals(typeof(CChar)))
                {
                    var tgt = this._data.Target.Current as CChar;
                    if (tgt.Proxy.Type == ECharType.Humanoid)
                    {
                        VCharUtil.Instance.ProcessDeadChar(tgt);

                        var body = tgt.SubComponents[SortingLayers.CHAR_MAIN];
                        var data = new EvSplatterData();
                        data.DmgPercent = 1;
                        data.Fatality   = true;
                        data.Target     = body;
                        new EvSplatter(data);

                        var head    = tgt.SubComponents[SortingLayers.CHAR_HEAD];
                        var tgtTile = tgt.Tile;
                        var tgtPos  = RandomPositionOffset.RandomOffset(
                            tgtTile.Handle.transform.position,
                            FatalityParams.SLASH_HEAD_OFFSET);
                        head.transform.SetParent(tgtTile.Handle.transform);

                        var spinData = new SRotationData();
                        spinData.Speed  = (float)(FatalityParams.SLASH_ROTATION_SPEED * RNG.Instance.NextDouble());
                        spinData.Target = head;
                        var spinRight = RNG.Instance.RandomNegOrPos();
                        if (spinRight > 0)
                        {
                            spinData.SpinRight = true;
                        }
                        var spin = head.AddComponent <SRotation>();
                        spin.Init(spinData);

                        var raycastData = new SRaycastMoveData();
                        raycastData.Epsilon = FatalityParams.DEFAULT_EPSILON;
                        raycastData.Handle  = head;
                        raycastData.Speed   = FatalityParams.SLASH_RAYCAST_SPEED;
                        raycastData.Target  = tgtPos;
                        var raycast = head.AddComponent <SRaycastMove>();
                        this.AttachBlood(head, tgt.GameHandle);

                        raycast.AddCallback(this.AddBloodPool);
                        raycast.AddCallback(spin.Done);

                        var callbackDelay = head.AddComponent <SDelayCallback>();
                        callbackDelay.AddCallback(this.CallbackHandler);
                        callbackDelay.AddCallback(hit.CallbackHandler);
                        callbackDelay.Init(FatalityParams.DEFAULT_DUR);

                        raycast.Init(raycastData);
                    }
                    else
                    {
                        VHitController.Instance.ProcessDefenderHit(hit);
                    }
                }
            }
        }