//check logic game public void RuleChecker(GameObject obj1, GameObject obj2) { JewelObj Jewel1 = obj1.GetComponent <JewelObj>(); JewelObj Jewel2 = obj2.GetComponent <JewelObj>(); List <JewelObj> NeiObj1 = Ulti.ListPlus(Jewel1.GetCollumn(Jewel2.jewel.JewelPosition, Jewel1.jewel.JewelType, null), Jewel1.GetRow(Jewel2.jewel.JewelPosition, Jewel1.jewel.JewelType, null), Jewel1); List <JewelObj> NeiObj2 = Ulti.ListPlus(Jewel2.GetCollumn(Jewel1.jewel.JewelPosition, Jewel2.jewel.JewelType, null), Jewel2.GetRow(Jewel1.jewel.JewelPosition, Jewel2.jewel.JewelType, null), Jewel2); if (Jewel1.jewel.JewelType == 99 || Jewel2.jewel.JewelType == 99) { if (Jewel1.jewel.JewelType == 8 || Jewel2.jewel.JewelType == 8) { Jewel1.SetBackAnimation(obj2); Jewel2.SetBackAnimation(obj1); return; } } if (NeiObj1.Count >= 3 || NeiObj2.Count >= 3 || Jewel1.jewel.JewelType == 8 || Jewel2.jewel.JewelType == 8) { Ulti.MoveTo(obj1, obj2.transform.localPosition, 0.2f); Ulti.MoveTo(obj2, obj1.transform.localPosition, 0.2f); SwapJewelPosition(obj1, obj2); JewelProcess(NeiObj1, NeiObj2, obj1, obj2); } else { Jewel1.SetBackAnimation(obj2); Jewel2.SetBackAnimation(obj1); } }
public void RuleChecker(GameObject obj1, GameObject obj2) { FruitObj fruit1 = obj1.GetComponent <FruitObj>(); FruitObj fruit2 = obj2.GetComponent <FruitObj>(); List <FruitObj> fruitObjs1 = Ulti.ListPlus(fruit1.GetCollumn(fruit2.Fruit.FruitPosition, fruit1.Fruit.FruitType, null), fruit1.GetRow(fruit2.Fruit.FruitPosition, fruit1.Fruit.FruitType, null), fruit1); List <FruitObj> fruitObjs2 = Ulti.ListPlus(fruit2.GetCollumn(fruit1.Fruit.FruitPosition, fruit2.Fruit.FruitType, null), fruit2.GetRow(fruit1.Fruit.FruitPosition, fruit2.Fruit.FruitType, null), fruit2); if (fruit1.Fruit.FruitType == 99 || fruit2.Fruit.FruitType == 99) { if (fruit1.Fruit.FruitType == 8 || fruit2.Fruit.FruitType == 8) { fruit1.SetBackAnimation(obj2); fruit2.SetBackAnimation(obj1); return; } } if (fruitObjs1.Count >= 3 || fruitObjs2.Count >= 3 || fruit1.Fruit.FruitType == 8 || fruit2.Fruit.FruitType == 8) { Ulti.MoveTo(obj1, obj2.transform.localPosition, 0.2f); Ulti.MoveTo(obj2, obj1.transform.localPosition, 0.2f); SwapFruitPosition(obj1, obj2); FruitProcess(fruitObjs1, fruitObjs2, obj1, obj2); } else { fruit1.SetBackAnimation(obj2); fruit2.SetBackAnimation(obj1); } }
// 播放火球特效 public GameObject MGE(Vector3 pos, Vector3 target) { // 实例化火球特效 GameObject tmp = (GameObject)Instantiate(EffectPrefabs[11]); // 设置特效父节点 tmp.transform.SetParent(parent.transform, false); // 设置特效坐标 tmp.transform.position = new Vector3(pos.x, pos.y, -0.22f); // 火球转向弧度 float AngleRad = Mathf.Atan2(target.y - pos.y, target.x - pos.x); // 火球转向角度 float AngleDeg = (180 / Mathf.PI) * AngleRad; // 设置火球旋转角度 tmp.transform.rotation = Quaternion.Euler(0, 0, AngleDeg); // 火球移动到目标位置 Ulti.MoveTo(tmp, target, 0.4f); // 销毁特效 Destroy(tmp, 0.4f); // 播放射击音效 SoundController.Sound.Gun(); // 返回特效 return(tmp); }
/// <summary> /// 显示当前玩家进度点 /// </summary> void StarPointMove() { DataLoader.enableclick = false; Vector3 newpos = listmap[CameraMovement.StarPointMoveIndex].transform.position + new Vector3(0, 0, -0.3f); Ulti.MoveTo(CameraMovement.mcamera.StarPoint, newpos, STARMOVE_TIME, newpos.z); StartCoroutine(stopanimation()); }
public void MiniStar(Vector3 startpos) { GameObject tmp = (GameObject)Instantiate(EffectPrefabs[12]); tmp.transform.SetParent(parent.transform, false); Ulti.MoveTo(tmp, startpos, new Vector2(-2.485f, 4.418f), 1.2f, -2.2f); Destroy(tmp, 1.2f); }
IEnumerator _ReGroup(Vector2 pos) { RemoveFromList((int)jewel.JewelPosition.x, (int)jewel.JewelPosition.y); yield return(new WaitForSeconds(DELAY - 0.015f)); Ulti.MoveTo(this.gameObject, pos, DELAY); StartCoroutine(_Destroy()); }
public void MiniStar(Vector3 startpos, Vector3 endpos) { GameObject tmp = (GameObject)Instantiate(EffectPrefabs[12]); //tmp.transform.SetParent(parent.transform, false); print("endpos " + endpos); Ulti.MoveTo(tmp, startpos, endpos, 1.2f, -2.2f); Destroy(tmp, 1.2f); }
IEnumerator _ReGroup(Vector2 pos) { // 从数组中移除该对象 RemoveFromList((int)jewel.JewelPosition.x, (int)jewel.JewelPosition.y); // 等待时间DELAY - 0.015f yield return(new WaitForSeconds(DELAY - 0.015f)); // 移动到pos Ulti.MoveTo(this.gameObject, pos, DELAY); // 销毁宝石(协程) StartCoroutine(_Destroy()); }
//check logic game public void RuleChecker(GameObject obj1, GameObject obj2) { JewelObj Jewel1 = obj1.GetComponent <JewelObj>(); JewelObj Jewel2 = obj2.GetComponent <JewelObj>(); List <JewelObj> NeiObj1 = Ulti.ListPlus(Jewel1.GetCollumn(Jewel2.jewel.JewelPosition, Jewel1.jewel.JewelType, null), Jewel1.GetRow(Jewel2.jewel.JewelPosition, Jewel1.jewel.JewelType, null), Jewel1); List <JewelObj> NeiObj2 = Ulti.ListPlus(Jewel2.GetCollumn(Jewel1.jewel.JewelPosition, Jewel2.jewel.JewelType, null), Jewel2.GetRow(Jewel1.jewel.JewelPosition, Jewel2.jewel.JewelType, null), Jewel2); if (Jewel1.jewel.JewelType == 99 || Jewel2.jewel.JewelType == 99) { if (Jewel1.jewel.JewelType == 8 || Jewel2.jewel.JewelType == 8) { Jewel1.SetBackAnimation(obj2); Jewel2.SetBackAnimation(obj1); return; } } if (NeiObj1.Count >= 3 || NeiObj2.Count >= 3 || Jewel1.jewel.JewelType == 8 || Jewel2.jewel.JewelType == 8) { Ulti.MoveTo(obj1, obj2.transform.localPosition, 0.2f); Ulti.MoveTo(obj2, obj1.transform.localPosition, 0.2f); SwapJewelPosition(obj1, obj2); JewelProcess(NeiObj1, NeiObj2, obj1, obj2); } else { //判断是否使用强制交换 if (isExChange) { Ulti.MoveTo(obj1, obj2.transform.localPosition, 0.2f); Ulti.MoveTo(obj2, obj1.transform.localPosition, 0.2f); SwapJewelPosition(obj1, obj2); isExChange = false; prop_bg.SetActive(false); JewelSpawner.spawn.transform.position = new Vector3(0, 0, 0); JewelSpawner.spawn.transform.SetAsLastSibling(); } else { Jewel1.SetBackAnimation(obj2); Jewel2.SetBackAnimation(obj1); } } }
//消除检查 public void RuleChecker(GameObject obj1, GameObject obj2) { // 获取对象上的宝石对象脚本 JewelObj Jewel1 = obj1.GetComponent <JewelObj>(); JewelObj Jewel2 = obj2.GetComponent <JewelObj>(); LogUtils.TraceNow("Pointer:" + Jewel1.jewel.JewelPosition.x + "," + Jewel1.jewel.JewelPosition.y); LogUtils.TraceNow("Selected:" + Jewel2.jewel.JewelPosition.x + "," + Jewel2.jewel.JewelPosition.y); // (以obj2为中心)将横向要消除的对象列表与纵向要消除的对象列表合并 List <JewelObj> NeiObj1 = Ulti.ListPlus( Jewel1.GetCollumn(Jewel2.jewel.JewelPosition, Jewel1.jewel.JewelType, null), Jewel1.GetRow(Jewel2.jewel.JewelPosition, Jewel1.jewel.JewelType, null), Jewel1); // (以obj1为中心)将横向要消除的对象列表与纵向要消除的对象列表合并 List <JewelObj> NeiObj2 = Ulti.ListPlus(Jewel2.GetCollumn(Jewel1.jewel.JewelPosition, Jewel2.jewel.JewelType, null), Jewel2.GetRow(Jewel1.jewel.JewelPosition, Jewel2.jewel.JewelType, null), Jewel2); // 如果obj1或obj2的类型是星形 if (Jewel1.jewel.JewelType == 99 || Jewel2.jewel.JewelType == 99) { // 同时obj1或obj2的类型是特殊技能-清除相同图块 if (Jewel1.jewel.JewelType == 8 || Jewel2.jewel.JewelType == 8) { // 播放移动无效的动画 Jewel1.SetBackAnimation(obj2); Jewel2.SetBackAnimation(obj1); return; } } // obj1或obj2消除列表>=3, 或 obj1或obj2的类型是特殊技能-清除相同图块 if (NeiObj1.Count >= 3 || NeiObj2.Count >= 3 || Jewel1.jewel.JewelType == 8 || Jewel2.jewel.JewelType == 8) { // 交换obj1,obj2位置 Ulti.MoveTo(obj1, obj2.transform.localPosition, 0.2f); Ulti.MoveTo(obj2, obj1.transform.localPosition, 0.2f); // 交换obj1,obj2在数组中位置 SwapJewelPosition(obj1, obj2); // 进行消除运算 JewelProcess(NeiObj1, NeiObj2, obj1, obj2); } else { // 播放移动无效的动画 Jewel1.SetBackAnimation(obj2); Jewel2.SetBackAnimation(obj1); } }
public GameObject MGE(Vector3 pos, Vector3 target) { GameObject tmp = Instantiate(EffectPrefabs[11]) as GameObject; tmp.transform.SetParent(parent.transform, false); tmp.transform.position = new Vector3(pos.x, pos.y, -0.22f); float AngleRad = Mathf.Atan2(target.y - pos.y, target.x - pos.x); float AngleDeg = (180 / Mathf.PI) * AngleRad; tmp.transform.rotation = Quaternion.Euler(0, 0, AngleDeg); Ulti.MoveTo(tmp, target, 0.4f); Destroy(tmp, 0.4f); SoundController.Sound.Gun(); return(tmp); }
//check logic game public void RuleChecker(GameObject obj1, GameObject obj2) { JewelObj Jewel1 = obj1.GetComponent <JewelObj>(); JewelObj Jewel2 = obj2.GetComponent <JewelObj>(); if (Jewel1.jewel.JewelPower == (int)GameController.Power.LUCKY) { Jewel1.jewel.JewelType = Supporter.sp.LuckyCheck(Jewel2.jewel.JewelPosition); } if (Jewel2.jewel.JewelPower == (int)GameController.Power.LUCKY) { Jewel2.jewel.JewelType = Supporter.sp.LuckyCheck(Jewel1.jewel.JewelPosition); } List <JewelObj> NeiObj1 = Ulti.ListPlus(Jewel1.GetCollumn(Jewel2.jewel.JewelPosition, Jewel1.jewel.JewelType, null), Jewel1.GetRow(Jewel2.jewel.JewelPosition, Jewel1.jewel.JewelType, null), Jewel1); List <JewelObj> NeiObj2 = Ulti.ListPlus(Jewel2.GetCollumn(Jewel1.jewel.JewelPosition, Jewel2.jewel.JewelType, null), Jewel2.GetRow(Jewel1.jewel.JewelPosition, Jewel2.jewel.JewelType, null), Jewel2); //Take a peek into the future destination SwapJewelPosition(obj1, obj2); bool hasCombo = ComboManager.Instance.ComboProcess(obj1); SwapJewelPosition(obj1, obj2); //After that, return to normal operations //If there is a combo, let combo operation handle it if (hasCombo) { return; } if (Jewel1.jewel.JewelType == 99 || Jewel2.jewel.JewelType == 99) { if (Jewel1.jewel.JewelType == 8 || Jewel2.jewel.JewelType == 8) { Jewel1.SetBackAnimation(obj2); Jewel2.SetBackAnimation(obj1); return; } } if (NeiObj1.Count >= 3 || NeiObj2.Count >= 3 || Jewel1.jewel.JewelType == 8 || Jewel2.jewel.JewelType == 8) { Ulti.MoveTo(obj1, obj2.transform.localPosition, 0.2f); Ulti.MoveTo(obj2, obj1.transform.localPosition, 0.2f); SwapJewelPosition(obj1, obj2); JewelProcess(NeiObj1, NeiObj2, obj1, obj2); if (Jewel1.jewel.JewelPower == (int)GameController.Power.LUCKY) { GameController.action._guestManager.GiveItemToFirstFoundGuest(); } if (Jewel2.jewel.JewelPower == (int)GameController.Power.LUCKY) { GameController.action._guestManager.GiveItemToFirstFoundGuest(); } if (NeiObj1.Count == 3 || NeiObj2.Count == 3) { Supporter.sp.SpawnARandomStripe(Jewel1.jewel.JewelType); } //Valid move, so minus a move MoveChecker(); } else { Jewel1.SetBackAnimation(obj2); Jewel2.SetBackAnimation(obj1); } }