static void setCurrentSystem(MWB_System system) { s_CurrSystem = system; if (s_CurrSystem != null) { s_SimulatedObjects = s_CurrSystem.GetObjectList(); s_SimulatedObjectsName = new List <string>(); foreach (var obj in s_SimulatedObjects.MWB_Objects) { s_SimulatedObjectsName.Add(obj.gameObject.name); } s_CurrSystem.OnSystemBegin += Instance.onSystemBegin; s_CurrSystem.OnSystemUpdateProgress += Instance.onSystemUpdateProgress; s_CurrSystem.OnSystemComplete += Instance.onSystemComplete; s_CurrSystem.OnSystemForcedTerminate += Instance.onSystemtTerminate; } else { s_SimulatedObjects = null; s_SimulatedObjectsName.Clear(); } initAnimationView(); }
private MWB_DummyObjectList GenerateDummyObjects(MWB_ObjectList objectList, bool isInitializedAsAble) { MWB_DummyObjectList dummyObjectList = new MWB_DummyObjectList(); GameObject parent = new GameObject("initial dummy parent"); parent.transform.parent = dummyMasterParent.transform; // !!! IMPORTANT parent.transform.localPosition = transform.localPosition; parent.transform.localRotation = transform.localRotation; parent.transform.localScale = transform.localScale; // add parent to dummyParent list for clean up ! dummyParentList.Add(parent); // foreach (MWB_Object mwbObject in objectList.MWB_Objects) { GameObject forkedObject = Instantiate(mwbObject.gameObject, parent.transform); // Set layer forkedObject.layer = MWBWaitingLayer; forkedObject.SetActive(isInitializedAsAble); // turning MWB_Object to Dummy Object Destroy(forkedObject.GetComponent <MWB_Object>()); var dummy = forkedObject.AddComponent <MWB_DummyObject>(); dummy.Manager = this; // record object source dummy.objectSource = mwbObject; // record fork source ( initial object has null ) dummy.forkedSource = null; //record corresponding dummy list dummy.correspondingDummyList = dummyObjectList; // set pathIndex //dummy.pathIndex = 0; // record previous transform data segment (initial dummy object has null) dummy.transformDataSegment.previousSegment = null; // use main path to generate sub path dummy.SetSubPath(mwbObject.CurrentMainPath); // assign reference of dummy to path dummy.dummyMainPath.SourceDummyObject = dummy; // dummyObjectList.AddToDummyObjectList(dummy); } return(dummyObjectList); }