Exemplo n.º 1
0
        protected override void OnDelayedAttachAsMain(Character target)
        {
            target.InterruptChannelingSkill();

            targetAnimationComponent.Animation.PauseAnimation();

            if (targetMovementComponent.ConfigData.isFallable)
            {
                float gravity = targetMovementComponent.Gravity;
                for (int kIndex = 0; kIndex < targetMovementComponent.MovementRequests.Count; kIndex++)
                {
                    Request     r           = targetMovementComponent.MovementRequests[kIndex];
                    RequestType requestType = r.ShowRequestType();
                    if (requestType == RequestType.StationaryJump ||
                        requestType == RequestType.MovingJump)
                    {
                        gravity = ((StationaryJumpRequest)r).GroundingGravity;
                    }
                }
                FallRequest fallRequest = new FallRequest(
                    gravity, targetMovementComponent.Velocity.magnitude
                    );
                targetMovementComponent.AddMovementRequest(fallRequest);
            }
        }
Exemplo n.º 2
0
        protected override void OnDelayedAttachAsMain(Character target)
        {
            target.InterruptChannelingSkill();

            targetAnimationComponent.Animation.PlayAnimation(info.Smc.startupAnim, 1, PlayMethod.Play, 0);
            targetAnimationComponent.Animation.JumpToFrame(info.Smc.jumpFrame);

            if (targetMovementComponent.ConfigData.isFallable)
            {
                float gravity = targetMovementComponent.Gravity;
                for (int kIndex = 0; kIndex < targetMovementComponent.MovementRequests.Count; kIndex++)
                {
                    Request     r           = targetMovementComponent.MovementRequests[kIndex];
                    RequestType requestType = r.ShowRequestType();
                    if (requestType == RequestType.StationaryJump ||
                        requestType == RequestType.MovingJump)
                    {
                        gravity = ((StationaryJumpRequest)r).GroundingGravity;
                    }
                }
                FallRequest fallRequest = new FallRequest(
                    gravity, targetMovementComponent.Velocity.magnitude
                    );
                targetMovementComponent.AddMovementRequest(fallRequest);
            }

            targetStatusModifierStats = targetStatsComponent.CharacterStats.FindStats(StatsType.StatusModifier);
            Stats targetWakeDmgDownScaleStats = targetStatsComponent.CharacterStats.FindStats(StatsType.WakeDmgDownScale);
            Stats casterWakeDmgUpScaleStats   = casterStatsComponent.CharacterStats.FindStats(StatsType.WakeDmgUpScale);

            statusModifierValueModifier = targetStatusModifierStats.AddModifier(
                StatsModifierOperator.Addition,
                info.Smc.bonusDmg
                * (1 + targetWakeDmgDownScaleStats.BakedFloatValue)
                * (1 + casterWakeDmgUpScaleStats.BakedFloatValue)
                );
        }
Exemplo n.º 3
0
        protected override void OnDelayedAttachAsMain(Character target)
        {
            Log("OnAttach", target);
            Character casterCharacter = casterEntity.GetComponent <SkillComponent>().Character;

            if (attachType == ModifierAttachType.Main)
            {
                Direction movementDirection = CalculateMovementDirection(
                    casterMovementComponent, targetMovementComponent,
                    collidedProjectilePosition, info.MovementBehavior
                    );
                Direction facingDirection = CalculateFacingDirection(
                    casterMovementComponent, targetMovementComponent,
                    collidedProjectilePosition, info.FacingBehavior, movementDirection
                    );
                targetMovementComponent.MovingDirection = movementDirection.ToNormalizedVector2();
                targetMovementComponent.FacingDirection = facingDirection;

                float gravity = targetMovementComponent.Gravity;
                for (int kIndex = 0; kIndex < targetMovementComponent.MovementRequests.Count; kIndex++)
                {
                    Request     r           = targetMovementComponent.MovementRequests[kIndex];
                    RequestType requestType = r.ShowRequestType();
                    if (requestType == RequestType.StationaryJump ||
                        requestType == RequestType.MovingJump)
                    {
                        gravity = ((StationaryJumpRequest)r).GroundingGravity;
                    }
                }
                FallRequest fallRequest = new FallRequest(gravity, targetMovementComponent.Velocity.magnitude);
                if (info.Distance != 0)
                {
                    DashRequest dashRequest = new DashRequest(info.Distance, info.MovementDuration, 0);
                    dashRequest.AddCorunningRequest(fallRequest);
                    targetMovementComponent.AddMovementRequest(dashRequest);
                }
                if (targetMovementComponent.ConfigData.isFallable)
                {
                    targetMovementComponent.AddMovementRequest(fallRequest);
                }

                if (ShouldInterruptTargetSkill())
                {
                    target.InterruptChannelingSkill();
                }
                string animationName = AnimationName.Stagger.SOFT;
                if (info.Behaviors.Contains(Behavior.InterruptTargetSkill))
                {
                    animationName = AnimationName.Stagger.HARD;
                }
                if (!string.IsNullOrEmpty(info.OverrideAnimation))
                {
                    animationName = info.OverrideAnimation;

                    string[] split = info.OverrideAnimation.Split(',');
                    if (split.Length > 0)
                    {
                        animationName = split[BattleUtils.RandomRangeInt(0, split.Length)].Trim();
                    }
                }

                if (ShouldPlayAnimation())
                {
                    targetAnimationComponent.Animation.PlayAnimation(animationName, 1, PlayMethod.Play, 0);
                    targetAnimationComponent.Animation.JumpToFrame(info.AnimFrame);
                }
            }
        }
Exemplo n.º 4
0
        protected override void OnUpdate(float dt)
        {
            justChanged = false;
            if (IsFinish())
            {
                return;
            }

            elapsed += dt;

            if (elapsed >= timeUntilReturnToIdle && !isReturnToIdleStarted)
            {
                isReturnToIdleStarted = true;
                if (targetEntity.GetComponent <HealthComponent>().IsAlive())
                {
                    targetAnimation.Animation.PlayAnimation(
                        animProfile.LieToIdle(), 1, PlayMethod.Crossfade, .1f
                        );
                    targetAnimation.Animation.PlayAnimation(
                        AnimationName.IDLE, 1, PlayMethod.Queue, 0
                        );
                }
                //DLog.Log("Return to idle");
            }

            if (elapsed >= timeUntilFall)
            {
                if (!isOnGroundAnimationPlayed)
                {
                    justChanged = true;
                    state       = MainModifierState.Air;
                    //DLog.Log("RagdollModifier: state: " + state);
                    isOnGroundAnimationPlayed = true;
                    JointHierarchyAdjustment jha = targetGo.GetComponentInChildren <JointHierarchyAdjustment>();
                    if (jha != null)
                    {
                        jha.UndoAdjustment();
                    }
                    targetAnimation.Animation.UnpauseAnimation();
                    targetAnimation.Animation.PlayAnimation(animProfile.FallLoop());
                    SetEnableDynamicBones(false);

                    MovementComponent targetMc = targetEntity.GetComponent <MovementComponent>();
                    targetMc.UpdateGround();
                    float s       = targetMc.Position.y;
                    float t       = info.RagdollModifierConfig.timeToFall;
                    float v0      = info.RagdollModifierConfig.initSpeedOfFall;
                    float gravity = 2 * (s - v0 * t) / (t * t);
                    fallRequest = new FallRequest(gravity);
                    targetMc.AbortAllRequests();
                    targetMc.AddMovementRequest(fallRequest);
                    //DLog.Log("Fall");
                }
            }

            if (elapsed >= timeUntilGround && !isGrounded)
            {
                justChanged = true;
                state       = MainModifierState.Ground;
                //DLog.Log("RagdollModifier: state: " + state);
                isGrounded = true;
                targetAnimation.Animation.PlayAnimation(animProfile.FallToLie());
                targetAnimation.Animation.JumpToFrame(info.RagdollModifierConfig.onGroundAnimationStartFrame);
                targetAnimation.Animation.QueueAnimation(animProfile.LieLoop());
                //DLog.Log("Lie");
            }

            if (fallRequest != null)
            {
                if (fallRequest.IsCompleted())
                {
                    if (!isEventTriggered)
                    {
                        isEventTriggered = true;
                        TriggerEvents();
                    }
                }
            }

            if (vfxLogic != null)
            {
                vfxLogic.Update(dt);
            }

            if (elapsed >= duration)
            {
                lifetime.End();
            }
        }