void LoadBlocks() { int count = positionList.Count; Map map = MapManager.Instance.mapList[MapManager.Instance.Level - 1]; for (int i = 0; i < count; i++) { switch (map.list[i])//전처리 { case "*": BlockSpawnManager.Instance.AddSpawnList(GameBlockType.Color, BlockTools.IndexToiVector3(i)); break; case "G": BlockSpawnManager.Instance.AddSpawnList(GameBlockType.Gray, BlockTools.IndexToiVector3(i)); break; case "Bit": BlockSpawnManager.Instance.AddSpawnList(GameBlockType.Bit, BlockTools.IndexToiVector3(i)); break; case "V": case "H": case "Bomb": BlockSpawnManager.Instance.AddSpawnList(GameBlockType.Item, BlockTools.IndexToiVector3(i), map.list[i]); //BlockSpawnManager.Instance.AddSpawnList(GameBlockType.Item, BlockTools.IndexToiVector3(i)); break; default: break; } } }
public ObjectId AppendBlock(Point3d position, Point3d valuePoint) { Matrix3d rot = Matrix3d.Rotation(this.SpecifyAngle, this.Matrix.CoordinateSystem3d.Zaxis, position); if (this.SpecifyAngle != 0d) { position = position.TransformBy(rot); valuePoint = valuePoint.TransformBy(rot); } double value = Mode == DirectionMode.Horizontal ? _calcValue(position, valuePoint).X : _calcValue(position, valuePoint).Y; ObjectId brId = BlockTools.AddBlockRefToModelSpace(this.BlockTableRecordId, new List <string>(new[] { Math.Abs(Math.Round(value * 1000d, 0)).ToString() }), position, Matrix); using (Transaction trans = Tools.StartTransaction()) { BlockReference br = (BlockReference)trans.GetObject(brId, OpenMode.ForRead); br.UpgradeOpen(); if (value < 0) { Mirror(br); } if (this.SpecifyAngle != 0d) { br.TransformBy(rot); } trans.Commit(); } return(brId); }
public ObjectId DisplayArrow(Point3d position, Point3d valuePoint, string tag, Autodesk.AutoCAD.GraphicsInterface.TransientDrawingMode viewMod = Autodesk.AutoCAD.GraphicsInterface.TransientDrawingMode.DirectShortTerm) { ObjectId brId = AppendBlock(position, valuePoint); BlockReference br; using (Transaction trans = Tools.StartTransaction()) { br = (BlockReference)brId.GetObject(OpenMode.ForWrite, false, true); br.Erase(true); trans.Commit(); } using (Transaction trans = Tools.StartTransaction()) { ObjectId btrId = BlockTools.GetAnonymCopy(brId, trans, false); brId = BlockTools.AddBlockRefToModelSpace(btrId, new[] { "N" }.ToList(), br.Position, this.Matrix); trans.Commit(); } using (Transaction trans = Tools.StartTransaction()) { br = (BlockReference)brId.GetObject(OpenMode.ForWrite, false, true); br.Erase(true); trans.Commit(); } using (Transaction trans = Tools.StartTransaction()) { br = (BlockReference)brId.GetObject(OpenMode.ForWrite, true, true); this.DynTransient.ClearTransientGraphics(); this.DynTransient.AddMarker((DBObject)br, tag, viewMod); this.DynTransient.Display(); } return(brId); }
public void StopEffect(SoundName effect) { Transform audio = transform.Find("(Audio) " + effect.ToString()); if (audio != null) { BlockTools.Destroy(audio.gameObject); } }
void SetAnimationList() { aniList.Clear(); aniList = new List <BitAnimation>(); for (int i = 0; i < 6; i++) { aniList.Add((BitAnimation)i); } BlockTools.Shuffle(aniList); }
public virtual void Drop() { if (!transform.parent.name.Contains("pos")) { bMove = true; return; } //Debug.Log(pos.ToString() + " : Drop"); iVector3 down = pos.Down; if (rTr.anchoredPosition3D.sqrMagnitude > 1f) { bMove = true; } if (down.y.CompareTo(0) < 0) { return; } bool drop = false; if (BlockTools.ValidPos(down)) { GameBlock gameBlock = InGameManager.Instance.GetGameBlock(down); if (gameBlock == null) { drop = true; } else { if (gameBlock.bMove) { //drop = true; } if (gameBlock.bDestroy) { drop = true; } if (!gameBlock.bMove && !gameBlock.bDestroy) { if (!bBounce) { bBounce = true; //Debug.Log("Bounce : " + pos.ToString()); Bounce(); } } } } if (drop) { pos = down; transform.SetParent(InGameManager.Instance.positionList[BlockTools.iVector3ToIndex(down)].transform); bMove = true; } }
void RespawnItem(iVector3 pos) { ItemBlock itemBlock = Instantiate(Resources.Load <GameObject>("Prefabs/ItemBlock")).GetComponent <ItemBlock>(); itemBlock.pos = pos; itemBlock.transform.SetParent(InGameManager.instance.positionList[BlockTools.iVector3ToIndex(pos)].transform); itemBlock.rTr.anchoredPosition3D = Vector3.zero; itemBlock.rTr.localScale = Vector3.one; itemBlock.itemType = (ItemType)UnityEngine.Random.Range(0, 3); itemBlock.Initialize(); }
public ObjectId CreateOrGetBlockRecord() { this.ArrowLine = _createPLine(new Point3d(this.Origin.X + defSpaceLength, this.Origin.Y, this.Origin.Z)); this.BaseAttribute = _createAttribute(this.Origin); List <Entity> ents = new List <Entity>(new[] { ArrowLine, (Entity)this.BaseAttribute }); this.BlockTableRecordId = BlockTools.CreateBlockTableRecordEx(Point3d.Origin, "*U", ents, AnnotativeStates.True); return(this.BlockTableRecordId); }
BitAnimation GetRandomAnimation() { BlockTools.Shuffle(aniList); BitAnimation animation = aniList[0]; aniList.RemoveAt(0); if (aniList.Count.CompareTo(0) == 0) { SetAnimationList(); } return(animation); }
public GameBlock GetGameBlock(iVector3 pos) { GameBlock gameBlock = null; if (pos.x >= 0 && pos.y <= 4 && pos.z == 0) { if (positionList != null && positionList.Count != 0) { gameBlock = positionList[BlockTools.iVector3ToIndex(pos)].GetComponentInChildren <GameBlock>(); } } return(gameBlock); }
IEnumerator Flow() { while (gameObject.activeInHierarchy) { if (transform.childCount > 0) { BlockTools.Destroy(transform.GetChild(0).gameObject); yield return(new WaitForSeconds(0.5f)); } else { yield return(null); } } }
public ArrowDirectional2 PastNewArrowItem(Point3d position, Point3d valuePoint) { _createBlockRecord(); double value = Mode == DirectionMode.Horizontal ? _calcValue(position, valuePoint).X : _calcValue(position, valuePoint).Y; if (value < 0) { _mirror(); } ObjectId brId = BlockTools.AddBlockRefToModelSpace(this.BlockTableRecordId, new List <string>(new[] { Math.Abs(Math.Round(value * 1000d, 0)).ToString() }), position, UcsMatrix); /*using (Transaction trans = Tools.StartTransaction()) * { * if (value < 0) * { * BlockTableRecord btr = this.BlockTableRecordId.GetObjectForRead<BlockTableRecord>(); * btr.UpgradeOpen(); * //btr.UpdateAnonymousBlocks(); * * _arrowBlockRef = (BlockReference)trans.GetObject(brId, OpenMode.ForRead); * _arrowBlockRef.UpgradeOpen(); * _mirror(); * _arrowBlockRef.RecordGraphicsModified(true); * * * if (_arrowBlockRef.AttributeCollection != null) * { * foreach (ObjectId arId in _arrowBlockRef.AttributeCollection) * { * AttributeReference ar = (AttributeReference)arId.GetObject(OpenMode.ForRead, false, true); * ar.UpgradeOpen(); * ar.RecordGraphicsModified(true); * } * } * } * }*/ Tools.GetActiveAcadDocument().TransactionManager.FlushGraphics(); this.ArrowId = brId; return(this); }
void OnEnable() { //gameObject.SetActive(true); transform.SetParent(InGameManager.Instance.positionList[BlockTools.iVector3ToIndex(pos)].transform); rd = GetComponent <Rigidbody2D>(); rTr = gameObject.GetComponent <RectTransform>(); rTr.anchoredPosition3D = Vector3.zero; rTr.localScale = Vector3.one; rTr.sizeDelta = new Vector2(150f, 150f); rTr.rotation = Quaternion.Euler(Vector3.zero); //transform.SetParent(target); index = 0; rd.gravityScale = 30f; mission = MissionManager.Instance.GetMission(colorType, colorCount); target = MissionManager.Instance.missionParentDummy.transform.Find(string.Format("M" + mission.index.ToString())); GetComponent <Image>().sprite = Resources.Load <Sprite>(string.Format("Images/" + colorType)); }
public ObjectId AppendBlockEx(Point3d position, Point3d valuePoint) { Matrix3d rot = Matrix3d.Rotation(this.SpecifyAngle, this.Matrix.CoordinateSystem3d.Zaxis, position); if (this.SpecifyAngle != 0d) { position = position.TransformBy(rot); valuePoint = valuePoint.TransformBy(rot); } double value = Mode == DirectionMode.Horizontal ? _calcValue(position, valuePoint).X : _calcValue(position, valuePoint).Y; ObjectId brId = BlockTools.AddBlockRefToModelSpace(this.BlockTableRecordId, new List <string>(new[] { Math.Abs(Math.Round(value * 1000d, 0)).ToString() }), position, Matrix); BlockReference br; using (Transaction trans = Tools.StartTransaction()) { br = (BlockReference)trans.GetObject(brId, OpenMode.ForRead); br.UpgradeOpen(); if (value < 0) { Mirror(br); } if (this.SpecifyAngle != 0d) { br.TransformBy(rot); } trans.Commit(); } /*using (Transaction trans = Tools.StartTransaction()) * { * ObjectId anyBtrId = BlockTools.GetAnonymCopy(br.Id, trans, false); * AttributeReference ar = br.GetAttributeByTag(this.anchorTag, trans); * br = (BlockReference)trans.GetObject(brId, OpenMode.ForWrite); * br.Erase(true); * brId = BlockTools.AddBlockRefToModelSpace(anyBtrId, new[] { ar.TextString }.ToList(), br.Position, Matrix, trans, false); * trans.Commit(); * }*/ return(brId); }
bool CheckGrayBlock(iVector3 position) { if (!BlockTools.ValidPos(position)) { return(false); } GameBlock gameBlock = InGameManager.Instance.GetGameBlock(position); if (gameBlock != null) { GrayBlock grayBlock = gameBlock.GetComponent <GrayBlock>(); if (grayBlock != null) { return(true); } } return(false); }
void OnEnable() { if (lastIndex == -1) { BlockTools.Shuffle(list); } int count = list.Count; for (int i = 0; i < count; i++) { if (i != lastIndex) { gameObject.GetComponent <Image>().sprite = list[i]; gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(list[i].rect.width, list[i].rect.height); lastIndex = i; } } }
public override void SendUpBlockDropMessage() { iVector3 up = pos.Up; while (up.y <= 4) { if (BlockTools.ValidPos(up)) { GameBlock gameBlock = InGameManager.Instance.GetGameBlock(up); if (gameBlock != null) { //Debug.Log(gameBlock.transform.parent.name + " - Drop"); if (!gameBlock.bMove) { gameBlock.Drop(); } } } up = up.Up; } }
List <ColorBlock> Find4Direction(iVector3 pos) { List <ColorBlock> list = new List <ColorBlock>(); for (int i = 0; i < 4; i++) { iVector3 p = new iVector3(); switch (i) { case 0: p = pos.Right; break; case 1: p = pos.Left; break; case 2: p = pos.Up; break; case 3: p = pos.Down; break; } if (BlockTools.ValidPos(p)) { if (InGameManager.Instance != null) { GameBlock gameBlock = InGameManager.Instance.GetGameBlock(p); if (gameBlock != null) { ColorBlock colorBlock = gameBlock.GetComponent <ColorBlock>(); if (colorBlock != null) { if (colorBlock.colorType.CompareTo(colorType) == 0) { list.Add(colorBlock); } } } } } } return(list); }
public void TestAnonyBlock() { Polyline pline = new Polyline(3); pline.AddVertexAt(0, new Point2d(0, 0), 0, 0, 0); pline.AddVertexAt(1, new Point2d(pline.GetPoint2dAt(0).X + 3, pline.GetPoint2dAt(0).Y), 0, 0.4, 0); pline.AddVertexAt(2, new Point2d(pline.GetPoint2dAt(1).X + 1.5, pline.GetPoint2dAt(1).Y), 0, 0, 0); pline.LineWeight = LineWeight.LineWeight020; AttributeDefinition ad = _createAttribute(pline.StartPoint, pline); Matrix3d ucs = CoordinateSystem.CoordinateTools.GetCurrentUcs(); var btrId = BlockTools.CreateBlockTableRecordEx(Point3d.Origin, "test11111", new[] { (Entity)pline, (Entity)ad }.ToList(), AnnotativeStates.True); var brId = BlockTools.AddBlockRefToModelSpace(btrId, new[] { "3" }.ToList(), new Point3d(10, 10, 10), ucs); using (Transaction trans = Tools.StartTransaction()) { BlockReference br = (BlockReference)brId.GetObject(OpenMode.ForRead, false, true); br.UpgradeOpen(); br.TransformBy(Matrix3d.Rotation(Math.PI / 2d, ucs.CoordinateSystem3d.Zaxis, br.Position)); //br.Erase(true); trans.Commit(); } AttributeReference ar; using (Transaction trans = Tools.StartTransaction()) { BlockReference br = (BlockReference)brId.GetObject(OpenMode.ForRead, true, true); ar = br.GetAttributeByTag(ad.Tag, trans); ar = (AttributeReference)ar.Id.GetObject(OpenMode.ForRead, true, true); var anBtrId = BlockTools.GetAnonymCopy(brId, trans, false); var anBrId = BlockTools.AddBlockRefToModelSpace(anBtrId, new[] { ar.TextString }.ToList(), new Point3d(0, 0, 0), ucs); trans.Commit(); } }
public bool DrawAnchorDeviations() { Polyline pline = new Polyline(4); pline.AddVertexAt(0, new Point2d(0, 0), 0, 0, 0); pline.AddVertexAt(1, new Point2d(3, 0), 0, 0, 0); pline.AddVertexAt(2, new Point2d(4, 0), 0, 0.4, 0); pline.AddVertexAt(3, new Point2d(5.5, 0), 0, 0.4, 0); pline.LineWeight = LineWeight.LineWeight015; AttributeDefinition acAttDef = new AttributeDefinition(); acAttDef.Verifiable = true; acAttDef.Height = 1.8; //acAttDef.Justify = AttachmentPoint.BaseMid; acAttDef.Prompt = "Deviation #: "; acAttDef.Tag = "Deviation#"; acAttDef.TextString = "0"; acAttDef.Position = new Point3d((pline.Length) / 2d - acAttDef.Height / 2d, acAttDef.Height * 0.1, 0); PromptPointOptions ppo = new PromptPointOptions("\nУкажите проектное положение"); PromptPointResult ppr = Tools.GetAcadEditor().GetPoint(ppo); if (ppr.Status != PromptStatus.OK) return false; Point3d pPoint = ppr.Value; ppo = new PromptPointOptions("\nУкажите фактическое положение"); ppo.BasePoint = pPoint; ppo.UseBasePoint = true; ppo.UseDashedLine = true; ppr = Tools.GetAcadEditor().GetPoint(ppo); if (ppr.Status != PromptStatus.OK) return false; Point3d fPoint = new Point3d(ppr.Value.X, ppr.Value.Y, pPoint.Z); List<Entity> ents = new List<Entity>(new[] { pline, (Entity)acAttDef }); var btrId = BlockTools.CreateBlockTableRecordEx(Point3d.Origin, "_DrawAnchorDeviations", ents, AnnotativeStates.True); if (btrId != ObjectId.Null) { fPoint = fPoint.RotateBy(-_angle, _ucs.CoordinateSystem3d.Zaxis, pPoint); var brHorizontalId = BlockTools.AddBlockRefToModelSpace(btrId, new[] { Math.Abs(Math.Round((fPoint.X - pPoint.X) * 1000d, 0)).ToString() }.ToList(), pPoint, _ucs); var brVerticalId = BlockTools.AddBlockRefToModelSpace(btrId, new[] { Math.Abs(Math.Round((fPoint.Y - pPoint.Y) * 1000d, 0)).ToString() }.ToList(), pPoint, _ucs); using (Transaction trans = Tools.StartTransaction()) { BlockReference br1 = (BlockReference)trans.GetObject(brHorizontalId, OpenMode.ForWrite); BlockReference br2 = (BlockReference)trans.GetObject(brVerticalId, OpenMode.ForWrite); const string MIRRTEXT = "MIRRTEXT"; object defVal = acadApp.Application.GetSystemVariable(MIRRTEXT); acadApp.Application.SetSystemVariable(MIRRTEXT, 0); try { if (fPoint.X - pPoint.X < 0d) { BlockTools.MirroringBlockByYAxis(br1); } br2.TransformBy(Matrix3d.Rotation(Math.PI / 2, _ucs.CoordinateSystem3d.Zaxis, br2.Position)); if (fPoint.X - pPoint.X < 0d) BlockTools.MirroringBlockByYAxis(br2); if (fPoint.Y - pPoint.Y < 0) { BlockTools.MirroringBlockByXAxis(br2); BlockTools.MirroringBlockByYAxis(br2); } br1.TransformBy(Matrix3d.Rotation(_angle, _ucs.CoordinateSystem3d.Zaxis, br1.Position)); br2.TransformBy(Matrix3d.Rotation(_angle, _ucs.CoordinateSystem3d.Zaxis, br2.Position)); using (TransientGraphicsTools.SelectableTransient _transient = new TransientGraphicsTools.SelectableTransient(new List<Entity>(new[] { br1, br2 }))) { _transient.Display(); ppo = new PromptPointOptions("\nУкажите точку определяющую сторону отобажения"); ppo.UseBasePoint = true; ppo.BasePoint = pPoint; ppo.UseDashedLine = true; ppr = Tools.GetAcadEditor().GetPoint(ppo); if (ppr.Status == PromptStatus.OK) { Point3d point = ppr.Value; Polyline transPline = null; if (pline.Id != ObjectId.Null) pline = (Polyline)trans.GetObject(pline.Id, OpenMode.ForRead); transPline = (Polyline)pline.Clone(); transPline.TransformBy(br1.BlockTransform); double ang = CoordinateGeometry.Helper.GetAngle(transPline.StartPoint, transPline.EndPoint, point); if (Math.Abs(ang) > Math.PI/2d) { Matrix3d mat = Matrix3d.Displacement(transPline.StartPoint - transPline.EndPoint); br1.TransformBy(mat); } transPline = (Polyline)pline.Clone(); transPline.TransformBy(br2.BlockTransform); ang = CoordinateGeometry.Helper.GetAngle(transPline.StartPoint, transPline.EndPoint, point); if (Math.Abs(ang) > Math.PI / 2d) { Matrix3d mat = Matrix3d.Displacement(transPline.StartPoint - transPline.EndPoint); br2.TransformBy(mat); } } _transient.StopDisplaying(); } trans.Commit(); return true; } catch (Exception ex) { throw ex; } finally { acadApp.Application.SetSystemVariable(MIRRTEXT, defVal); } } } return false; }
IEnumerator ExplosionFlow() { SoundManager.Instance.PlayEffect("eff_item_whoosh2"); GetComponent <Animator>().Play("ItemBlock_bombexplosion"); yield return(new WaitForSeconds(0.416f)); SoundManager.Instance.PlayEffect("eff_whoosh"); image.enabled = false; //ParticleManager.Instance.SetParticle(ParticleType.ParticleF, Particle.FX_Rocks, rTr.transform.parent.gameObject.GetComponent<RectTransform>()); GameObject fx_Rocks = PoolManager.Instance.GetPool(PoolType.FX_Rocks).gameObject; ParticleManager.Instance.SetParticle(ParticleType.ParticleF, fx_Rocks, rTr.transform.parent.gameObject.GetComponent <RectTransform>()); int count = missileList.Count; GameObject bomb = transform.Find("Bomb").gameObject; bomb.transform.SetParent(InGameManager.Instance.uiParent.transform); for (int i = 0; i < count; i++) { missileList[i].Setting(); missileList[i].Explosion(); } bool isFinish = true; yield return(new WaitForSeconds(0.416f)); for (int y = pos.y - 1; y < pos.y + 2; y++) { for (int x = pos.x - 1; x < pos.x + 2; x++) { if (BlockTools.ValidPos(new iVector3(x, y, 0))) { if (pos.IsEquals(new iVector3(x, y, 0))) { continue; } GameBlock gameBlock = InGameManager.Instance.GetGameBlock(new iVector3(x, y, 0)); if (gameBlock != null) { if (gameBlock.type == GameBlockType.Item) { if (!gameBlock.bDestroy) { isFinish = false; } } gameBlock.Explosion(false); } } } } bomb.transform.SetParent(transform); bomb.transform.SetAsFirstSibling(); bomb.transform.localPosition = Vector3.zero; bomb.SetActive(false); if (isFinish) { //BlockSpawnManager.Instance.MoveStart(); //InGameManager.Instance.MoveStart(); } MissionManager.Instance.AddBlock(itemType.ToString(), 1); InGameManager.Instance.Respawn(pos); DestroyObject(); }
IEnumerator ClearEffect(bool bSuccess) { if (bSuccess) { List <int> indexList = new List <int>(); for (int i = 0; i < 25; i++) { indexList.Add(i); } BlockTools.Shuffle(indexList); BlockSpawnManager.Instance.MoveStop(10f); InGameManager.instance.MoveStop(10f); if (25 - GetItemBlockCount() < MissionManager.Instance.blockCount) {//남은 블록개수가 아이템으로 바꿔줘야 하는 블록보다 많은 경우 MissionManager.Instance.blockCount = 25 - GetItemBlockCount(); } List <int> fxList = new List <int>(); for (int i = 0; i < 25; i++) { if (MissionManager.Instance.blockCount.CompareTo(0) == 0) { break; } if (fxList.Contains(indexList[i])) { continue; } GameBlock gameBlock = positionList[indexList[i]].GetComponentInChildren <GameBlock>(); if (gameBlock.type == GameBlockType.Color || gameBlock.type == GameBlockType.Gray) { CreateStar(indexList[i], gameBlock); fxList.Add(indexList[i]); yield return(new WaitForSeconds(0.1f)); } } yield return(new WaitForSeconds(2f)); //BlockSpawnManager.Instance.MoveStart(); //MoveStart(); for (int i = 0; i < 25; i++) { GameBlock gameBlock = positionList[indexList[i]].GetComponentInChildren <GameBlock>(); if (gameBlock != null) { if (gameBlock.type == GameBlockType.Item) { gameBlock.Explosion(true); break; } } } while (GetItemBlockCount() > 0) { yield return(new WaitForEndOfFrame()); if (CheckMoveBlock()) { continue; } //if (bDelay) continue; for (int i = 0; i < 25; i++) { GameBlock gameBlock = positionList[indexList[i]].GetComponentInChildren <GameBlock>(); ItemBlock itemBlock = null; if (gameBlock != null) { if (gameBlock.type == GameBlockType.Item) { if (gameBlock.bDestroy) { continue; } yield return(null); //Debug.Log("ClearEffect : " + gameBlock.pos.ToString2()); if (gameBlock == null) { continue; } itemBlock = gameBlock.GetComponent <ItemBlock>(); gameBlock.Explosion(true); switch (itemBlock.itemType) { case ItemType.Bomb: InGameManager.instance.MoveStop(0.84f); BlockSpawnManager.Instance.MoveStop(0.84f); //yield return new WaitForSeconds(2f); break; case ItemType.Horizental: case ItemType.Vertical: InGameManager.instance.MoveStop(0.42f); BlockSpawnManager.Instance.MoveStop(0.42f); //yield return new WaitForSeconds(2f); break; } break; } } } yield return(new WaitForSeconds(0.2f)); } yield return(new WaitForSeconds(1f)); rocket.Fire(2); } else//gameover { SoundManager.Instance.StopBGM(); SoundManager.Instance.PlayEffect("eff_alert"); FuelManager.Instance.AllLock(false); SoundManager.Instance.PlayEffect("eff_electrical_sparks"); yield return(new WaitForSeconds(2f)); FX_Smoke_Black.SetActive(true); MissionManager.Instance.MissionPanelOff(); yield return(new WaitForSeconds(1f)); FX_Electric.gameObject.SetActive(true); FX_Electric.Play(); SoundManager.Instance.PlayEffect("eff_plasma"); FX_Electric.gameObject.GetComponent <FXLoop>().loopTime = 1.3f; FX_Electric.gameObject.GetComponent <FXLoop>().bLoop = true; rocket.randomBounce.Bounce(); FX_Electric_Bridge.SetActive(true); yield return(new WaitForSeconds(1f)); } MissionManager.Instance.missionParent.gameObject.SetActive(false); RectTransform rTr = rocket.gameObject.GetComponent <RectTransform>(); SoundManager.Instance.PlayEffect("eff_rocket_start"); while (rTr.anchoredPosition3D.y < 1000f) { rTr.anchoredPosition3D = Vector3.Lerp(rTr.anchoredPosition3D, new Vector3(0f, 1100f, 0f), Time.deltaTime * rocket.speed); yield return(null); } SoundManager.Instance.StopEffect(SoundName.eff_alert); boardParent.SetActive(false); rocket.gameObject.SetActive(false); fuel.SetActive(false); FX_Electric_Bridge.SetActive(false); FX_Smoke_Black.SetActive(false); FX_Electric.gameObject.SetActive(false); btn_Exit.SetActive(false); ResultManager.Instance.Initialize(bSuccess); }
IEnumerator FlyStar(int index, GameBlock gameBlock) { GameObject dummyStar = new GameObject("DummyStar"); //GameObject star = Instantiate(Resources.Load<GameObject>("Prefabs/FX_LightBall_A")); GameObject star = PoolManager.Instance.GetPool(PoolType.FX_LightBall_A).gameObject; star.SetActive(true); RectTransform starRTr = dummyStar.AddComponent <RectTransform>(); star.transform.SetParent(ParticleManager.Instance.particleCanvasF.transform); dummyStar.transform.SetParent(rocket.transform); starRTr.anchoredPosition3D = new Vector3(-450f, 300f, 0f); starRTr.localScale = Vector3.one; FollowUI ui = star.AddComponent <FollowUI>(); ui.bFollow = true; ui.target = positionList[index].gameObject.GetComponent <RectTransform>(); ui.subTarget = starRTr; float speed = 4f; iVector3 p = new iVector3(gameBlock.pos.x, gameBlock.pos.y, gameBlock.pos.z); star.GetComponent <RectTransform>().anchoredPosition3D = Vector3.zero; star.transform.localScale = Vector3.one; FX_Electric.gameObject.SetActive(true); FX_Electric.Play(); SoundManager.Instance.PlayEffect("eff_plasma"); SoundManager.Instance.PlayEffect("eff_finale"); dummyStar.transform.SetParent(gameBlock.transform); while ((starRTr.anchoredPosition3D).sqrMagnitude > 100f) { starRTr.anchoredPosition3D = Vector3.Lerp(starRTr.anchoredPosition3D, Vector3.zero, Time.deltaTime * speed); yield return(null); if (starRTr == null) { break; } } star.SetActive(false); dummyStar.SetActive(false); //ParticleManager.Instance.SetParticle(ParticleType.ParticleF, Particle.FX_SpreadStar, positionList[BlockTools.iVector3ToIndex(p)].GetComponent<RectTransform>()); GameObject fx_SpreadStar = PoolManager.Instance.GetPool(PoolType.FX_SpreadStar).gameObject; ParticleManager.Instance.SetParticle(ParticleType.ParticleF, fx_SpreadStar, positionList[BlockTools.iVector3ToIndex(p)].GetComponent <RectTransform>()); if (gameBlock != null) { ColorBlock colorBlock = gameBlock.GetComponent <ColorBlock>(); if (colorBlock != null) { colorBlock.DestroyObject(); } GrayBlock grayBlock = gameBlock.GetComponent <GrayBlock>(); if (grayBlock != null) { grayBlock.DestroyObject(); } } //이떄 생성되는 느낌의 파티클 한개더 //ItemBlock itemBlock = Instantiate(Resources.Load<GameObject>("Prefabs/ItemBlock")).GetComponent<ItemBlock>(); ItemBlock itemBlock = PoolManager.Instance.GetPool(PoolType.ItemBlock).GetComponent <ItemBlock>(); itemBlock.gameObject.SetActive(true); itemBlock.pos = p; itemBlock.itemType = (ItemType)UnityEngine.Random.Range(0, 2); itemBlock.transform.SetParent(positionList[index].transform); itemBlock.transform.localPosition = Vector3.zero; itemBlock.transform.localScale = Vector3.one; itemBlock.bIsParentPos = true; itemBlock.Initialize(); }
IEnumerator Auto()//test { while (true) { yield return(new WaitForSeconds(0.5f)); int count = positionList.Count; List <int> index = new List <int>(); for (int i = 0; i < 25; i++) { index.Add(i); } BlockTools.Shuffle(index); int maxCount = 0; int maxIndex = -1; int missionIndex = -1; int missionMaxCount = 0; int itemIndex = -1; for (int i = 0; i < count; i++) { GameBlock gameBlock = positionList[index[i]].GetComponentInChildren <GameBlock>(); if (gameBlock != null) { if (gameBlock.type == GameBlockType.Color) { ColorBlock ColorBlock = gameBlock.GetComponent <ColorBlock>(); if (ColorBlock != null) { if (ColorBlock.colorCount > 1) { int missionCount = MissionManager.Instance.missionList.Count; for (int j = 0; j < missionCount; j++) { if (MissionManager.Instance.missionList[j].blockCount > 0) { if (ColorBlock.colorType.ToString() == MissionManager.Instance.missionList[j].blockType) { //미션에 해당하는 색깔블럭 if (missionMaxCount < ColorBlock.colorCount) { missionMaxCount = ColorBlock.colorCount; missionIndex = index[i]; } } } } if (maxCount < ColorBlock.colorCount) { maxCount = ColorBlock.colorCount; maxIndex = index[i]; } //ColorBlock.OnClickButton(); } } } else if (gameBlock.type == GameBlockType.Item) { ItemBlock itemBlock = gameBlock.GetComponent <ItemBlock>(); if (itemBlock != null) { //itemBlock.OnClickButton(); itemIndex = index[i]; } } } } if (missionIndex != -1) { InGameManager.instance.positionList[missionIndex].GetComponentInChildren <GameBlock>().OnClickButton(); } else if (itemIndex != -1) { InGameManager.instance.positionList[itemIndex].GetComponentInChildren <GameBlock>().OnClickButton(); } else if (maxIndex != -1) { InGameManager.instance.positionList[maxIndex].GetComponentInChildren <GameBlock>().OnClickButton(); } if (bGameClear) { //OnClickButtonNext(); yield break; } if (bGameOver) { OnClickButtonRetry(); yield break; } } }
void MakeNumber(int colorCount) { GameObject number = Instantiate(Resources.Load <GameObject>("Prefabs/FX_Number")) as GameObject; number.transform.SetParent(ParticleManager.Instance.particleCanvasF.transform); number.transform.localPosition = Vector3.zero; number.transform.localScale = Vector3.one; number.gameObject.GetComponent <RectTransform>().anchoredPosition3D = InGameManager.Instance.positionList[BlockTools.iVector3ToIndex(pos)].gameObject.GetComponent <RectTransform>().anchoredPosition3D; number.GetComponent <FX_Number>().value = colorCount; number.GetComponent <FX_Number>().Initialize(); }