public override void Update() { SetCheckGameObjectList(out List <GameObject> checkGameObjectList); foreach (GameObject rootGameObject in checkGameObjectList) { string name = GetShowRootGameObjectName(rootGameObject); Dictionary <string, object> partAndBoltDict = null; if (!reportDict.ContainsKey(name)) { partAndBoltDict = new Dictionary <string, object>(); reportDict.Add(name, partAndBoltDict); } else { partAndBoltDict = reportDict[name]; } // List<GameObject> allBoltPmGameObjectList = GameObjectUtil.GetChildGameObjectLikeName(rootGameObject, "boltpm"); List <GameObject> allBoltPmGameObjectList = GameObjectUtil.FindChildGameObjectByLikeName(rootGameObject, "boltpm"); if (partAndBoltDict.ContainsKey(CarReport.BOLT_COUNT)) { partAndBoltDict[CarReport.BOLT_COUNT] = allBoltPmGameObjectList.Count; } else { partAndBoltDict.Add(CarReport.BOLT_COUNT, allBoltPmGameObjectList.Count); } // 部件GameObject -> 螺栓GameObject List Dictionary <GameObject, List <GameObject> > partDict = new Dictionary <GameObject, List <GameObject> >(); if (partAndBoltDict.ContainsKey(CarReport.PART_AND_BOLT)) { partAndBoltDict[CarReport.PART_AND_BOLT] = partDict; } else { partAndBoltDict.Add(CarReport.PART_AND_BOLT, partDict); } // 部件GameObject -> 其它属性 Dictionary <GameObject, Dictionary <string, object> > partAttrDict = new Dictionary <GameObject, Dictionary <string, object> >(); if (partAndBoltDict.ContainsKey(CarReport.PART_ATTR)) { partAndBoltDict[CarReport.PART_ATTR] = partAttrDict; } else { partAndBoltDict.Add(CarReport.PART_ATTR, partAttrDict); } foreach (GameObject booltPmGameObject in allBoltPmGameObjectList) { FsmGameObject partFsmGameObject = GameObjectUtil.GetPlayMakerFSMGameObject(booltPmGameObject, "screw", "PartAssembled"); if (partFsmGameObject != null && partFsmGameObject.Value != null) { if (partDict.ContainsKey(partFsmGameObject.Value)) { partDict[partFsmGameObject.Value].Add(booltPmGameObject); } else { partDict.Add(partFsmGameObject.Value, new List <GameObject>() { booltPmGameObject }); } } } foreach (GameObject partGameObject in partDict.Keys) { PlayMakerFSM[] partAssembledPlayMakerFSMArray = partGameObject.GetComponents <PlayMakerFSM>(); FsmFloat fsmFloatTightness = null; FsmFloat fsmFloatTireHealth = null; Dictionary <string, object> partAttrDataDict = new Dictionary <string, object>(); foreach (PlayMakerFSM playMakerFSM in partAssembledPlayMakerFSMArray) { if (playMakerFSM != null && playMakerFSM.FsmName != null && ( playMakerFSM.FsmName.ToLower().Equals("use") || playMakerFSM.FsmName.ToLower().Equals("boltcheck") ) ) { fsmFloatTightness = playMakerFSM.FsmVariables.FindFsmFloat("Tightness"); fsmFloatTireHealth = playMakerFSM.FsmVariables.FindFsmFloat("TireHealth"); } } if (partAttrDict.ContainsKey(partGameObject)) { partAttrDict[partGameObject] = partAttrDataDict; } else { partAttrDict.Add(partGameObject, partAttrDataDict); } if (partAttrDataDict.ContainsKey(CarReport.FSM_FLOAT_TIGHTNESS)) { partAttrDataDict[CarReport.FSM_FLOAT_TIGHTNESS] = fsmFloatTightness; } else { partAttrDataDict.Add(CarReport.FSM_FLOAT_TIGHTNESS, fsmFloatTightness); } if (partAttrDataDict.ContainsKey(CarReport.FSM_FLOAT_TIREHEALTH)) { partAttrDataDict[CarReport.FSM_FLOAT_TIREHEALTH] = fsmFloatTireHealth; } else { partAttrDataDict.Add(CarReport.FSM_FLOAT_TIREHEALTH, fsmFloatTireHealth); } } } }