private void toggleTestClick(bool arg0) { gamedatas.isTest = arg0; gamedatas.MapRating = 0; gamedatas.Notify(); GameControl._instance.setGameMap(); }
/// <summary> /// 游戏结束界面的 no ads按钮 事件 /// </summary> void btn_over_NoAdsClick() { UIPanelManager.Instance.PushPanel(UIPanelType.start); gamedatas.MapRating = 0; gamedatas.curGameProgressValue = 0; gamedatas.Notify(); GameControl._instance.setGameMap(); ball.GetComponent <ballContro>().resetPosition(); }
/// <summary> /// 重置游戏- /// </summary> public void Init() { if (loadedComponent != null) { foreach (var item in loadedComponent) { Destroy(item); } } loadedComponent = new List <GameObject>(); gamedatas.loadedComponentNum = 0; gamedatas.Notify(); }
void btnSelectClick() { gamedatas.curChooseBallSkinId = task.id; gamedatas.Notify(); btnSelect.transform.GetChild(0).gameObject.SetActive(false); btnSelect.transform.GetChild(1).gameObject.SetActive(true); }
/// <summary> /// 设置音效开关 /// </summary> private void btnSoundClick() { if (gamedatas.sound == 1) { gamedatas.sound = 0; btnSound.GetComponent <Image>().enabled = true; btnSound.transform.GetChild(0).gameObject.SetActive(false); } else { gamedatas.sound = 1; btnSound.GetComponent <Image>().enabled = false; btnSound.transform.GetChild(0).gameObject.SetActive(true); } gamedatas.Notify(); }
public void onJoystickValueChanged(Vector2 eventPointerData) { #if UNITY_IOS || UNITY_ANDROID float angle = Vector2.SignedAngle(new Vector2(1, 0), eventPointerData); if (angle != 0) { if (gamedatas.gameState == GAMESTATE.start) { gamedatas.gameState = GAMESTATE.game; gamedatas.Notify(); } RotateMove(new Vector3(0, (-angle - 90), 0)); } #endif }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "component") { transform.parent.GetComponent <move>().isMove_test = true; componentControl xx = collision.gameObject.GetComponent <componentControl>(); if (xx == null) { xx = collision.transform.parent.GetComponent <componentControl>(); } //更新地图进度 if (gamedatas.gameState == GAMESTATE.game && xx != null) { if (((float)xx.mapID / (float)gamedatas.mapComponentsNum) * 100 > gamedatas.curGameProgressValue) { transform.parent.GetComponent <move>().isMove = true; gamedatas.curGameProgressValue = ((float)xx.mapID / (float)gamedatas.mapComponentsNum) * 100; gamedatas.GameProgressValue = ((float)xx.mapID / (float)gamedatas.mapComponentsNum) * 100; gamedatas.curGameGoldValue += (int)(GameDataManager._instance.getGoldUpgradeForLevel(gamedatas.GoldMulitipleLevel).distanceIncome * 2.5f); gamedatas.GameGoldValue += (int)(GameDataManager._instance.getGoldUpgradeForLevel(gamedatas.GoldMulitipleLevel).distanceIncome * 2.5f); } else { if (gamedatas.curGameProgressValue / 100 * (float)gamedatas.mapComponentsNum - xx.mapID >= 3) { transform.parent.GetComponent <move>().isMove = false; } else { transform.parent.GetComponent <move>().isMove = true; } } if (gamedatas.loadedComponentNum - xx.mapID <= 10) { gamedatas.MapRating += 1; gamedatas.Notify(); GameControl._instance.setGameMap(); } } if (collision.transform.GetComponent <componentControl>() == null) { beforeGameoverPosition = collision.transform.parent; } else { beforeGameoverPosition = collision.transform; } gamedatas.beforeGameOverMapID = xx.mapID; gamedatas.Notify(); } else if (collision.gameObject.tag == "gameover") { if (gamedatas.gameState != GAMESTATE.over) { Debug.Log("gameover"); ///无论是碰到陷阱还是AI beforeGameoverPosition = collision.transform.GetComponent <gameoverCube>().mapComponent; gamedatas.beforeGameOverMapID = collision.transform.GetComponent <gameoverCube>().mapComponent.gameObject.GetComponent <componentControl>().mapID; gamedatas.gameState = GAMESTATE.over; UIPanelManager.Instance.PushPanel(UIPanelType.gameover); gamedatas.Notify(); } } else if (collision.gameObject.tag == "end") { if (gamedatas.gameState != GAMESTATE.over) { Debug.Log("success"); collision.gameObject.transform.GetChild(0).GetComponent <Animator>().Play("end"); gamedatas.curGameGoldValue *= 3; //gamedatas.curGameGoldValue *= 3; gamedatas.gameState = GAMESTATE.over; UIPanelManager.Instance.PushPanel(UIPanelType.gameover); gamedatas.Notify(); } } else if (collision.gameObject.tag == "test") { } }