public void SaveStaticObject(SerializedStaticObject.SendMessageStruct param) { param.SetComponentResult(className, false); var id = GetComponent <UniqueId>().ID; var units = GetComponentsInChildren <SerializedDynamicObject>(); if (!DictionaryTools <string, object> .TryToAdd(ref param.dictionary, className + "[" + id + "]._numberUnits", _numberUnits, true)) { return; } var teamPrefix = className + "[" + id + "]"; int index = 0; foreach (var unit in units) { if (!AddUnitToDictionary(unit, teamPrefix, index++, ref param.dictionary)) { return; } } param.SetComponentResult(className, DictionaryTools <string, object> .TryToAdd(ref param.dictionary, className + "[" + id + "].numActiveUnits", index, true)); }
private bool AddUnitToDictionary(SerializedDynamicObject unit, string teamPrefix, int index, ref Dictionary <string, object> dictionary) { var prefix = teamPrefix + ".object[" + index + "]"; if (!DictionaryTools <string, object> .TryToAdd(ref dictionary, prefix + ".prefabName", unit.PrefabName, true)) { return(false); } return(unit.SaveObject(new KeyValuePair <string, Dictionary <string, object> >(prefix, dictionary))); }
public void SaveStaticObject(SerializedStaticObject.SendMessageStruct param) { var id = GetComponent <UniqueId>().ID; param.SetComponentResult(className, DictionaryTools <string, object> .TryToAdd(ref param.dictionary, className + "[" + id + "]._numEmited", _numEmited, true)); }