public void NewScene (ISSCBlockVector size, string name){ data = new ISSCBGrid (size); data.name = name; data.SetBlock (data.GetCenterBlock (), rootBlock); Debug.Log ("New Scene Created"); editorCamera.SetViewPoint (ISSCBGrid.GridPositionToWorldPosition (data.GetCenterBlock (), moniter.transform.position)); moniter.SwitchDataSet (data); }
public void NewScene(ISSCBlockVector size, string name) { data = new ISSCBGrid(size); data.name = name; data.SetBlock(data.GetCenterBlock(), rootBlock); Debug.Log("New Scene Created"); editorCamera.SetViewPoint(ISSCBGrid.GridPositionToWorldPosition(data.GetCenterBlock(), moniter.transform.position)); moniter.SwitchDataSet(data); }
public static void CreateCube (ISSCBGrid grid, int fillWith, ISSCBlockVector from, ISSCBlockVector to) { if (!grid.IsBlockAvailable (from)) return; if (!grid.IsBlockAvailable (to)) return; ISSCBlockVector[] bvs = grid.BlocksOverlapCube(from,to); foreach(ISSCBlockVector bv in bvs){ grid.SetBlock(bv,fillWith); } return; }
// public static bool CreatePrimitive (ISSCBGrid grid, ModuleType moduleType, ISSCBlockVector origin, float radius, float height,Vector3 direction) // { // if (moduleType != ModuleType.Cone) // return false; // if (!grid.IsBlockAvailable (origin)) // return false; // if (radius <= 0 || height <= 0) // return false; // return true; // // // } public static void CreateCylinder (ISSCBGrid grid, int fillWith, ISSCBlockVector origin, float radius, float height) { if (!grid.IsBlockAvailable (origin)) return; if (radius <= 0 || height <= 0) return; ISSCBlockVector[] bvs = grid.BlocksOverlapCylinder(origin,radius,height); foreach(ISSCBlockVector bv in bvs){ grid.SetBlock(bv,fillWith); } return; }
public static void CreateSphere (ISSCBGrid grid, ISSCBlockVector origin, int fillWith, float radius) { if (!grid.IsBlockAvailable (origin)) { Debug.LogError("Failed to create primitive : Not enough spaces"); return; } if (radius <= 0) return; ISSCBlockVector[] bvs = grid.BlocksOverlapSphere(origin,radius); foreach(ISSCBlockVector bv in bvs){ grid.SetBlock(bv,fillWith); } }
public static void CreateSphere(ISSCBGrid grid, ISSCBlockVector origin, int fillWith, float radius) { if (!grid.IsBlockAvailable(origin)) { Debug.LogError("Failed to create primitive : Not enough spaces"); return; } if (radius <= 0) { return; } ISSCBlockVector[] bvs = grid.BlocksOverlapSphere(origin, radius); foreach (ISSCBlockVector bv in bvs) { grid.SetBlock(bv, fillWith); } }
static ISSCBGrid DecodeJson(string data){ JsonData json = JsonMapper.ToObject (data); int vectorX,vectorY,vectorZ; vectorX = int.Parse(json["size"]["x"].ToString()); vectorY = int.Parse(json["size"]["y"].ToString()); vectorZ = int.Parse(json["size"]["z"].ToString()); ISSCBlockVector size = new ISSCBlockVector(vectorX,vectorY,vectorZ); ISSCBGrid grid = new ISSCBGrid(size); grid.name = json ["name"].ToString (); for(int i =0 ;i< grid.GetRawData().Length;i++){ grid.SetBlock(grid.DecodeIndex(i),int.Parse(json["blocks"][i.ToString()].ToString()));//? } return grid; }
// public static bool CreatePrimitive (ISSCBGrid grid, ModuleType moduleType, ISSCBlockVector origin, float radius, float height,Vector3 direction) // { // if (moduleType != ModuleType.Cone) // return false; // if (!grid.IsBlockAvailable (origin)) // return false; // if (radius <= 0 || height <= 0) // return false; // return true; // // // } public static void CreateCylinder(ISSCBGrid grid, int fillWith, ISSCBlockVector origin, float radius, float height) { if (!grid.IsBlockAvailable(origin)) { return; } if (radius <= 0 || height <= 0) { return; } ISSCBlockVector[] bvs = grid.BlocksOverlapCylinder(origin, radius, height); foreach (ISSCBlockVector bv in bvs) { grid.SetBlock(bv, fillWith); } return; }
public static void CreateCube(ISSCBGrid grid, int fillWith, ISSCBlockVector from, ISSCBlockVector to) { if (!grid.IsBlockAvailable(from)) { return; } if (!grid.IsBlockAvailable(to)) { return; } ISSCBlockVector[] bvs = grid.BlocksOverlapCube(from, to); foreach (ISSCBlockVector bv in bvs) { grid.SetBlock(bv, fillWith); } return; }
static ISSCBGrid DecodeJson(string data) { JsonData json = JsonMapper.ToObject(data); int vectorX, vectorY, vectorZ; vectorX = int.Parse(json["size"]["x"].ToString()); vectorY = int.Parse(json["size"]["y"].ToString()); vectorZ = int.Parse(json["size"]["z"].ToString()); ISSCBlockVector size = new ISSCBlockVector(vectorX, vectorY, vectorZ); ISSCBGrid grid = new ISSCBGrid(size); grid.name = json ["name"].ToString(); for (int i = 0; i < grid.GetRawData().Length; i++) { grid.SetBlock(grid.DecodeIndex(i), int.Parse(json["blocks"][i.ToString()].ToString())); //? } return(grid); }
public void PlaceBlockWithCurrentSetting(ISSCBlockVector block) { data.SetBlock(block, currentFillingBlock); }