Esempio n. 1
0
//	void Update()
//	{
//	}

    void LateUpdate()
    {
        float TimeDelta = Time.deltaTime * RateSpeed;

        if ((null == DataEffect) || (null == DataCellMap))
        {
            return;
        }

        /* DrawManager Get */
        if ((null == InstanceManagerDraw) && (null == InstanceRootParent))
        {               /* MEMO: "Instance" and "Effect" cannot have Manager-Draw. */
            InstanceManagerDraw = Library_SpriteStudio.Utility.Parts.ManagerDrawGetParent(gameObject);
        }

        /* DrawParts-Cluster Create */
        LateUpdateBase();

        /* Animation Play-Check */
        if (0 == (Status & FlagBitStatus.PLAYING))
        {               /* Not-Playing */
            return;
        }

        /* Particle&Emitter Control WorkArea Create */
        if (null == PoolParts)
        {
            PoolBootUpParts();
        }

        /* Update Emitter & Particle */
        ChainClusterDrawParts.ChainCleanUp();           /* DrawParts-Cluster-Chain Clear */
        TimeElapsed += ((0 != (Status & FlagBitStatus.PAUSING)) || (0 != (Status & FlagBitStatus.PLAYING_START))) ? 0.0f : TimeDelta;
        FrameNow     = TimeElapsed * RateTimeToFrame;
        if (0 != (Status & FlagBitStatus.PLAYING_INFINITY))
        {               /* Independent */
//			FrameNow %= FrameLength;
        }
        else
        {               /* Dependent */
            FrameNow = Mathf.Clamp(FrameNow, 0.0f, FrameLength);
        }
        PoolParts.Update(this);

        /* Set to DrawManager */
        /* MEMO: Test */
        if (((null != InstanceManagerDraw) && (null != DrawObject)) && (false == FlagHideForce))
        {
            /* Set To Draw-Manager */
            InstanceManagerDraw.DrawSet(this);
        }

        /* Status Update */
        Status &= ~FlagBitStatus.PLAYING_START;
        Status &= ~FlagBitStatus.CELL_TABLECHANGED;
    }
//	void Update()
//	{
//	}

    void LateUpdate()
    {
        float TimeDelta = Time.deltaTime * RateSpeed;

        if ((null == DataEffect) || (null == DataCellMap))
        {
            return;
        }

        /* DrawManager Get */
        if ((null == InstanceManagerDraw) && (null == InstanceRootParent))
        {               /* MEMO: "Instance" and "Effect" cannot have Manager-Draw. */
            InstanceManagerDraw = Library_SpriteStudio.Utility.Parts.ManagerDrawGetParent(gameObject);
        }

        /* DrawParts-Cluster Create */
        LateUpdateBase();

        /* Animation Play-Check */
        if (0 == (Status & FlagBitStatus.PLAYING))
        {               /* Not-Playing */
            return;
        }
        bool FlagPause = (0 != (Status & FlagBitStatus.PAUSING)) ? true : false;

        /* Random Create */
        if (null == InstanceRandom)
        {
            InstanceRandom = new RandomGenerator();
            SeedRandom     = (uint)SeedRandomInitialize;
            InstanceRandom.InitSeed(SeedRandom);
        }

        /* Particle&Emitter Control WorkArea Create */
        if (null == PoolParts)
        {
            PoolBootUpParts();
        }
        if (0 != (Status & FlagBitStatus.PLAYING_START))
        {               /* Root's Emitter Generate */
            PoolParts.PartsGenerate(null, this);
        }

        /* Update Emitter & Particle */
        ChainClusterDrawParts.ChainCleanUp();           /* DrawParts-Cluster-Chain Clear */

        TimeElapsed += TimeDelta;
        int Index             = 0;
        int CountExecuteParts = 0;

        Library_SpriteStudio.Control.PartsEffect InstanceParts = null;
        for ( ; ;)
        {
            InstanceParts = PoolParts.InstancePeekRunning(ref Index);
            if (null == InstanceParts)
            {
                break;
            }
            if (false == InstanceParts.Update(ref CountExecuteParts, TimeDelta, PoolParts, FlagPause))
            {                   /* Duration is over. (Delete) */
                PoolParts.InstanceSetWaiting(ref Index);
            }
        }
        Status &= ~FlagBitStatus.PLAYING_START;

        /* End Check */
        if (0 >= CountExecuteParts)
        {               /* All Emitter & Particle is waiting ... Play-End */
            if (null != FunctionPlayEnd)
            {
                if (false == FunctionPlayEnd(this))
                {                       /* Destroy (Request) */
                                        /* MEMO: Destroy at end of "LateUpdate" */
                    Status |= FlagBitStatus.REQUEST_DESTROY;
                }
            }
            AnimationStop();
        }
        else
        {
            /* Set to DrawManager */
            /* MEMO: Test */
            if (((null != InstanceManagerDraw) && (null != DrawObject)) && (false == FlagHideForce))
            {
                /* Set To Draw-Manager */
                InstanceManagerDraw.DrawSet(this);
            }
        }

        /* Checking Destroy-Request */
        if (0 != (Status & FlagBitStatus.REQUEST_DESTROY))
        {
            Object.Destroy(gameObject);
        }
    }