Exemplo n.º 1
0
 protected void EncodeOffspringData()
 {
     OffspringData = new UrbObjectData[OffspringObjects.Length];
     for (int o = 0; o < OffspringObjects.Length; o++)
     {
         OffspringData[o] = UrbEncoder.Read(OffspringObjects[o]);
     }
 }
Exemplo n.º 2
0
    public UrbTileData GetTileData()
    {
        UrbTileData output = new UrbTileData();

        if (Links.Length > 0)
        {
            List <UrbTileLinkData> WorkingList = new List <UrbTileLinkData>();
            foreach (var link in Links)
            {
                if (link == null)
                {
                    continue;
                }

                UrbTileLinkData TempLink = new UrbTileLinkData();
                TempLink.MapID = UrbSystemIO.GetMapID(link.OwningMap);
                TempLink.X     = link.XAddress;
                TempLink.Y     = link.YAddress;
                WorkingList.Add(TempLink);
            }
            output.Links = WorkingList.ToArray();
        }
        else
        {
            output.Links = new UrbTileLinkData[0];
        }

        if (Contents.Count > 0)
        {
            output.Contents = new int[Contents.Count];
            output.Objects  = new UrbObjectData[Contents.Count];
            for (int c = 0; c < Contents.Count; c++)
            {
                output.Contents[c] = UrbSystemIO.GetAgentID(Contents[c]);
                output.Objects[c]  = UrbEncoder.Read(Contents[c].gameObject);
            }
        }
        else
        {
            output.Contents = new int[0];
        }

        output.Blocked = Blocked;

        output.Environment = Environment.GetEnvironmentData();

        return(output);
    }