コード例 #1
0
        public override void OnReset()
        {
            if (m_Animation != null)
            {
                m_Animation.DestroyPlayableGraph();
                m_Animation = null;
            }

            CurrentArchetype = AssetPath.Empty;
        }
コード例 #2
0
        public override void OnTargetUpdate()
        {
            CurrentArchetype           = default;
            CurrentKitResource         = default;
            CurrentArchetypeResource   = default;
            CurrentGameGraphicResource = default;

            if (!TryGetComponent(out m_Animation))
            {
                m_Animation = gameObject.AddComponent <UnitVisualAnimation>();
                if (!DstEntityManager.HasComponent(BackendEntity, typeof(UnitVisualAnimation)))
                {
                    DstEntityManager.AddComponentObject(BackendEntity, m_Animation);
                }
            }

            m_Animation.OnBackendSet(this);
            DstEntityManager.AddComponentData(BackendEntity, RuntimeAssetDisable.All);
        }
        protected override void OnUpdate(Entity targetEntity, UnitVisualBackend backend, UnitVisualAnimation animation, Entity abilityEntity, AbilityState abilityState)
        {
            var currAnim = animation.CurrAnimation;

            if (currAnim.Type == SystemType && currAnim.StopAt < animation.RootTime)
            {
                // allow transitions and overrides now...
                animation.SetTargetAnimation(new TargetAnimation(currAnim.Type, transitionStart: currAnim.StopAt, transitionEnd: currAnim.StopAt + StopOffset));
                if (animation.RootTime > currAnim.StopAt + StopOffset)
                {
                    Stop();
                }
            }

            var ability = GetComponent <TAbility>(abilityEntity);

            if (ability.AttackStart <= TimeSpan.Zero)
            {
                return;
            }

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