public SceneContentData(CurrentSceneManager currentSceneManager) { List <MonoBehaviour> transformSaveHolders = currentSceneManager.GetTransformSaveHolders(); transformSaveHoldersData = new TransformSaveHolderData[transformSaveHolders.Count]; int i = 0; foreach (MonoBehaviour transformSaveHolder in transformSaveHolders) { transformSaveHoldersData[i] = new TransformSaveHolderData(transformSaveHolder); i++; } Movable[] movables = currentSceneManager.GetMovableObjects(); movablesData = new MovableData[movables.Length]; i = 0; foreach (Movable movable in movables) { movablesData[i] = new MovableData(movable); i++; } AutoMoving[] autoMovings = currentSceneManager.GetAutoMovingObjects(); autoMovingsData = new AutoMovingData[autoMovings.Length]; i = 0; foreach (AutoMoving autoMoving in autoMovings) { autoMovingsData[i] = new AutoMovingData(autoMoving); i++; } EnnemyController[] ennemies = currentSceneManager.GetEnnemies(); ennemiesData = new EnnemyData[ennemies.Length]; i = 0; foreach (EnnemyController movable in ennemies) { ennemiesData[i] = new EnnemyData(movable); i++; } }
public void RebuildEnnemies(SceneContentData currentSceneContentData, CurrentSceneManager currentSceneManager) { foreach (SceneContentData.EnnemyData ennemyData in currentSceneContentData.ennemiesData) { foreach (EnnemyController ennemyController in currentSceneManager.GetEnnemies()) { if (Helper.GetObjectLocalIdInFile(ennemyController) == ennemyData.localIdInFile) { PrepareDataForEntity(ennemyController, delegate() { ennemyController.averageMoveTime = ennemyData.averageMoveTime; ennemyController.betweenMovesAverageTime = ennemyData.betweenMovesAverageTime; ennemyController.TimeBetweenMovesCounter = ennemyData.TimeBetweenMovesCounter; ennemyController.MoveTimeCounter = ennemyData.MoveTimeCounter; }); } } } }