private static void AddFields(Snapshot snapshot, List <FieldSnapshot> fields)
 {
     foreach (var f in fields)
     {
         snapshot.AddEntity(FieldTemplate.CreateFieldEntityTemplate(f.pos.ToCoordinates(), f.range, f.highest, f.materialType, f.seeds));
     }
 }
示例#2
0
        public virtual Snapshot GenerateSnapshot()
        {
            var snapshot = SnapshotUtils.GenerateGroundSnapshot(this.WorldSize, this.GetHeight);

            foreach (var t in Towers)
            {
                snapshot.AddEntity(SymbolicTowerTemplate.CreateSymbolicTowerEntityTemplate(t.pos.ToCoordinates(), t.height, t.radius, t.side));
            }

            foreach (var f in Fields)
            {
                snapshot.AddEntity(FieldTemplate.CreateFieldEntityTemplate(f.pos.ToCoordinates(), f.range, f.highest, f.materialType, f.seeds));
            }

            foreach (var u in Units)
            {
                var template = BaseUnitTemplate.CreateBaseUnitEntityTemplate(u.side, u.type, SnapshotUtils.GroundCoordinates(u.pos.x, u.pos.y, u.pos.z, this.IsBuilding(u.type) == false), u.rotate.ToCompressedQuaternion());
                if (u.attachments != null)
                {
                    foreach (var attach in u.attachments)
                    {
                        attach.AddComponent(template);
                    }
                }

                snapshot.AddEntity(template);
            }

            return(snapshot);
        }
 private static void AddField(Snapshot snapshot, Coordinates location)
 {
     snapshot.AddEntity(FieldTemplate.CreateFieldEntityTemplate(location, 3000, 500, FieldMaterialType.None));
 }