protected override void OnUpdate(Entity targetEntity, UnitVisualBackend backend, UnitVisualAnimation animation)
        {
            var currAnim = animation.CurrAnimation;

            if (currAnim.Type == SystemType && animation.RootTime >= currAnim.StopAt)
            {
                // allow transitions and overrides now...
                animation.SetTargetAnimation(new TargetAnimation(currAnim.Type, transitionStart: currAnim.StopAt, transitionEnd: currAnim.StopAt + 0.25f));
                // if no one set another animation, then let's set to null...
                if (animation.RootTime >= currAnim.StopAt + 0.25f)
                {
                    animation.SetTargetAnimation(TargetAnimation.Null);
                }
            }

            var abilityEntity = AbilityFinder.GetAbility(targetEntity);

            if (abilityEntity == default)
            {
                if (animation.ContainsSystem(SystemType))
                {
                    ref var temp = ref animation.GetSystemData <SystemData>(SystemType);
                    temp.StartTime = -1;
                    temp.StartAt   = -1;
                    temp.Phase     = default;
                    temp.ActiveId  = -1;
                }

                return;
            }
        protected override void OnUpdate(Entity targetEntity, UnitVisualBackend backend, UnitVisualAnimation animation)
        {
            var currAnim      = animation.CurrAnimation;
            var abilityEntity = AbilityFinder.GetAbility(backend.DstEntity);

            EntityManager.TryGetComponentData <AbilityState>(abilityEntity, out var abilityState);
            if (abilityEntity == default || (abilityState.Phase & KeepAnimationAtPhase) == 0)
            {
                if (currAnim.Type == SystemType && ((abilityState.Phase & EAbilityPhase.Chaining) == 0 || animation.RootTime > currAnim.StopAt))
                {
                    animation.SetTargetAnimation(new TargetAnimation(default, previousType: currAnim.Type));
        protected override void OnUpdate(Entity targetEntity, UnitVisualBackend backend, UnitVisualAnimation animation)
        {
            var currAnim = animation.CurrAnimation;

            if (currAnim.Type == SystemType && animation.RootTime >= currAnim.StopAt)
            {
                // allow transitions and overrides now...
                animation.SetTargetAnimation(new TargetAnimation(currAnim.Type, transitionStart: currAnim.StopAt, transitionEnd: currAnim.StopAt + 0.25f));
                // if no one set another animation, then let's set to null...
                if (animation.RootTime >= currAnim.StopAt + 0.25f)
                {
                    animation.SetTargetAnimation(TargetAnimation.Null);
                }
            }

            var abilityEntity = AbilityFinder.GetAbility(targetEntity);

            if (abilityEntity == default)
            {
                return;
            }

            InjectAnimation(animation);

            var owner     = EntityManager.GetComponentData <Owner>(abilityEntity);
            var velocityY = EntityManager.GetComponentData <Velocity>(owner.Target).Value.y;

            if (!EntityManager.TryGetComponentData(owner.Target, out Relative <RhythmEngineDescription> engineRelative))
            {
                return;
            }

            var commandState = EntityManager.GetComponentData <GameCommandState>(engineRelative.Target);
            var processMs    = (uint)(EntityManager.GetComponentData <RhythmEngineLocalState>(engineRelative.Target).Elapsed.Ticks / TimeSpan.TicksPerMillisecond);

            var abilityState = EntityManager.GetComponentData <AbilityState>(abilityEntity);

            if (abilityState.Phase == EAbilityPhase.None)
            {
                if (currAnim.Type == SystemType)
                {
                    animation.SetTargetAnimation(TargetAnimation.Null);
                }

                return;
            }

            var jumpAbility = EntityManager.GetComponentData <DefaultJumpAbility>(abilityEntity);

            ResetIdleTime(targetEntity);

            ref var data = ref animation.GetSystemData <SystemData>(SystemType);
Exemple #4
0
        protected override void OnUpdate(Entity targetEntity, UnitVisualBackend backend, UnitVisualAnimation animation)
        {
            var currAnim = animation.CurrAnimation;

            if (currAnim.Type == SystemType && animation.RootTime >= currAnim.StopAt)
            {
                // allow transitions and overrides now...
                animation.SetTargetAnimation(new TargetAnimation(currAnim.Type, transitionStart: currAnim.StopAt, transitionEnd: currAnim.StopAt + 0.25f));
                // if no one set another animation, then let's set to null...
                if (animation.RootTime >= currAnim.StopAt + 0.25f)
                {
                    animation.SetTargetAnimation(TargetAnimation.Null);
                }
            }

            var abilityEntity = AbilityFinder.GetAbility(targetEntity);

            if (abilityEntity == default)
            {
                return;
            }

            InjectAnimation(animation);

            var abilityState   = EntityManager.GetComponentData <AbilityState>(abilityEntity);
            var retreatAbility = EntityManager.GetComponentData <DefaultRetreatAbility>(abilityEntity);

            if (abilityState.Phase == EAbilityPhase.None)
            {
                if (currAnim.Type == SystemType)
                {
                    animation.SetTargetAnimation(TargetAnimation.Null);
                }

                return;
            }

            ResetIdleTime(targetEntity);

            ref var data = ref animation.GetSystemData <SystemData>(SystemType);