void InitLevelData() { levelData = levelDataSheet.sheets[0].list[round]; timeLimit = levelData.time_limit; score = 0; this.curSprayRemain = this.sprayUsageRemain; canUseSpray = true; //stopWatch = new StopWatch(levelData.time_limit); }
void InitLevelData() { levelData = levelDataSheet.sheets[0].list[round]; timeLimit = levelData.time_limit; score = 0; this.curSprayRemain = this.sprayUsageRemain; canUseSpray = true; //stopWatch = new StopWatch(levelData.time_limit); }
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (string asset in importedAssets) { if (!filePath.Equals(asset)) { continue; } Entity_LevelData data = (Entity_LevelData)AssetDatabase.LoadAssetAtPath(exportPath, typeof(Entity_LevelData)); if (data == null) { data = ScriptableObject.CreateInstance <Entity_LevelData> (); AssetDatabase.CreateAsset((ScriptableObject)data, exportPath); data.hideFlags = HideFlags.NotEditable; } data.sheets.Clear(); using (FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read)) { IWorkbook book = new HSSFWorkbook(stream); foreach (string sheetName in sheetNames) { ISheet sheet = book.GetSheet(sheetName); if (sheet == null) { Debug.LogError("[QuestData] sheet not found:" + sheetName); continue; } Entity_LevelData.Sheet s = new Entity_LevelData.Sheet(); s.name = sheetName; for (int i = 1; i <= sheet.LastRowNum; i++) { IRow row = sheet.GetRow(i); ICell cell = null; Entity_LevelData.Param p = new Entity_LevelData.Param(); cell = row.GetCell(0); p.stage = (int)(cell == null ? 0 : cell.NumericCellValue); cell = row.GetCell(1); p.yogore_count = (int)(cell == null ? 0 : cell.NumericCellValue); cell = row.GetCell(2); p.time_limit = (int)(cell == null ? 0 : cell.NumericCellValue); s.list.Add(p); } data.sheets.Add(s); } } ScriptableObject obj = AssetDatabase.LoadAssetAtPath(exportPath, typeof(ScriptableObject)) as ScriptableObject; EditorUtility.SetDirty(obj); } }
public void InitStage(int index) { this.isClear = false; // select data levelData = levelSheetData.sheets[0].list[index]; // instantiate YOGOREs var yogores = new List <Transform>(); for (int i = 0; i < levelData.yogore_count; i++) { yogores.Add(Instantiate(yogore) as Transform); } yogoreCount = yogores.Count; // layout circlely. float angleDiff = 360f / yogores.Count; for (int i = 0; i < yogores.Count; i++) { var pos = center; float angle = (90 - angleDiff * i) * Mathf.Deg2Rad; angle += Random.Range(angleRandomMin, angleRandomMax); pos.x += radius * Mathf.Cos(angle); if (minXForBenza != -1) { pos.x = Mathf.Max(pos.x, minXForBenza); } if (maxXForBenza != -1) { pos.x = Mathf.Min(pos.x, maxXForBenza); } pos.x += Random.Range(-10, 10f); pos.z += radius * Mathf.Sin(angle); if (minZForBenza != -1) { pos.z = Mathf.Max(pos.z, minZForBenza); } if (maxZForBenza != -1) { pos.z = Mathf.Min(pos.z, maxZForBenza); } pos.z += Random.Range(-10, 10f); yogores[i].transform.position = pos; } }
static void OnPostprocessAllAssets (string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (string asset in importedAssets) { if (!filePath.Equals (asset)) continue; Entity_LevelData data = (Entity_LevelData)AssetDatabase.LoadAssetAtPath (exportPath, typeof(Entity_LevelData)); if (data == null) { data = ScriptableObject.CreateInstance<Entity_LevelData> (); AssetDatabase.CreateAsset ((ScriptableObject)data, exportPath); data.hideFlags = HideFlags.NotEditable; } data.sheets.Clear (); using (FileStream stream = File.Open (filePath, FileMode.Open, FileAccess.Read)) { IWorkbook book = new HSSFWorkbook (stream); foreach(string sheetName in sheetNames) { ISheet sheet = book.GetSheet(sheetName); if( sheet == null ) { Debug.LogError("[QuestData] sheet not found:" + sheetName); continue; } Entity_LevelData.Sheet s = new Entity_LevelData.Sheet (); s.name = sheetName; for (int i=1; i<= sheet.LastRowNum; i++) { IRow row = sheet.GetRow (i); ICell cell = null; Entity_LevelData.Param p = new Entity_LevelData.Param (); cell = row.GetCell(0); p.stage = (int)(cell == null ? 0 : cell.NumericCellValue); cell = row.GetCell(1); p.yogore_count = (int)(cell == null ? 0 : cell.NumericCellValue); cell = row.GetCell(2); p.time_limit = (int)(cell == null ? 0 : cell.NumericCellValue); s.list.Add (p); } data.sheets.Add(s); } } ScriptableObject obj = AssetDatabase.LoadAssetAtPath (exportPath, typeof(ScriptableObject)) as ScriptableObject; EditorUtility.SetDirty (obj); } }
public void InitStage(int index) { this.isClear = false; // select data levelData = levelSheetData.sheets[0].list[index]; // instantiate YOGOREs var yogores = new List<Transform>(); for (int i = 0; i < levelData.yogore_count; i++) { yogores.Add(Instantiate(yogore) as Transform); } yogoreCount = yogores.Count; // layout circlely. float angleDiff = 360f / yogores.Count; for (int i = 0; i < yogores.Count; i++) { var pos = center; float angle = (90 - angleDiff * i) * Mathf.Deg2Rad; angle += Random.Range(angleRandomMin, angleRandomMax); pos.x += radius * Mathf.Cos(angle); if (minXForBenza != -1) pos.x = Mathf.Max(pos.x, minXForBenza); if (maxXForBenza != -1) pos.x = Mathf.Min(pos.x, maxXForBenza); pos.x += Random.Range(-10, 10f); pos.z += radius * Mathf.Sin(angle); if (minZForBenza != -1) pos.z = Mathf.Max(pos.z, minZForBenza); if (maxZForBenza != -1) pos.z = Mathf.Min(pos.z, maxZForBenza); pos.z += Random.Range(-10, 10f); yogores[i].transform.position = pos; } }