Exemplo n.º 1
0
    /* Functions */
    void Start()
    {
        InstanceCameraDraw = Library_SpriteStudio.Utility.CameraGetParent(gameObject);

        DrawEntryPartsRoot = new ArrayList();
        DrawEntryPartsRoot.Clear();

        arrayListMeshDraw = new Library_SpriteStudio.DrawManager.ArrayListMeshDraw();
        arrayListMeshDraw.BootUp();
        arrayListMeshDraw.RenderQueueSet(KindRenderQueueBase, OffsetDrawQueue);
    }
Exemplo n.º 2
0
    /* Functions */
    void Start()
    {
        InstanceCameraDraw = Library_SpriteStudio.Utility.CameraGetParent(gameObject);

#if false
        /* MEMO: Non-Generic List-Class */
        DrawEntryPartsRoot = new ArrayList();
        DrawEntryPartsRoot.Clear();
#else
        DrawEntryPartsRoot = new List <InformationDrawObject>();
        DrawEntryPartsRoot.Clear();
#endif

        arrayListMeshDraw = new Library_SpriteStudio.DrawManager.ArrayListMeshDraw();
        arrayListMeshDraw.BootUp();
        arrayListMeshDraw.RenderQueueSet(KindRenderQueueBase, OffsetDrawQueue);
    }
Exemplo n.º 3
0
    void Start()
    {
        InstanceCameraDraw      = Library_SpriteStudio.Utility.CameraGetParent(gameObject);
        InstanceDrawManagerView = Library_SpriteStudio.Utility.DrawManagerViewGetParent(gameObject);
        rateOpacity             = 1.0f;

        arrayListMeshDraw = new Library_SpriteStudio.DrawManager.ArrayListMeshDraw();
        arrayListMeshDraw.BootUp();

        ListCallBackUserData = new ArrayList();
        ListCallBackUserData.Clear();

        if (null == ListInformationPlay)
        {
            frameNoStart   = 0;
            frameNoEnd     = 0;
            framePerSecond = 0;
        }
        if (0 == (Status & BitStatus.PLAYING))
        {
            AnimationPlay();
        }
    }
Exemplo n.º 4
0
    void Update()
    {
        MainLoopCount++;

        /* Boot-Check */
        if (null == InstanceCameraDraw)
        {
            InstanceCameraDraw = Library_SpriteStudio.Utility.CameraGetParent(gameObject);
        }
        if (null == InstanceDrawManagerView)
        {
            InstanceDrawManagerView = Library_SpriteStudio.Utility.DrawManagerViewGetParent(gameObject);
        }
        if (null == arrayListMeshDraw)
        {
            arrayListMeshDraw = new Library_SpriteStudio.DrawManager.ArrayListMeshDraw();
            arrayListMeshDraw.BootUp();
        }
        if (null == ListCallBackUserData)
        {
            ListCallBackUserData = new ArrayList();
            ListCallBackUserData.Clear();
        }

        /* Entry Object to Draw */
        if ((null != InstanceDrawManagerView) && (null == partsRootOrigin))
        {               /* Not "Instance"-Object */
            if (false == FlagHideForce)
            {
                InstanceDrawManagerView.DrawEntryObject(this);
            }
        }

        /* Animation Update */
        if (null == SpriteStudioData)
        {
            return;
        }

        if (null == ListInformationPlay)
        {
            return;
        }

        if (0 == (Status & BitStatus.PLAYING))
        {
            return;
        }

        if (0 != (Status & BitStatus.PAUSING))
        {
            return;
        }

        int FrameCountNow  = 0;
        int FrameCountEnd  = frameNoEnd - frameNoStart;
        int FrameCountFull = FrameCountEnd + 1;

        float RateTimeProgress  = (0 == (Status & BitStatus.PLAYING_REVERSE)) ? 1.0f : -1.0f;
        float TimeAnimationFull = (float)FrameCountFull * TimeFramePerSecond;

        bool FlagLoop   = false;
        bool FlagReLoop = true;

        /* FrameNo Update */
        Status |= BitStatus.PLAY_FIRST;
        if (-1 != frameNoPrevious)
        {               /* Not Update, Just Starting */
            TimeAnimation += (Time.deltaTime * rateTimePlay) * RateTimeProgress;
            Status        &= ~BitStatus.DECODE_USERDATA;
            Status        &= ~BitStatus.PLAY_FIRST;
        }

        FrameCountNow        = (int)(TimeAnimation / TimeFramePerSecond);
        countLoopThisTime    = 0;
        flagTurnBackPingPong = false;
        flagReversePrevious  = (0 != (Status & BitStatus.PLAYING_REVERSE)) ? true : false;
        Status &= ~BitStatus.REDECODE_INSTANCE;

        if (false == FlagStylePingpong)
        {               /* One-Way */
            if (0 == (Status & BitStatus.PLAYING_REVERSE))
            {           /* Play foward */
                        /* Get Frame Count */
                if (FrameCountEnd < FrameCountNow)
                {       /* Frame-Over */
                    FlagLoop   = true;
                    FlagReLoop = true;
                    while (true == FlagReLoop)
                    {
                        /* Loop-Count Check */
                        if (0 <= CountLoopRemain)
                        {                               /* Limited-Count Loop */
                            CountLoopRemain--;
                            FlagLoop = (0 > CountLoopRemain) ? false : FlagLoop;
                        }

                        /* ReCalculate Frame */
                        if (true == FlagLoop)
                        {                               /* Loop */
                            countLoopThisTime++;

                            /* ReCalculate Frame */
                            TimeAnimation -= TimeAnimationFull;
                            FrameCountNow  = (int)(TimeAnimation / TimeFramePerSecond);
                            FlagReLoop     = (TimeAnimationFull <= TimeAnimation) ? true : false;

                            /* Set Instance Parts Restart Request */
                            Status |= BitStatus.REDECODE_INSTANCE;

                            /* Force-Decode UserData */
                            Status |= BitStatus.DECODE_USERDATA;
                        }
                        else
                        {                               /* End */
                            TimeAnimation = ((float)FrameCountEnd) * TimeFramePerSecond;
                            FrameCountNow = FrameCountEnd;
//							Status &= ~BitStatus.PLAYING;
                            Status    |= BitStatus.REQUEST_PLAYEND;
                            FlagReLoop = false;
                        }
                    }
                }
            }
            else
            {                   /* Play backwards */
                                /* Get Frame Count */
                if (0 > FrameCountNow)
                {               /* Frame-Over */
                    FlagLoop   = true;
                    FlagReLoop = true;
                    while (true == FlagReLoop)
                    {
                        /* Loop-Count Check */
                        if (0 <= CountLoopRemain)
                        {                               /* Limited-Count Loop */
                            CountLoopRemain--;
                            FlagLoop = (0 > CountLoopRemain) ? false : FlagLoop;
                        }

                        /* ReCalculate Frame */
                        if (true == FlagLoop)
                        {                               /* Loop */
                            countLoopThisTime++;

                            /* ReCalculate Frame */
                            TimeAnimation += TimeAnimationFull;
                            FrameCountNow  = (int)(TimeAnimation / TimeFramePerSecond);
                            FlagReLoop     = (0.0f > TimeAnimation) ? true : false;

                            /* Set Instance Parts Restart Request */
                            Status |= BitStatus.REDECODE_INSTANCE;

                            /* Force-Decode UserData */
                            Status |= BitStatus.DECODE_USERDATA;
                        }
                        else
                        {                               /* End */
                            TimeAnimation = 0.0f;
                            FrameCountNow = 0;
//							Status &= ~BitStatus.PLAYING;
                            Status    |= BitStatus.REQUEST_PLAYEND;
                            FlagReLoop = false;
                        }
                    }
                }
            }
        }
        else
        {               /* Ping-Pong */
            if (0 == (Status & BitStatus.STYLE_REVERSE))
            {           /* Style-Normaly */
                FlagReLoop = true;
                while (true == FlagReLoop)
                {
                    FlagReLoop = false;

                    if (0 == (Status & BitStatus.PLAYING_REVERSE))
                    {                           /* Play foward */
                        if (FrameCountEnd < FrameCountNow)
                        {                       /* Frame-Over */
                                                /* Set Turn-Back */
                            Status |= BitStatus.PLAYING_REVERSE;

                            /* ReCalculate Frame */
                            TimeAnimation       -= TimeAnimationFull;
                            TimeAnimation        = TimeAnimationFull - TimeAnimation;
                            FrameCountNow        = (int)(TimeAnimation / TimeFramePerSecond);
                            flagTurnBackPingPong = true;

                            /* Force-Decode UserData */
                            Status |= BitStatus.DECODE_USERDATA;

                            /* Plural Loop Count Check */
                            FlagReLoop = ((TimeAnimationFull > TimeAnimation) && (0.0f <= TimeAnimation)) ? false : true;
                        }
                    }
                    else
                    {                           /* Play backwards */
                        if (0 > FrameCountNow)
                        {                       /* Frame-Over */
                            FlagLoop = true;

                            /* Loop-Count Check */
                            if (0 <= CountLoopRemain)
                            {                                   /* Limited-Count Loop */
                                CountLoopRemain--;
                                FlagLoop = (0 > CountLoopRemain) ? false : FlagLoop;
                            }

                            if (true == FlagLoop)
                            {                                   /* Loop */
                                countLoopThisTime++;

                                /* Set Turn-Back */
                                Status &= ~BitStatus.PLAYING_REVERSE;

                                /* ReCalculate Frame */
                                TimeAnimation       += TimeAnimationFull;
                                TimeAnimation        = TimeAnimationFull - TimeAnimation;
                                FrameCountNow        = (int)(TimeAnimation / TimeFramePerSecond);
                                flagTurnBackPingPong = true;

                                /* Set Instance Parts Restart Request */
                                Status |= BitStatus.REDECODE_INSTANCE;

                                /* Force-Decode UserData */
                                Status |= BitStatus.DECODE_USERDATA;

                                /* Plural Loop Count Check */
                                FlagReLoop = ((TimeAnimationFull > TimeAnimation) && (0.0f <= TimeAnimation)) ? false : true;
                            }
                            else
                            {                                   /* End */
                                TimeAnimation = 0.0f;
                                FrameCountNow = 0;
//								Status &= ~BitStatus.PLAYING;
                                Status    |= BitStatus.REQUEST_PLAYEND;
                                FlagReLoop = false;
                            }
                        }
                    }
                }
            }
            else
            {                   /* Style-Reverse */
                FlagReLoop = true;
                while (true == FlagReLoop)
                {
                    FlagReLoop = false;

                    if (0 != (Status & BitStatus.PLAYING_REVERSE))
                    {                           /* Play backwards */
                        if (0 > FrameCountNow)
                        {                       /* Frame-Over */
                                                /* Set Turn-Back */
                            Status &= ~BitStatus.PLAYING_REVERSE;

                            /* ReCalculate Frame */
                            TimeAnimation       += TimeAnimationFull;
                            TimeAnimation        = TimeAnimationFull - TimeAnimation;
                            FrameCountNow        = (int)(TimeAnimation / TimeFramePerSecond);
                            flagTurnBackPingPong = true;

                            /* Force-Decode UserData */
                            Status |= BitStatus.DECODE_USERDATA;

                            /* Plural Loop Count Check */
                            FlagReLoop = ((TimeAnimationFull > TimeAnimation) && (0.0f <= TimeAnimation)) ? false : true;
                        }
                    }
                    else
                    {                           /* Play foward */
                        if (FrameCountEnd < FrameCountNow)
                        {                       /* Frame-Over */
                            FlagLoop = true;

                            /* Loop-Count Check */
                            if (0 <= CountLoopRemain)
                            {                                   /* Limited-Count Loop */
                                CountLoopRemain--;
                                FlagLoop = (0 > CountLoopRemain) ? false : FlagLoop;
                            }

                            if (true == FlagLoop)
                            {                                   /* Loop */
                                countLoopThisTime++;

                                /* Set Turn-Back */
                                Status |= BitStatus.PLAYING_REVERSE;

                                /* ReCalculate Frame */
                                TimeAnimation       -= TimeAnimationFull;
                                TimeAnimation        = TimeAnimationFull - TimeAnimation;
                                FrameCountNow        = (int)(TimeAnimation / TimeFramePerSecond);
                                flagTurnBackPingPong = true;

                                /* Set Instance Parts Restart Request */
                                Status |= BitStatus.REDECODE_INSTANCE;

                                /* Force-Decode UserData */
                                Status |= BitStatus.DECODE_USERDATA;

                                /* Plural Loop Count Check */
                                FlagReLoop = ((TimeAnimationFull > TimeAnimation) && (0.0f <= TimeAnimation)) ? false : true;
                            }
                            else
                            {                                   /* End */
                                TimeAnimation = ((float)FrameCountEnd) * TimeFramePerSecond;
                                FrameCountNow = FrameCountEnd;
//								Status &= ~BitStatus.PLAYING;
                                Status    |= BitStatus.REQUEST_PLAYEND;
                                FlagReLoop = false;
                            }
                        }
                    }
                }
            }
        }

        /* Member-Valiables Update */
        int FrameNoNew = frameNoStart + FrameCountNow;

        if (FrameNoNew != frameNoNow)
        {
            Status |= BitStatus.DECODE_USERDATA;
        }
        frameNoPrevious = frameNoNow;
        frameNoNow      = FrameNoNew;

        /* Update User-CallBack */
        SpriteStudioData.UpdateUserData(frameNoNow, gameObject, this);

        /* Update GameObject */
        SpriteStudioData.UpdateGameObject(gameObject, frameNoNow, false);
    }
Exemplo n.º 5
0
    void LateUpdate()
    {
        /* Clear Finalize ListDrawMesh */
        if (null == arrayListMeshDraw)
        {
            arrayListMeshDraw = new Library_SpriteStudio.DrawManager.ArrayListMeshDraw();
            arrayListMeshDraw.BootUp();
            arrayListMeshDraw.RenderQueueSet(KindRenderQueueBase, OffsetDrawQueue);
        }
        arrayListMeshDraw.Clear();

        /* Collect Draw-Parts from Root-Parts */
        InformationDrawObject DrawObject = null;

        Library_SpriteStudio.DrawManager.ArrayListMeshDraw ArrayListMeshDrawObject = null;
        Library_SpriteStudio.DrawManager.ListMeshDraw      ListMeshDraw            = null;
        int Count = DrawEntryPartsRoot.Count;

        for (int i = 0; i < Count; i++)
        {
#if false
            /* MEMO: Non-Generic List-Class */
            DrawObject = DrawEntryPartsRoot[i] as InformationDrawObject;
#else
            DrawObject = DrawEntryPartsRoot[i];
#endif
            ArrayListMeshDrawObject = DrawObject.PartsRoot.ArrayListMeshDraw;
            int CountList = ArrayListMeshDrawObject.TableListMesh.Count;
            for (int j = 0; j < CountList; j++)
            {
                /* Add Mesh-List */
#if false
                /* MEMO: Non-Generic List-Class */
                ListMeshDraw = ArrayListMeshDrawObject.TableListMesh[j] as Library_SpriteStudio.DrawManager.ListMeshDraw;
#else
                ListMeshDraw = ArrayListMeshDrawObject.TableListMesh[j];
#endif
                arrayListMeshDraw.TableListMesh.Add(ListMeshDraw);
            }

            /* Clear Original Draw-List */
            DrawObject.PartsRoot.DrawListClear();
        }
        DrawEntryPartsRoot.Clear();

        /* Collect & Add Draw-Parts "Instance"-Object's Parts */
        Library_SpriteStudio.DrawManager.InformationMeshData InformationMeshData = null;
        Script_SpriteStudio_PartsRoot ScriptPartsRootSub = null;
        for (int i = 0; i < arrayListMeshDraw.TableListMesh.Count;)
        {
#if false
            /* MEMO: Non-Generic List-Class */
            ListMeshDraw = arrayListMeshDraw.TableListMesh[i] as Library_SpriteStudio.DrawManager.ListMeshDraw;
#else
            ListMeshDraw = arrayListMeshDraw.TableListMesh[i];
#endif
            if (null == ListMeshDraw)
            {
                arrayListMeshDraw.TableListMesh.RemoveAt(i);
                continue;
            }
            InformationMeshData = ListMeshDraw.MeshDataTop;
            if (null != InformationMeshData.PartsInstance)
            {
                Library_SpriteStudio.DrawManager.ListMeshDraw ListMeshDrawSub = null;
                ScriptPartsRootSub = InformationMeshData.PartsInstance.ScriptPartsRootSub;
                if (null != ScriptPartsRootSub)
                {                       /* Add Mesh-Table */
                                        /* Delete "Instance"-Data */
                    arrayListMeshDraw.TableListMesh.RemoveAt(i);

                    /* Insert "Instance"-Data's Draw-Mesh-List */
                    ArrayListMeshDrawObject = ScriptPartsRootSub.ArrayListMeshDraw;
                    for (int j = 0; j < ArrayListMeshDrawObject.TableListMesh.Count; j++)
                    {
#if false
                        /* MEMO: Non-Generic List-Class */
                        ListMeshDrawSub = ArrayListMeshDrawObject.TableListMesh[j] as Library_SpriteStudio.DrawManager.ListMeshDraw;
#else
                        ListMeshDrawSub = ArrayListMeshDrawObject.TableListMesh[j];
#endif
                        arrayListMeshDraw.TableListMesh.Insert((i + j), ListMeshDrawSub);
                    }

                    /* Clear Original Draw-List */
                    ScriptPartsRootSub.DrawListClear();
                    continue;
                }
            }
            i++;
        }

        /* Optimize Draw-Parts List */
        Library_SpriteStudio.DrawManager.ListMeshDraw ListMeshDrawNext = null;
#if false
        /* MEMO: Non-Generic List-Class */
        ArrayList TableListMesh = arrayListMeshDraw.TableListMesh;
#else
        List <Library_SpriteStudio.DrawManager.ListMeshDraw> TableListMesh = arrayListMeshDraw.TableListMesh;
#endif
        for (int i = 0; i < (TableListMesh.Count - 1);)
        {
            Count = i + 1;              /* "Count" is temporary */
#if false
            /* MEMO: Non-Generic List-Class */
            ListMeshDraw     = TableListMesh[i] as Library_SpriteStudio.DrawManager.ListMeshDraw;
            ListMeshDrawNext = TableListMesh[Count] as Library_SpriteStudio.DrawManager.ListMeshDraw;
#else
            ListMeshDraw     = TableListMesh[i];
            ListMeshDrawNext = TableListMesh[Count];
#endif
            if (ListMeshDraw.MaterialOriginal == ListMeshDrawNext.MaterialOriginal)
            {
                /* Mesh-List Merge */
                ListMeshDraw.ListMerge(ListMeshDrawNext);
                TableListMesh.RemoveAt(Count);

                /* Counter No-Incliment Continue */
                continue;
            }
            i++;
        }

        /* Counting Meshes */
        TableListMesh = arrayListMeshDraw.TableListMesh;
        Count         = TableListMesh.Count;
        int CountMesh = 0;
        for (int i = 0; i < Count; i++)
        {
#if false
            /* MEMO: Non-Generic List-Class */
            ListMeshDraw = TableListMesh[i] as Library_SpriteStudio.DrawManager.ListMeshDraw;
#else
            ListMeshDraw = TableListMesh[i];
#endif
            CountMesh += ListMeshDraw.Count;
        }

        /* Meshes Combine each Material & Set to MeshFilter/MeshRenderer */
        MeshFilter   InstanceMeshFilter   = GetComponent <MeshFilter>();
        MeshRenderer InstanceMeshRenderer = GetComponent <MeshRenderer>();
        arrayListMeshDraw.MeshSetCombine(InstanceMeshFilter, InstanceMeshRenderer, InstanceCameraDraw, transform);
    }