public static Animator2D CreateAnimatedObjectEffectInstance([NotNull] AnimatedObjectDefinition definition, string animationName, [NotNull] Transform parent)
        {
            //IL_0038: Unknown result type (might be due to invalid IL or missing references)
            //IL_003d: Unknown result type (might be due to invalid IL or missing references)
            if (null == definition)
            {
                throw new NullReferenceException();
            }
            if (null == s_instance)
            {
                Log.Error("CreateAnimatedObjectEffectInstance called while the factory is not ready.", 367, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightObjectFactory.cs");
                return(null);
            }
            Animator2D component = s_animatedObjectEffectPool.Instantiate(parent.get_position(), Quaternion.get_identity(), parent).GetComponent <Animator2D>();

            if (!string.IsNullOrEmpty(animationName))
            {
                component.SetAnimation(animationName, false, false, true);
            }
            else
            {
                component.set_animationLoops(false);
            }
            component.SetDefinition(definition, null, (Graphic[])null);
            return(component);
        }
Example #2
0
        public void PlayAnimation(string animationName, Action onComplete = null, bool loop = false, bool restart = true, bool async = false)
        {
            TimelineAsset value;
            bool          flag = ((Dictionary <string, TimelineAsset>)m_timelineAssetDictionary).TryGetValue(animationName, out value);

            if (flag && null != value)
            {
                m_playableDirector.set_extrapolationMode(0);
                if (value != m_playableDirector.get_playableAsset())
                {
                    m_playableDirector.Play(value);
                }
                else
                {
                    if (restart || !m_animator2D.get_animationName().Equals(animationName))
                    {
                        m_playableDirector.set_time(0.0);
                    }
                    m_playableDirector.Resume();
                }
                m_hasTimeline = true;
            }
            else
            {
                if (flag)
                {
                    Log.Warning("Boss named '" + this.get_gameObject().get_name() + "' has a timeline setup for key '" + animationName + "' but the actual asset is null.", 202, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Maps\\Objects\\BossObject.cs");
                }
                m_playableDirector.set_time(0.0);
                m_playableDirector.Pause();
                m_hasTimeline = false;
            }
            m_animationCallback.Setup(animationName, restart, onComplete);
            m_animator2D.SetAnimation(animationName, loop, async, restart);
        }
 public override void ChangeDirection(Direction newDirection)
 {
     //IL_0010: Unknown result type (might be due to invalid IL or missing references)
     //IL_0015: Unknown result type (might be due to invalid IL or missing references)
     //IL_001a: Unknown result type (might be due to invalid IL or missing references)
     //IL_0038: Unknown result type (might be due to invalid IL or missing references)
     //IL_0078: Unknown result type (might be due to invalid IL or missing references)
     //IL_00b6: Unknown result type (might be due to invalid IL or missing references)
     //IL_00cc: Unknown result type (might be due to invalid IL or missing references)
     if (newDirection != m_direction)
     {
         Vector2    position   = Vector2Int.op_Implicit(m_cellObject.coords);
         Animator2D animator2D = m_animator2D;
         CharacterAnimationParameters animationParameters    = m_animationParameters;
         CharacterAnimationInfo       characterAnimationInfo = (m_animationParameters.secondDirection == Direction.None) ? new CharacterAnimationInfo(position, animationParameters.animationName, animationParameters.timelineKey, animationParameters.loops, newDirection, m_mapRotation) : new CharacterAnimationInfo(previousDirection: DirectionExtensions.Rotate(angle: m_direction.DirectionAngleTo(newDirection), value: animationParameters.firstDirection), position: position, animationName: animationParameters.animationName, timelineKey: animationParameters.timelineKey, loops: animationParameters.loops, direction: newDirection, mapRotation: m_mapRotation);
         animator2D.get_transform().set_localRotation(characterAnimationInfo.flipX ? Quaternion.Euler(0f, -135f, 0f) : Quaternion.Euler(0f, 45f, 0f));
         direction = newDirection;
         string animationName = characterAnimationInfo.animationName;
         int    currentFrame  = animator2D.get_currentFrame();
         m_animationCallback.ChangeAnimationName(animationName);
         animator2D.SetAnimation(animationName, characterAnimationInfo.loops, false, true);
         animator2D.set_currentFrame(currentFrame);
         m_animationParameters = characterAnimationInfo.parameters;
     }
 }
Example #4
0
 public void PlayAnim(string animName, bool loop, bool randomStartFrame = false)
 {
     if (!(m_animator2D == null) && !string.IsNullOrEmpty(animName))
     {
         m_animator2D.SetAnimation(animName, loop, false, true);
         if (randomStartFrame)
         {
             int currentFrame = Random.Range(0, Mathf.Min(15, m_animator2D.get_animationFrameCount()));
             m_animator2D.set_currentFrame(currentFrame);
         }
     }
 }
Example #5
0
        private void StartAnimation(CharacterAnimationInfo animationInfo, Action onComplete = null, Action onCancel = null, bool restart = true, bool async = false)
        {
            //IL_0030: Unknown result type (might be due to invalid IL or missing references)
            //IL_0046: Unknown result type (might be due to invalid IL or missing references)
            string animationName = animationInfo.animationName;
            string timelineKey   = animationInfo.timelineKey;

            m_animator2D.get_transform().set_localRotation(animationInfo.flipX ? Quaternion.Euler(0f, -135f, 0f) : Quaternion.Euler(0f, 45f, 0f));
            direction = animationInfo.direction;
            ITimelineAssetProvider characterData = m_characterData;

            if (characterData != null)
            {
                TimelineAsset timelineAsset;
                bool          flag = characterData.TryGetTimelineAsset(timelineKey, out timelineAsset);
                if (flag && null != timelineAsset)
                {
                    if (timelineAsset != m_playableDirector.get_playableAsset())
                    {
                        m_playableDirector.Play(timelineAsset);
                    }
                    else
                    {
                        if (restart || !m_animator2D.get_animationName().Equals(animationName))
                        {
                            m_playableDirector.set_time(0.0);
                        }
                        m_playableDirector.Resume();
                    }
                    m_hasTimeline = true;
                }
                else
                {
                    if (flag)
                    {
                        Log.Warning("Character named '" + m_characterData.get_name() + "' has a timeline setup for key '" + timelineKey + "' but the actual asset is null.", 323, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\HavreMap\\MapPathfindingActor.cs");
                    }
                    m_playableDirector.set_time(0.0);
                    m_playableDirector.Pause();
                    m_hasTimeline = false;
                }
            }
            m_animationCallback.Setup(animationName, restart, onComplete, onCancel);
            m_animator2D.SetAnimation(animationName, animationInfo.loops, async, restart);
            m_animationParameters = animationInfo.parameters;
        }
        protected override void OnMapRotationChanged(DirectionAngle previousMapRotation, DirectionAngle newMapRotation)
        {
            //IL_0010: Unknown result type (might be due to invalid IL or missing references)
            //IL_0016: Invalid comparison between Unknown and I4
            //IL_0021: Unknown result type (might be due to invalid IL or missing references)
            //IL_0026: Unknown result type (might be due to invalid IL or missing references)
            //IL_002b: Unknown result type (might be due to invalid IL or missing references)
            //IL_0043: Unknown result type (might be due to invalid IL or missing references)
            //IL_007e: Unknown result type (might be due to invalid IL or missing references)
            //IL_00bc: Unknown result type (might be due to invalid IL or missing references)
            //IL_00d2: Unknown result type (might be due to invalid IL or missing references)
            base.OnMapRotationChanged(previousMapRotation, newMapRotation);
            Animator2D animator2D = m_animator2D;

            if ((int)animator2D.GetInitialisationState() == 3)
            {
                Vector2 position = Vector2Int.op_Implicit(m_cellObject.coords);
                CharacterAnimationParameters animationParameters = m_animationParameters;
                CharacterAnimationInfo       characterAnimationInfo;
                if (m_animationParameters.secondDirection == Direction.None)
                {
                    characterAnimationInfo = new CharacterAnimationInfo(position, animationParameters.animationName, animationParameters.timelineKey, animationParameters.loops, direction, newMapRotation);
                }
                else
                {
                    DirectionAngle angle             = newMapRotation.Substract(previousMapRotation);
                    Direction      previousDirection = animationParameters.firstDirection.Rotate(angle);
                    characterAnimationInfo = new CharacterAnimationInfo(position, animationParameters.animationName, animationParameters.timelineKey, animationParameters.loops, previousDirection, direction, newMapRotation);
                }
                animator2D.get_transform().set_localRotation(characterAnimationInfo.flipX ? Quaternion.Euler(0f, -135f, 0f) : Quaternion.Euler(0f, 45f, 0f));
                string animationName = characterAnimationInfo.animationName;
                int    currentFrame  = animator2D.get_currentFrame();
                m_animationCallback.ChangeAnimationName(animationName);
                animator2D.SetAnimation(animationName, characterAnimationInfo.loops, false, true);
                animator2D.set_currentFrame(currentFrame);
                m_animationParameters = characterAnimationInfo.parameters;
            }
        }