Beispiel #1
0
        ///<summary>Try create a new Player instance if it hasn't being created before</summary>
        public static PTweenPlayerInstance TryCreateNewPlayerInstance(PTweenPlayerComponent playerComponent, PTweenAnimationDirection animationDirection)
        {
            PTweenPlayerInstance instance = null;

            for (int i = 0; i < m_AllPlayerInstances.Count; i++)
            {
                var curPlayer = m_AllPlayerInstances[i];
                if (curPlayer.PlayerTarget == playerComponent)
                {
                    instance = curPlayer;
                    break;
                }
            }

            if (instance == null)
            {
                instance = new PTweenPlayerInstance();
                instance.PlayerTarget = playerComponent;
                m_AllPlayerInstances.Add(instance);
            }

            instance.AnimationDirection = animationDirection;

            instance.PtweenInstances = new PTweenInstance[playerComponent.Targets.Length];

            for (int i = 0; i < instance.PtweenInstances.Length; i++)
            {
                instance.PtweenInstances[i] = PlayTweenComponent(instance.PlayerTarget.Targets[i], animationDirection);
            }

            return(instance);
        }
Beispiel #2
0
        ///<summary>Returns the first PlayerInstance with his player target equal than PlayerComponent parameter</summary>
        public static PTweenPlayerInstance GetPlayerInstanceByOriginalComponent(PTweenPlayerComponent originalComponent)
        {
            for (int i = 0; i < AllPlayerInstances.Count; i++)
            {
                PTweenPlayerInstance curInstance = AllPlayerInstances[i];
                if (curInstance.PlayerTarget == originalComponent)
                {
                    return(curInstance);
                }
            }

            return(null);
        }
Beispiel #3
0
        ///<summary>Returns player instance that will be playing</summary>
        public static PTweenPlayerInstance StartPTweenPlayerComponent(PTweenPlayerComponent playerComponent, PTweenAnimationDirection animationDirection)
        {
            PTweenPlayerInstance instance = TryCreateNewPlayerInstance(playerComponent, animationDirection);

            return(instance);
        }