Ejemplo n.º 1
0
 public static void ApplyDataToGameObject(GameObject obj, CompoundDataPiece piece)
 {
     foreach (var participant in obj.GetComponents <Participant>())
     {
         if (HasValidDataForParticipant(participant, piece))
         {
             participant.ReadData(ExtendedDataUtils.GetPieceForParticipantFromRoot(participant, piece));
         }
     }
 }
Ejemplo n.º 2
0
        public static CompoundDataPiece ReadDataFromGameObject(GameObject obj)
        {
            var newCompound = new CompoundDataPiece("root");

            foreach (var participant in obj.GetComponents <Participant>())
            {
                participant.WriteData(ExtendedDataUtils.GetPieceForParticipantFromRoot(participant, newCompound));
            }

            return(newCompound);
        }
Ejemplo n.º 3
0
        static bool ValidateParticipant(ExtendedData.Participant p, CompoundDataPiece piece)
        {
            var modid = ExtendedDataUtils.GetModForParticipant(p)?.ModInfo.Id ?? "srml";

            return(p.IsDataValid(ExtendedDataUtils.GetPieceForParticipantFromRoot(modid, p, piece)));
        }
Ejemplo n.º 4
0
        static void InitParticipant(ExtendedData.Participant p, CompoundDataPiece piece)
        {
            var modid = ExtendedDataUtils.GetModForParticipant(p)?.ModInfo.Id ?? "srml";

            p.InitData(ExtendedDataUtils.GetPieceForParticipantFromRoot(modid, p, piece));
        }