public void BallExploreBtn() { if (dataControl.mapInfo[dataControl.playerX, dataControl.playerY] == 0) { dataControl.mapInfo[dataControl.playerX, dataControl.playerY] = 1; IsPause = true; if (GameAPI.IsMeet(GameData.mapInfo[dataControl.mapData[dataControl.playerX][dataControl.playerY]].bizarre + 0.3f)) { UIAPI.ShowMsgBox("怪物", "发现看守宝物的怪物,是否战斗", "战斗|逃离", arg => { if ((int)arg == 0) { fightPanel.SetActive(true); fightPanel.GetComponent <FightPage>().Init(int.Parse(mapTemp)); SetChooseSprite(BallType.Fight); GuideAPI.FightStartFunc(); //Debug.Log("3"); } IsPause = false; }); } else { UIAPI.ShowMsgBox("提示", "未发现任何有价值的东西", "确定", arg => { IsPause = false; }); } dataControl.Statistics[GameData.Statist[(int)GameData.SID.EXPLORE]]++; SaveGameData(); } else { IsPause = true; UIAPI.ShowMsgBox("提示", "已经探索过了", "确定", arg => { IsPause = false; }); } }
private void Move(int x, int y, int m, int n) { int X = dataControl.playerX + x; int Y = dataControl.playerY + y; if (X < mapHeight && X >= 0 && Y >= 0 && Y < mapWidth) { AudioControl.PlayEffect(GameDef.walkEffect); var currentPos = GameData.mapInfo[dataControl.mapData[X][Y]]; //判断人物位置是否偏离 if (player.transform.localPosition != pPos) { player.transform.localPosition = pPos; } if (cam.transform.position != cPos) { cam.transform.position = cPos; } if (OutSide(x, y, dataControl.playerX, dataControl.playerY)) { if (dataControl.playerX < 3 || dataControl.playerX >= mapHeight - 3 || dataControl.playerY < 2 || dataControl.playerY >= mapWidth - 2) { pPos = player.transform.localPosition + new Vector3(10.5f * m, 10.5f * n, 0); player.transform.DOLocalMove(pPos, 0.5f); //player.transform.position += new Vector3(10.5f * m, 10.5f * n, 0); } else { pPos = cPos = new Vector3(10.5f * m + cam.transform.position.x, 10.5f * n + cam.transform.position.y, 0); cam.transform.DOMove(cPos, 0.5f); player.transform.DOLocalMove(pPos, 0.5f); //cam.transform.position = new Vector3(10.5f * m + cam.transform.position.x, 10.5f * n + cam.transform.position.y, 0); //player.transform.localPosition = cam.transform.position; } } else { if (OutSide(x, y, X, Y)) { pPos = player.transform.localPosition + new Vector3(10.5f * m, 10.5f * n, 0); player.transform.DOLocalMove(pPos, 0.5f); //player.transform.position += new Vector3(10.5f * m, 10.5f * n, 0); } else { cPos = new Vector3(10.5f * m + cam.transform.position.x, 10.5f * n + cam.transform.position.y, 0); cam.transform.DOMove(cPos, 0.5f); pPos = player.transform.localPosition + new Vector3(10.5f * m, 10.5f * n, 0); player.transform.DOLocalMove(pPos, 0.5f); //cam.transform.position = new Vector3(10.5f * m + cam.transform.position.x, 10.5f * n + cam.transform.position.y, 0); //player.transform.localPosition += new Vector3(10.5f * m, 10.5f * n, 0); } } dataControl.playerX = X; dataControl.playerY = Y; point.transform.localPosition = Vector3.zero; point.name = dataControl.playerX + "," + dataControl.playerY; if (dataControl.currentFood >= currentPos.costFood)//食物充足 { dataControl.currentFood -= currentPos.costFood; dataControl.currentHP += currentPos.costHP; } else //食物不足,血量减去两倍食物 { dataControl.currentHP -= ((currentPos.costFood - dataControl.currentFood) * 2 - currentPos.costHP); dataControl.currentFood = 0; } SwitchBall(currentPos.type); if (dataControl.bossX + 1 >= dataControl.playerX && dataControl.bossX - 1 <= dataControl.playerX && dataControl.bossY + 1 >= dataControl.playerY && dataControl.bossY - 1 <= dataControl.playerY) { IsPause = true; UIAPI.ShowMsgBox("BOSS", "发现BOSS,是否战斗,胜利后将直接返回主世界", "战斗|逃离", (arg) => { if ((int)arg == 0) { fightPanel.SetActive(true); fightPanel.GetComponent <FightPage>().Init(84); SetChooseSprite(BallType.Fight); GuideAPI.FightStartFunc(); //Debug.Log("1"); } IsPause = false; }); } else if (!currentPos.type.Contains("explore") || dataControl.mapInfo[dataControl.playerX, dataControl.playerY] != 0) { if (GameAPI.IsMeet(currentPos.bizarre)) { IsPause = true; UIAPI.ShowMsgBox("怪物", "发现怪物,是否战斗", "战斗|逃离", (arg) => { if ((int)arg == 0) { fightPanel.SetActive(true); fightPanel.GetComponent <FightPage>().Init(15); SetChooseSprite(BallType.Fight); GuideAPI.FightStartFunc(); } IsPause = false; }); } } SaveGameData(); } }