// Use this for initialization void Start() { //UserData.ResetUserData(); m_BG = GetComponent <BoxGenerator>(); m_InfoBar = GameObject.FindGameObjectWithTag("InfoBar").GetComponent <InfoBar>(); m_ConfirmPanel = GameObject.Find("ConfirmPanel").GetComponentInChildren <ConfirmPanel>(); }
// Use this for initialization void Start() { GameObject gc = GameObject.FindGameObjectWithTag("GameController"); m_BG = gc.GetComponent <BoxGenerator>(); //寬度是偶數行時需shift,特效跟消融方塊的區域重疊位置才會一樣 float offsetX = 0, offsetY = 0; if (m_Size % 2 == 0) { offsetX = 0.5f; offsetY = 0.5f; } Coord2D coord = m_BG.PosToCoord(new Vector2(transform.localPosition.x + offsetX, transform.localPosition.y + offsetY)); if (coord.x != -1 && coord.y != -1) { int halfSize = m_Size >> 1; for (int x = coord.x - halfSize; x < coord.x - halfSize + m_Size; x++) { for (int y = coord.y - halfSize; y < coord.y - halfSize + m_Size; y++) { Coord2D targetCoord = new Coord2D(x, y); GameObject element = m_BG.GetElementByCoord(targetCoord); if (element != null) { BoxElementControl control = element.GetComponent <BoxElementControl>(); control.DestroyElement(); } } } } }
// Use this for initialization void Start() { GameObject gc = GameObject.FindGameObjectWithTag("GameController"); m_BG = gc.GetComponent <BoxGenerator>(); m_BG.m_EarthSkill = this; m_CamPos = Camera.main.transform.position; }
private List <Line> CreateOutline(string[] commandArgs, Position position, List <SavedPosition> savedPositions, List <Line> lines) { IGenerator generator; ISquareOptions walls = new Options(); walls.Fill = false; switch (commandArgs.Length) { // width height block [postition] case 5: walls.Width = commandArgs[1].ToInt(); walls.Length = commandArgs[2].ToInt(); walls.Height = commandArgs[3].ToInt(); walls.Block = commandArgs[4]; walls.CenterX = position.X; walls.CenterY = position.Y; walls.CenterZ = position.Z; break; case 6: walls.Width = commandArgs[1].ToInt(); walls.Length = commandArgs[2].ToInt(); walls.Height = commandArgs[3].ToInt(); walls.Block = commandArgs[4]; var center = savedPositions.Single(a => a.Name.Equals(commandArgs[5])).Position; walls.CenterX = center.X; walls.CenterY = center.Y; walls.CenterZ = center.Z; break; case 8: walls.Width = commandArgs[1].ToInt(); walls.Length = commandArgs[2].ToInt(); walls.Height = commandArgs[3].ToInt(); walls.Block = commandArgs[4]; walls.CenterX = commandArgs[5].ToInt(); walls.CenterY = commandArgs[6].ToInt(); walls.CenterZ = commandArgs[7].ToInt(); break; default: var help = "create outline length width height block - center at current position\n" + "create outline length width height block [named position]\n" + "create outline length width height block x y z"; _minecraft.Status(help); return(new List <Line>()); } generator = new BoxGenerator(); lines = generator.Run((Options)walls); return(lines); }
// Use this for initialization void Start() { GameObject gc = GameObject.FindGameObjectWithTag("GameController"); m_BG = gc.GetComponent <BoxGenerator>(); Coord2D coord = m_BG.PosToCoord(new Vector2(transform.localPosition.x, transform.localPosition.y)); if (coord.x != -1 && coord.y != -1) { GameObject element = m_BG.GetElementByCoord(coord); if (element != null) { var type = element.GetComponent <BoxElementControl>().m_Type; m_BG.AttachRandomSpecies(element); var count = 1; //尋找同類方塊,加上物種 for (int y = 0; y < m_BG.m_BoxNumH; y++) { for (int x = 0; x < m_BG.m_BoxNumW; x++) { Coord2D targetCoord = new Coord2D(x, y); GameObject target = m_BG.GetElementByCoord(targetCoord); if (target != null) { BoxElementControl bec = target.GetComponent <BoxElementControl>(); if (bec.m_Type == type && bec.GetSpecies() == null) { m_BG.AttachRandomSpecies(target); count++; if (count >= m_Count) { return; } } } } } } /*int halfSize = m_Size >> 1; * for (int x = coord.x - halfSize; x < coord.x - halfSize + m_Size; x++){ * for (int y = coord.y - halfSize; y < coord.y - halfSize + m_Size; y++){ * Coord2D targetCoord = new Coord2D(x, y); * GameObject element = m_BG.GetElementByCoord(targetCoord); * if (element != null) { * m_BG.AttachRandomSpecies(element); * } * } * }*/ } }
private void BtnReadHarryModel_Click(object sender, EventArgs e) { int harryModelAddressRaw = Mem !.ReadS32(Rom.Addresses.MainRam.HarryModelPointer); int harryModelAddress = harryModelAddressRaw - (int)Rom.Addresses.MainRam.BaseAddress; List <byte> headerBytes = Mem !.ReadByteRange(harryModelAddress, IlmHeader.Length); IlmHeader header; try { header = new IlmHeader(headerBytes, harryModelAddressRaw); } catch (ArgumentException) { return; } // Can't get an actual stream from ApiHawk, but this'll do nicely. List <byte> remaining = Mem !.ReadByteRange(harryModelAddress, (int)(Mem !.GetMemoryDomainSize("MainRAM") - harryModelAddress)); Model = new Ilm(header, remaining, TrkModelScale.Value); var generator = new BoxGenerator(0.025f, Color.Yellow); bool all = CmbModelSubmeshName.Text == "*"; ModelBoxes.Clear(); foreach (Submesh submesh in Model.Submeshes) { if (!all && submesh.Name != CmbModelSubmeshName.Text.ToUpper()) { continue; } foreach (Vector3 vertex in submesh.Vertices) { Renderable box = generator.Generate().ToWorld(); box.Position = new Vector3(vertex.X, -vertex.Y, vertex.Z); ModelBoxes.Add(box); } if (!all) { break; } } }
public void SetPause(bool bePause) { m_Pause = bePause; //nuclear countdown NuclearExplode ne = GetComponent <NuclearExplode>(); if (ne) { ne.m_Pause = bePause; } //box BoxGenerator bg = GetComponent <BoxGenerator>(); if (bg) { bg.m_Pause = bePause; } BoxElementControl[] becArray = GetComponentsInChildren <BoxElementControl>(); for (int i = 0; i < becArray.Length; i++) { becArray[i].m_Pause = bePause; } //skill SkillButton[] sb = GameObject.Find("SkillBar").GetComponentsInChildren <SkillButton>(); for (int i = 0; i < sb.Length; i++) { sb[i].m_Pause = bePause; } DestroyEffect[] de = GetComponentsInChildren <DestroyEffect>(); for (int i = 0; i < de.Length; i++) { de[i].m_Pause = bePause; } MetalSkill[] ms = GetComponentsInChildren <MetalSkill>(); for (int i = 0; i < ms.Length; i++) { ms[i].m_Pause = bePause; } WaterSkill[] ws = GetComponentsInChildren <WaterSkill>(); for (int i = 0; i < ws.Length; i++) { ws[i].m_Pause = bePause; } EarthSkill[] es = GetComponentsInChildren <EarthSkill>(); for (int i = 0; i < es.Length; i++) { es[i].m_Pause = bePause; } }
// Use this for initialization void Start() { GameObject gc = GameObject.FindGameObjectWithTag("GameController"); m_BG = gc.GetComponent <BoxGenerator>(); //寬度是偶數行時需shift,特效跟消融方塊的區域重疊位置才會一樣 float offsetX = 0; if (m_Size % 2 == 0) { offsetX = 0.5f; } m_Coord = m_BG.PosToCoord(new Vector2(transform.localPosition.x + offsetX, transform.localPosition.y)); m_DestroyCountDown = m_DestroyTime; }
private static List <Line> CreateBox(IMinecraftCommandService commandService, string[] commandArgs, Position position, List <SavedPosition> savedPositions, bool fill) { ISquareOptions box = new Options { Fill = fill }; var command = commandArgs[0].ToLowerInvariant(); commandArgs = ProcessFillArgument(commandArgs, (Options)box); var location = position; switch (commandArgs.Length) { // width(X) length(Z) height(Y) block [postition] case 5: box.Width = commandArgs[1].ToInt(); box.Length = commandArgs[2].ToInt(); box.Height = commandArgs[3].ToInt(); box.Block = commandArgs[4]; break; case 6: // width(X) length(Z) height(Y) block savedposition case 8: // width(X) length(Z) height(Y) block x y z box.Width = commandArgs[1].ToInt(); box.Length = commandArgs[2].ToInt(); box.Height = commandArgs[3].ToInt(); box.Block = commandArgs[4]; location = location.GetAbsolutePosition(commandArgs.Skip(5).Take(3), savedPositions); break; default: var help = $"\nCREATE {command.ToUpper()} - {(fill ? "filled" : "not filled")} by default\n" + $"create {command} [fill|nofill] width(X) length(Z) height(Y) block - center at current position\n" + $"create {command} [fill|nofill] width(X) length(Z) height(Y) block [named position]\n" + $"create {command} [fill|nofill] width(X) length(Z) height(Y) block [x y z]"; commandService.Status(help); return(new List <Line>()); } box.Start = location.ToPoint(); IGenerator generator = new BoxGenerator(); return(generator.Run((Options)box)); }
private static List <Line> CreateFloor(string[] commandArgs, Position position, List <SavedPosition> savedPositions, List <Line> lines) { IGenerator generator; ISquareOptions walls = new Options(); walls.Fill = true; switch (commandArgs.Length) { // width height block [postition] case 4: walls.Width = commandArgs[1].ToInt(); walls.Length = commandArgs[2].ToInt(); walls.Height = 1; walls.Block = commandArgs[3]; walls.CenterX = position.X; walls.CenterY = position.Y; walls.CenterZ = position.Z; break; case 5: walls.Width = commandArgs[1].ToInt(); walls.Length = commandArgs[2].ToInt(); walls.Height = 1; walls.Block = commandArgs[3]; var center = savedPositions.Single(a => a.Name.Equals(commandArgs[4])).Position; walls.CenterX = center.X; walls.CenterY = center.Y; walls.CenterZ = center.Z; break; case 7: walls.Width = commandArgs[1].ToInt(); walls.Length = commandArgs[2].ToInt(); walls.Height = 1; walls.Block = commandArgs[3]; walls.CenterX = commandArgs[4].ToInt(); walls.CenterY = commandArgs[5].ToInt(); walls.CenterZ = commandArgs[6].ToInt(); break; } generator = new BoxGenerator(); lines = generator.Run((Options)walls); return(lines); }
// Use this for initialization void Start() { m_State = BoxState.FALL; m_CurTime = 0; GameObject gc = GameObject.FindGameObjectWithTag("GameController"); m_BG = gc.GetComponent <BoxGenerator>(); m_SkillBt = GetSkillButton(m_Type); //init coordinate Vector2 pos = new Vector2(transform.localPosition.x, transform.localPosition.y); Coord2D coord = m_BG.PosToCoord(pos); SetCoord(coord); m_InfoBar = GameObject.FindGameObjectWithTag("InfoBar").GetComponent <InfoBar>(); }
private static List <Line> CreateFloor(IMinecraftCommandService commandService, string[] commandArgs, Position position, List <SavedPosition> savedPositions) { ISquareOptions floor = new Options { Fill = true }; commandArgs = ProcessFillArgument(commandArgs, (Options)floor); var location = position; switch (commandArgs.Length) { case 4: // width(X) length(Z) block @ current position floor.Width = commandArgs[1].ToInt(); floor.Length = commandArgs[2].ToInt(); floor.Height = 1; floor.Block = commandArgs[3]; break; case 5: // width(X) length(Z) block savedposition case 7: // width(X) length(Z) block x y z floor.Width = commandArgs[1].ToInt(); floor.Length = commandArgs[2].ToInt(); floor.Height = 1; floor.Block = commandArgs[3]; location = location.GetAbsolutePosition(commandArgs.Skip(4).Take(3), savedPositions); break; default: var help = "\nCREATE FLOOR\n" + "create floor [nofill] width(X) length(Z) block - center at current position\n" + "create floor [nofill] width(X) length(Z) block [named position]\n" + "create floor [nofill] width(X) length(Z) block [x y z]"; commandService.Status(help); return(new List <Line>()); } floor.Start = location.ToPoint(); IGenerator generator = new BoxGenerator(); return(generator.Run((Options)floor)); }
// Use this for initialization void Start() { m_GC = GameObject.FindGameObjectWithTag("GameController"); m_BG = m_GC.GetComponent <BoxGenerator>(); m_CoolDownMask = transform.GetChild(0).GetComponent <Image>(); m_CurAmount = 0; if (m_ReadyOnInit) { AddAmount(m_CoolDownAmount); } switch (UserData.m_TimeAccLevel) { case 0: m_TimeAcc = 1.0f; break; case 1: m_TimeAcc = 1.5f; break; case 2: m_TimeAcc = 2.0f; break; case 3: m_TimeAcc = 2.5f; break; } }
// Use this for initialization void Start() { m_ParticleArray = new GameObject[m_ParticleNum]; for (int i = 0; i < m_ParticleNum; i++) { m_ParticleArray[i] = (GameObject)Instantiate(m_Particle); m_ParticleArray[i].transform.parent = transform; m_ParticleArray[i].transform.localPosition = Vector3.zero; } GameObject gc = GameObject.FindGameObjectWithTag("GameController"); m_BG = gc.GetComponent <BoxGenerator>(); m_CurBounce = 0; Vector2 pos = new Vector2(transform.localPosition.x, transform.localPosition.y); m_TargetCoord = m_BG.PosToCoord(pos); if (m_TargetCoord.x != -1 && m_TargetCoord.y != -1) { m_Target = m_BG.GetElementByCoord(m_TargetCoord); if (m_Target != null) { BoxElementControl targetControl = m_Target.GetComponent <BoxElementControl>(); m_TargetType = targetControl.m_Type; for (int i = 0; i < m_ParticleNum; i++) { m_ParticleArray[i].transform.position = m_Target.transform.position + m_Offset; } } else { DestroyObject(gameObject); } } }
// Start is called before the first frame update void Start() { boxGenerator = FindObjectOfType <BoxGenerator>(); boxGenerator.instantiatePool(numsOfBoxes); //startGame(); }
protected override void ExtractRenderables(Block block) { var b = block as QuakeBlock; // Contains brushes. Checking the Solids count allows for both known // and unknown solid entities, which can be treated the same way. if (b.Solids.Count > 0) { foreach (Solid solid in b.Solids) { Renderables.Add(new QuakeBrush(solid)); } } // Known point entity. else if (Definition?.ClassType == ClassType.Point) { if (KeyVals.ContainsKey("origin")) { Position = KeyVals["origin"].Value.ToVector3(); } if (Definition.RenderableSources.ContainsKey(RenderableSource.Key)) { string key = Definition.RenderableSources[RenderableSource.Key]; string path = KeyVals[key].Value; if (path.EndsWith(".map", StringComparison.OrdinalIgnoreCase)) { string oldCwd = Directory.GetCurrentDirectory(); string instancePath; if (Path.IsPathRooted(path)) { instancePath = path; } else { instancePath = Path.Combine(oldCwd, path); } QuakeMap map; using (FileStream stream = File.OpenRead(instancePath)) { map = new QuakeMap(stream, Definition.DefinitionCollection); } map.Parse(); if (Definition.ClassName == "misc_external_map") { map.Prune(ClassType.Point); } // For now just tweak the instance map's renderable // geometry; name fixup and variable replacement will // be easier to accomplish as a separate pass, once all // instance maps have been loaded and parsed. map.Transform(this); UserData = map; foreach (MapObject mo in map.AllObjects) { var modified = new QuakeMapObject(mo); if (mo.KeyVals["classname"].Value == "worldspawn") { modified.Saveability = Saveability.Solids; } Children.Add(modified); } // Create a simple box to mark this instance's origin. Renderable box = new BoxGenerator(Color4.Orange).Generate(); box.Position = Position; box.Transformability = Definition.RenderableTransformability; Renderables.Add(box); } } else if (Definition.RenderableSources.ContainsKey(RenderableSource.Model)) { LoadModel(block as QuakeBlock); } else if (Definition.RenderableSources.ContainsKey(RenderableSource.Size)) { Aabb s = Definition.Size; Renderable box = new BoxGenerator(s.Min, s.Max, Definition.Color).Generate(); box.Position = Position; Renderables.Add(box); } // Known point entity with no predefined size. else { Renderable gem = new GemGenerator(Color4.Lime).Generate(); gem.Position = Position; gem.Transformability = Definition.RenderableTransformability; Renderables.Add(gem); } } // Unknown entity. else if (Definition == null) { Renderable gem = new GemGenerator().Generate(); gem.Position = Position; gem.Transformability = Definition.RenderableTransformability; Renderables.Add(gem); } }