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; } }
GrayBlock GetGrayBlock(iVector3 position) { GrayBlock grayBlock = null; GameBlock gameBlock = InGameManager.Instance.GetGameBlock(position); if (gameBlock != null) { grayBlock = gameBlock.GetComponent <GrayBlock>(); } return(grayBlock); }
public static bool ValidPos(iVector3 pos) { if (pos.x >= 0 && pos.x <= 4 && pos.y >= 0 && pos.y <= 4 & pos.z == 0) { return(true); } else { return(false); } }
public bool IsEquals(iVector3 v3) { if (x == v3.x && y == v3.y && z == v3.z) { return(true); } else { return(false); } }
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 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); }
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); }
IEnumerator ExplosionEffect(string colorType, int colorCount, iVector3 p) { if (MissionManager.Instance.GetMission(colorType, colorCount).blockCount.CompareTo(1) == 0) { if (MissionManager.Instance.MissionClear()) { MissionManager.Instance.bClear = true; MissionManager.Instance.MissionClearSendMessage(); } } //MissionBlock missionBlock = Instantiate(Resources.Load<GameObject>("Prefabs/MissionBlock")).GetComponent<MissionBlock>(); MissionBlock missionBlock = PoolManager.Instance.GetPool(PoolType.MissionBlock).gameObject.GetComponent <MissionBlock>(); missionBlock.pos = p; missionBlock.colorType = colorType; missionBlock.colorCount = colorCount; missionBlock.gameObject.SetActive(true); yield return(null); }
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 AddSpawnList(GameBlockType type, iVector3 pos, string itemType = null) { list[pos.x].spawnList.Add(type); }
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(); }
public void Respawn(iVector3 pos) { BlockSpawnManager.Instance.AddSpawnList(GameBlockType.Color, pos); }
public static int iVector3ToIndex(iVector3 pos) { return(pos.y * 5 + pos.x); }
void Start() { pos = new iVector3(int.Parse(name.Split('_')[1]), int.Parse(name.Split('_')[2]), 0); }