/// <summary> /// 重新调整JewelPosition的位置,并播放下落动画 /// 此方法有点类似于排序,主要是处理当Map中有消除的方块后产生空位,此时需要将空位上方的方块移动到空位。 /// (说白了就是冒泡排序,地图中消失的方块移动到后面) /// 将数组中Y轴的往下移动。全部移动完后,所有地图中空的位置均为后面的值,例如6、7、8这几个位置是空的) /// </summary> public void getNewPosition() { int newpos = (int)jewel.JewelPosition.y; // 新的y坐标 int x = (int)jewel.JewelPosition.x; // x坐标 int oldpos = (int)jewel.JewelPosition.y; // 初始的y坐标 for (int y = newpos - 1; y >= 0; y--) // 遍历从现在往下的jewelObj { // 如果该位置不是固定为空并且该位置没有冰崩特效并且该位置没有宝石对象 if (GribManager.cell.Map[x, y] != 0 && GribManager.cell.GribCellObj[x, y].cell.CellEffect != 4 && JewelSpawner.spawn.JewelGribScript[x, y] == null) { newpos = y; } // 如果该位置不是固定为空并且该位置有冰崩特效 else if (GribManager.cell.Map[x, y] != 0 && GribManager.cell.GribCellObj[x, y].cell.CellEffect == 4) { break; } } // 清空原坐标对象 JewelSpawner.spawn.JewelGribScript[x, (int)jewel.JewelPosition.y] = null; JewelSpawner.spawn.JewelGrib[x, (int)jewel.JewelPosition.y] = null; // 生成新坐标 jewel.JewelPosition = new Vector2(x, newpos); JewelSpawner.spawn.JewelGribScript[x, newpos] = this; JewelSpawner.spawn.JewelGrib[x, newpos] = this.gameObject; if (oldpos != newpos) { // 开始下落协程 StartCoroutine(Ulti.IEDrop(this.gameObject, jewel.JewelPosition, GameController.DROP_SPEED)); } }
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 void RuleChecker() { if (jewel.JewelType != 99) { List <JewelObj> list = Ulti.ListPlus(GetRow(jewel.JewelPosition, jewel.JewelType, null), GetCollumn(jewel.JewelPosition, jewel.JewelType, null), this); if (list.Count >= 3) { listProcess(list); Checked = true; } else { //Detect end of move nly when there is no more move if (GameController.action.MoveLeft == 0) { GameController.action.StartCountdown(); } } } else { GameController.action.WinChecker(); } }
public void UltiActivation(Ulti ultiType, bool on) { _actualUlti = ultiType; _ulting = on; if (on) { switch (ultiType) { case Ulti.AGRESSIVE: cursorRotationSpeed = 4f; break; case Ulti.PRECISION: cursorRotationSpeed = -10f; break; case Ulti.REWIND: cursorRotationSpeed = 1.5f; break; } } else { cursorRotationSpeed = 0f; } }
//kiểm tra captch //Lưu thông tin đăng kí vào CSDL public ActionResult Register(UserRegisting user) { if (!ModelState.IsValid) { // TODO: Captcha validation failed, show error message ViewBag.ErrorMsg = "Incorrect CAPTCHA code!"; } else { // TODO: Captcha validation passed, proceed with protected action var u = new ClientUser { f_Username = user.Username, f_Password = Ulti.Md5Hash(user.Password), f_Name = user.Name, f_Email = user.Email, f_DOB = DateTime.ParseExact(user.DOB, "d/m/yyyy", null) }; CSDLQLBH.InsertUser(u); Session["Registered"] = 1; return(RedirectToAction("Login", "Account")); } return(View()); }
// 播放火球特效 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); }
public void getNewPosition() { int newpos = (int)jewel.JewelPosition.y; int x = (int)jewel.JewelPosition.x; int oldpos = (int)jewel.JewelPosition.y; for (int y = newpos - 1; y >= 0; y--) { if (GribManager.cell.Map[x, y] != 0 && GribManager.cell.GribCellObj[x, y].cell.CellEffect != 4 && JewelSpawner.spawn.JewelGribScript[x, y] == null) { newpos = y; } else if (GribManager.cell.Map[x, y] != 0 && GribManager.cell.GribCellObj[x, y].cell.CellEffect == 4) { break; } } JewelSpawner.spawn.JewelGribScript[x, (int)jewel.JewelPosition.y] = null; JewelSpawner.spawn.JewelGrib[x, (int)jewel.JewelPosition.y] = null; jewel.JewelPosition = new Vector2(x, newpos); JewelSpawner.spawn.JewelGribScript[x, newpos] = this; JewelSpawner.spawn.JewelGrib[x, newpos] = this.gameObject; if (oldpos != newpos) { StartCoroutine(Ulti.IEDrop(this.gameObject, jewel.JewelPosition, GameController.DROP_SPEED)); } }
/// <summary> /// 获取新位置 并进行下落动画 /// </summary> public void getNewPosition() { int newpos = (int)Fruit.FruitPosition.y; int x = (int)Fruit.FruitPosition.x; int oldpos = (int)Fruit.FruitPosition.y; for (int y = newpos; y >= 0; y--) { if (GridManager.grid.Map[x, y] != 0 && GridManager.grid.GridCellObj[x, y].Cell.CellEffect != 4 && FruitSpawner.spawn.FruitGridScript[x, y] == null) { newpos = y; } else if (GridManager.grid.Map[x, y] != 0 && GridManager.grid.GridCellObj[x, y].Cell.CellEffect == 4) { break; } FruitSpawner.spawn.FruitGridScript[x, (int)Fruit.FruitPosition.y] = null; FruitSpawner.spawn.FruitGrid[x, (int)Fruit.FruitPosition.y] = null; Fruit.FruitPosition = new Vector2(x, newpos); FruitSpawner.spawn.FruitGridScript[x, newpos] = this; FruitSpawner.spawn.FruitGrid[x, newpos] = this.gameObject; if (oldpos != newpos) { StartCoroutine(Ulti.IEDrop(this.gameObject, Fruit.FruitPosition, GameController.DROP_SPEED)); } } }
//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 List <FruitObj> getList() { List <FruitObj> list = Ulti.ListPlus(GetRow(Fruit.FruitPosition, Fruit.FruitType, null), GetCollumn(Fruit.FruitPosition, Fruit.FruitType, null), this); return(list); }
/// <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 List <JewelObj> getList() { List <JewelObj> list = Ulti.ListPlus(GetRow(jewel.JewelPosition, jewel.JewelType, null), GetCollumn(jewel.JewelPosition, jewel.JewelType, null), this); return(list); }
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); }
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 AdrenalinUltiLossCoroutine(Ulti activeUlti) //Perdida de adrenalina con la ulti activada { while (adrenalin > 0) { ChangeAdrenalin(Time.deltaTime * ultiLossSpeed); yield return(new WaitForEndOfFrame()); } _model.UltiActivation(activeUlti); }
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 int getListcount() { // 合并行,列消除列表 List <JewelObj> list = Ulti.ListPlus(GetRow(jewel.JewelPosition, jewel.JewelType, null), GetCollumn(jewel.JewelPosition, jewel.JewelType, null), this); // 返回列表大小 return(list.Count); }
// GET: ManageProduct/Delete public ActionResult Delete(int id) { var pD = CSDLQLBH.GetSingleProduct(id); if (pD != null) { CSDLQLBH.RemoveProduct(id); } Ulti.DeleteProductImgs(id, Server.MapPath("~")); return(RedirectToAction("Index")); }
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()); }
public void UltiActivation(Ulti ultiID, bool on) { if (on) { StopCoroutine(AdrenalinLossCoroutine()); StartCoroutine(AdrenalinUltiLossCoroutine(ultiID)); } else { StartCoroutine(AdrenalinLossCoroutine()); StopCoroutine(AdrenalinUltiLossCoroutine(ultiID)); } }
/// <summary> /// 获取同行相连 /// </summary> /// <param name="Pos"></param> /// <param name="type"></param> /// <param name="bonus"></param> /// <returns></returns> public List <FruitObj> GetRow(Vector2 Pos, int type, FruitObj bonus) { List <FruitObj> tmp1 = GetLeft(Pos, type); List <FruitObj> tmp2 = GetRight(Pos, type); if (tmp1.Count + tmp2.Count > 1) { return(Ulti.ListPlus(tmp1, tmp2, bonus)); } else { return(new List <FruitObj>()); } }
public List <JewelObj> GetCollumn(Vector2 Pos, int type, JewelObj bonus) { List <JewelObj> tmp1 = GetTop(Pos, type); List <JewelObj> tmp2 = GetBot(Pos, type); if (tmp1.Count + tmp2.Count > 1) { return(Ulti.ListPlus(tmp1, tmp2, bonus)); } else { return(new List <JewelObj>()); } }
//消除检查 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); } }
//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); } } }
/// <summary> /// 游戏算法规则检查 /// </summary> public void RuleChecker() { if (Fruit.FruitType != 99) { List <FruitObj> list = Ulti.ListPlus(GetRow(Fruit.FruitPosition, Fruit.FruitType, null), GetCollumn(Fruit.FruitPosition, Fruit.FruitType, null), this); if (list.Count >= 3) { listProcess(list); Checked = true; } else { GameController.gameController.WinChecker(); } } }
public ActionResult Register(UserRegisting user) { var u = new User { f_UserName = user.UserName, f_Password = Ulti.Md5Hash(user.Password), f_Name = user.Name }; using (var dc = new QLKSEntities()) { dc.Users.Add(u); dc.SaveChanges(); } return(View()); }
/// <summary> /// 获取列消除List /// </summary> /// <param name="Pos"></param> /// <param name="type"></param> /// <param name="bonus"></param> /// <returns></returns> public List <JewelObj> GetCollumn(Vector2 Pos, int type, JewelObj bonus) { // 获取上边类型相同的对象列表 List <JewelObj> tmp1 = GetTop(Pos, type); // 获取下边类型相同的对象列表 List <JewelObj> tmp2 = GetBot(Pos, type); // 如果相同的类型数>=3 if (tmp1.Count + tmp2.Count > 1) { // 返回合并两个list的list return(Ulti.ListPlus(tmp1, tmp2, bonus)); } else { return(new List <JewelObj>()); } }
public void RuleChecker() { if (jewel.JewelType != 99) { List <JewelObj> list = Ulti.ListPlus(GetRow(jewel.JewelPosition, jewel.JewelType, null), GetCollumn(jewel.JewelPosition, jewel.JewelType, null), this); if (list.Count >= 3) { listProcess(list); Checked = true; } } else { GameController.action.WinChecker(); } }
public ActionResult Add(ClientProduct p, HttpPostedFile imgLg, HttpPostedFile imgSm) { //khi hai ô này rỗng if (p.TinyDes == null) { p.TinyDes = string.Empty; } if (p.FullDesRaw == null) { p.FullDesRaw = string.Empty; } p.FullDes = p.FullDesRaw; p.View = 0; //lưu thông tin p = CSDLQLBH.InsertProduct(p); Ulti.SaveProductImgs((int)p.ProID, Server.MapPath("~"), imgLg, imgSm); return(RedirectToAction("Index")); }
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); }