コード例 #1
0
    bool LoadNext()
    {
        if (levelLoadingComplete)
        {
            return(false);
        }
        var            integralParent     = GameObject.Find("Integral").transform;
        var            decoratationParent = GameObject.Find("Decoration").transform;
        LevelDataBlock block   = CurrentWorld.GetBlockAt(CurrentLoadingLayer, X, Y);
        var            GObject = CurrentLoadingLayer == BlockLayers.Integral ? GetObject(block) : GetDecoration(block);

        if (GObject != null)
        {
            var transform = GObject.transform;
            transform.position = new Vector3(-X * Grid_Size.x, transform.position.y, Y * Grid_Size.y);
            transform.rotation = Quaternion.identity;
            transform.parent   = CurrentLoadingLayer == BlockLayers.Integral ? integralParent : decoratationParent;
            float angle = 0;
            switch (block.Rotation)
            {
            case SRotation.NORTH: angle = 0;   break;

            case SRotation.EAST: angle = 90;   break;

            case SRotation.WEST: angle = -90;  break;

            case SRotation.SOUTH: angle = 180; break;
            }
            transform.RotateAround(transform.position, Vector3.up, angle);
        }
        LoadingPercentage = (((Y * Level.Columns) + X) / ((float)Level.Total * 2)) + (CurrentLoadingLayer == BlockLayers.Decoration ? .5f : 0.0f);
        return(true);
    }