コード例 #1
0
    public FlumpMovie GetMovie(string i_Name)
    {
        FlumpMovie reference = null;

        for (int i = 0; i < m_FlumpMovieList.Count; i++)
        {
            if (m_FlumpMovieList[i].m_MovieName == i_Name)
            {
                reference = m_FlumpMovieList[i];
                if (m_FlumpMovieList[i].m_Available)
                {
                    FlumpMovie returnMovie = m_FlumpMovieList[i];
                    return(returnMovie);
                }
            }
        }

        if (reference != null)
        {
            GameObject go         = (GameObject)GameObject.Instantiate(m_FlumpMoviePrefab);
            FlumpMovie flumpMovie = go.GetComponent <FlumpMovie>();
            flumpMovie.CopyData(reference);
            go.transform.parent = gameObject.transform;
            go.SetActive(false);
            //	m_FlumpMovieList.Add(flumpMovie);

            return(flumpMovie);
        }

        return(null);
    }
コード例 #2
0
 public void MakeMovieAvailable(FlumpMovie i_Movie)
 {
     //m_FlumpMovieList.Add(i_Movie);
     i_Movie.gameObject.SetActive(false);
     i_Movie.transform.SetParent(transform);
     i_Movie.m_Available = true;
 }
コード例 #3
0
ファイル: FlumpMovie.cs プロジェクト: BerzerkBed/Pixel2018
        public void SetFrame(int i_Frame, FlumpMovie i_FlumpMovie, int i_Layer)
        {
            // Frame Actif Expire
            if (m_ActiveKeyFrame != null && i_Frame == 1)
            {
                m_ActiveKeyFrameIndex = 0;
                m_ActiveKeyFrame.Disable(i_FlumpMovie);
                m_ActiveKeyFrame = null;
            }
            else if (m_ActiveKeyFrame != null && i_Frame >= m_ActiveKeyFrame.LastFrame())
            {
                m_ActiveKeyFrameIndex++;
                m_ActiveKeyFrame.Disable(i_FlumpMovie);
                m_ActiveKeyFrame = null;
            }
            else if (m_ActiveKeyFrame != null && m_ActiveKeyFrameIndex < m_KeyFrames.Count - 1)
            {
                m_ActiveKeyFrame.Tween(i_Frame, m_KeyFrames[m_ActiveKeyFrameIndex + 1], i_Layer, i_FlumpMovie);
            }

            // Aucun Frame actif, mais mon next keyframe est actif
            if (m_ActiveKeyFrame == null && m_ActiveKeyFrameIndex < m_KeyFrames.Count && i_Frame >= m_KeyFrames[m_ActiveKeyFrameIndex].m_Index)
            {
                m_ActiveKeyFrame = m_KeyFrames[m_ActiveKeyFrameIndex];
                m_ActiveKeyFrame.Activate(i_FlumpMovie, i_Layer);
            }
        }
コード例 #4
0
ファイル: FlumpMovie.cs プロジェクト: BerzerkBed/Pixel2018
        public void Activate(FlumpMovie i_FlumpMovie, int i_Layer)
        {
            if (string.IsNullOrEmpty(m_Ref))
            {
                return;
            }

            m_Sprite = FlumpSpriteManager.Instance.AddSprite(m_Ref, 0, 0);
            m_Sprite.transform.SetParent(i_FlumpMovie.m_Transform);
            m_Sprite.transform.localPosition = GetPosition();
            m_Sprite.transform.localRotation = Quaternion.identity;
            m_Sprite.SetLayer(i_FlumpMovie.m_SortingOrder, i_Layer, i_FlumpMovie.m_LocatorLayer);
            ApplyRotation(m_Sprite.transform, -m_Rotation.x);
            m_Sprite.transform.localScale = m_Scale;

            if (m_Sprite.m_SpriteName.Contains("Locator"))
            {
                i_FlumpMovie.AddLocator(m_Sprite, i_Layer);
            }

            /*if (m_Sprite.m_SpriteName == "Locator_Staff")
             * {
             *      m_Movie = FlumpMovieManager.Instance.AddMovie ("Movie_Staff" , 0f , 0f);
             *      m_Movie.transform.SetParent (m_Sprite.transform);
             *      m_Movie.transform.localPosition = Vector2.zero;
             *      m_Movie.transform.localRotation = Quaternion.identity;
             *      m_Movie.Play(true , i_Layer);
             * }*/
        }
コード例 #5
0
 public void ReturnMovie(FlumpMovie i_Movie)
 {
     i_Movie.ReturnMovies();
     //m_FlumpMovieList.Add(i_Movie);
     i_Movie.gameObject.SetActive(false);
     i_Movie.transform.SetParent(transform);
     i_Movie.m_Available = true;
 }
コード例 #6
0
ファイル: FlumpMovie.cs プロジェクト: BerzerkBed/Pixel2018
 public void Disable(FlumpMovie i_FlumpMovie)
 {
     i_FlumpMovie.RemoveLocator(m_Sprite);
     if (m_Sprite != null)
     {
         FlumpSpriteManager.Instance.ReturnSprite(m_Sprite);
     }
 }
コード例 #7
0
ファイル: FlumpMovie.cs プロジェクト: BerzerkBed/Pixel2018
 public void RemoveMovies(FlumpMovie i_FlumpMovie)
 {
     if (m_ActiveKeyFrame != null)
     {
         m_ActiveKeyFrame.Disable(i_FlumpMovie);
     }
     m_ActiveKeyFrame      = null;
     m_ActiveKeyFrameIndex = 0;
 }
コード例 #8
0
ファイル: FlumpMovie.cs プロジェクト: BerzerkBed/Pixel2018
 public void Tween(int i_CurrentFrame, KeyFrame i_NextKeyFrame, int i_Layer, FlumpMovie i_FlumpMovie)
 {
     if (m_Sprite != null)
     {
         m_Sprite.transform.localPosition = GetPosition() + ((i_NextKeyFrame.GetPosition() - GetPosition()) * GetTweenPercentage(i_CurrentFrame));
         m_Sprite.SetLayer(i_FlumpMovie.m_SortingOrder, i_Layer, i_FlumpMovie.m_LocatorLayer);
         ApplyRotation(m_Sprite.transform, -(m_Rotation.x + ((i_NextKeyFrame.m_Rotation.x - m_Rotation.x) * GetTweenPercentage(i_CurrentFrame))));
         m_Sprite.transform.localScale = m_Scale + ((i_NextKeyFrame.m_Scale - m_Scale) * GetTweenPercentage(i_CurrentFrame));
     }
 }
コード例 #9
0
ファイル: Test.cs プロジェクト: BerzerkBed/Pixel2018
    void Start()
    {
        myMovie = FlumpMovieManager.Instance.AddMovie("START_IDLE", 0f, 0f);
        myMovie.m_Transform.SetParent(transform);
        myMovie.m_Transform.localPosition = Vector3.zero;
        myMovie.m_Transform.localScale    = Vector3.one;
        myMovie.m_Transform.localRotation = Quaternion.identity;
        myMovie.Play(0, 1, true, -1);

        myMovie.AddAnimationCallback(10, Caca);
        myMovie.AddEndCallback(Caca2);
    }
コード例 #10
0
    public FlumpMovie CreateMovie(List <FlumpMovie.Layer> i_Calques, int i_FrameRate, string i_MovieName)
    {
        GameObject go         = (GameObject)GameObject.Instantiate(m_FlumpMoviePrefab);
        FlumpMovie flumpMovie = go.GetComponent <FlumpMovie>();

        flumpMovie.SetData(i_Calques, i_FrameRate, i_MovieName);
        go.transform.parent = gameObject.transform;
        go.SetActive(false);

        m_FlumpMovieList.Add(flumpMovie);

        return(flumpMovie);
    }
コード例 #11
0
    public FlumpMovie AddMovie(string i_MovieName, float i_PosX, float i_PosY)
    {
        FlumpMovie movie = GetMovie(i_MovieName);

        if (movie != null)
        {
            movie.gameObject.SetActive(true);
            movie.gameObject.transform.position = Vector2.zero;
            movie.gameObject.transform.SetParent(transform);
            movie.m_Available = false;
            return(movie);
        }

        Debug.Log("Couldn't find Movie : " + i_MovieName);
        return(null);
    }
コード例 #12
0
ファイル: FlumpMovie.cs プロジェクト: BerzerkBed/Pixel2018
    public void CopyData(FlumpMovie i_FlumpMovie)
    {
        m_MovieName     = i_FlumpMovie.m_MovieName;
        m_FrameRate     = i_FlumpMovie.m_FrameRate;
        gameObject.name = m_MovieName;
        m_Available     = true;

        m_Layers = new List <Layer> ();
        for (int i = 0; i < i_FlumpMovie.m_Layers.Count; i++)
        {
            Layer currentLayer = i_FlumpMovie.m_Layers [i];

            List <KeyFrame> keyFramesToAdd = new List <KeyFrame> ();
            for (int j = 0; j < currentLayer.m_KeyFrames.Count; j++)
            {
                KeyFrame currentKeyFrame = currentLayer.m_KeyFrames [j];
                keyFramesToAdd.Add(currentKeyFrame.Copy());
            }
            m_Layers.Add(new Layer(keyFramesToAdd));
        }
    }