コード例 #1
0
            void AllocEntities()
            {
                var entities = RootNode.GetNode <YamlSequenceNode>("entities");

                foreach (var entityDef in entities.Cast <YamlMappingNode>())
                {
                    var type   = entityDef.GetNode("type").AsString();
                    var entity = _serverEntityManager.AllocEntity(type);
                    Entities.Add(entity);
                    if (entityDef.TryGetNode("name", out var nameNode))
                    {
                        entity.Name = nameNode.AsString();
                    }
                }
            }
コード例 #2
0
            private void AllocEntities()
            {
                var entities = RootNode.GetNode <YamlSequenceNode>("entities");

                foreach (var entityDef in entities.Cast <YamlMappingNode>())
                {
                    var type = entityDef.GetNode("type").AsString();
                    var uid  = Entities.Count;
                    if (entityDef.TryGetNode("uid", out var uidNode))
                    {
                        uid = uidNode.AsInt();
                    }
                    var entity = _serverEntityManager.AllocEntity(type);
                    Entities.Add(entity);
                    UidEntityMap.Add(uid, entity.Uid);
                }
            }