| | |
| | | /// </summary> |
| | | public List<GameObject> HeartList; |
| | | |
| | | public Text hpTxt; |
| | | public ParticleSystem ps; |
| | | |
| | | // Start is called before the first frame update |
| | | private void Start() |
| | | { |
| | | CurrentHP = TotalHP = HeartList.Count; |
| | | hpTxt.text = "x" + CurrentHP.ToString(); |
| | | EventCenter.Ins.Add<int>((int)KTGMGemClient.EventType.EndlessLoseHeart, LoseHeart); |
| | | } |
| | | |
| | |
| | | { |
| | | if (CurrentHP == 0) return; |
| | | |
| | | int preHP = CurrentHP; |
| | | int i = TotalHP - CurrentHP; |
| | | CurrentHP = Mathf.Max(0, CurrentHP - count); |
| | | int num = preHP - CurrentHP; |
| | | int end = i + num; |
| | | // int preHP = CurrentHP; |
| | | // int i = TotalHP - CurrentHP; |
| | | // int num = preHP - CurrentHP; |
| | | // int end = i + num; |
| | | |
| | | while (i < end) |
| | | { |
| | | Image img = HeartList[i].GetComponent<Image>(); |
| | | Color c = img.color; |
| | | c.a = 0.17f; |
| | | img.color = c; |
| | | // while (i < end) |
| | | // { |
| | | // Image img = HeartList[i].GetComponent<Image>(); |
| | | // Color c = img.color; |
| | | // c.a = 0.17f; |
| | | // img.color = c; |
| | | |
| | | GameObject psObj = HeartList[i].transform.GetChild(0).gameObject; |
| | | ParticleSystem ps = psObj.transform.GetChild(0).GetComponent<ParticleSystem>(); |
| | | ps.Play(); |
| | | ++i; |
| | | } |
| | | // GameObject psObj = HeartList[i].transform.GetChild(0).gameObject; |
| | | // ParticleSystem ps = psObj.transform.GetChild(0).GetComponent<ParticleSystem>(); |
| | | // ps.Play(); |
| | | // ++i; |
| | | // } |
| | | |
| | | hpTxt.text = "x" + CurrentHP.ToString(); |
| | | //ps.Play(); |
| | | |
| | | ViewPortAdj.instance.cachedCamera.DOShakePosition(0.25f, 1.5f, 4);//这里只可以震动3D场景中的东西 |
| | | MMVibrationManager.Haptic(HapticTypes.HeavyImpact); |