コード例 #1
0
 public void ClearField()
 {
     foreach (var root in Roots.Root.Values.ToArray())
     {
         root.Destroy();
     }
     foreach (var block in FieldMatrix.GetAllAsList())
     {
         block.Destroy();
     }
 }
コード例 #2
0
ファイル: GameSerialized.cs プロジェクト: makscee/prototype-1
    public static GameSerialized Create()
    {
        var result = new GameSerialized
        {
            NodeBlocks    = new List <NodeBlockSerialized>(),
            RootBlocks    = new List <RootBlockSerialized>(),
            Binds         = new List <BindSerialized>(),
            SoundsPlayers = new List <SoundsPlayerSerialized>(),
        };

        foreach (var block in FieldMatrix.GetAllAsList())
        {
            switch (block)
            {
            case NodeBlock nodeBlock:
            {
                if (NodeBlockSerialized.Create(nodeBlock, out var t))
                {
                    result.NodeBlocks.Add(t);
                }
                break;
            }

            case RootBlock rootBlock:
            {
                if (RootBlockSerialized.Create(rootBlock, out var t))
                {
                    result.RootBlocks.Add(t);
                }
                break;
            }
            }
        }
        foreach (var bind in BindMatrix.GetAllAsList())
        {
            if (BindSerialized.Create(bind, out var t))
            {
                result.Binds.Add(t);
            }
        }
        foreach (var root in Roots.Root.Values)
        {
            if (SoundsPlayerSerialized.Create(root.block.soundsPlayer, root.block.rootId, out var t))
            {
                result.SoundsPlayers.Add(t);
            }
        }
        return(result);
    }