| | |
| | | |
| | | public Text DoubleHitText; |
| | | |
| | | public Image OneTimeKillObj; |
| | | private bool isShowing; |
| | | public DoubleHitImg OneTimeKillObj; |
| | | |
| | | public Text OneTimeKillText; |
| | | |
| | |
| | | // Start is called before the first frame update |
| | | private void Start() |
| | | { |
| | | isShowing = false; |
| | | Init(); |
| | | EventCenter.Ins.Add<int>((int)KTGMGemClient.EventType.EndlessAgentDead, AgentDead); |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.EndlessOneHit, OnHit); |
| | |
| | | if (count >= 10) |
| | | { |
| | | AddScore(0); |
| | | ShowOneTimeKill(10, 500); |
| | | } |
| | | else if (count >= 8) |
| | | { |
| | | AddScore(0); |
| | | ShowOneTimeKill(8, 200); |
| | | } |
| | | else if (count >= 5) |
| | | { |
| | | AddScore(0); |
| | | ShowOneTimeKill(5, 100); |
| | | ShowOneTimeKill(); |
| | | } |
| | | } |
| | | |
| | |
| | | else |
| | | remainTime -= Time.deltaTime; |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// 显示一次性击杀飘字 |
| | | /// </summary> |
| | | /// <param name="count"></param> |
| | | /// <param name="score"></param> |
| | | private void ShowOneTimeKill(int count, int score) |
| | | private void ShowOneTimeKill() |
| | | { |
| | | if (!isShowing) |
| | | { |
| | | isShowing = true; |
| | | Image obj = Instantiate(OneTimeKillObj); |
| | | obj.transform.SetParent(GameObject.Find("Panel").transform, false); |
| | | obj.sprite = Resources.Load<Sprite>($"UI/DoubleHit/hit_{count}"); |
| | | StartCoroutine(KillImage(obj.gameObject)); |
| | | OneTimeKillObj.SetkillCount(); |
| | | } |
| | | |
| | | //Destroy(obj.gameObject, 2.05f); |
| | | } |
| | | |
| | | IEnumerator KillImage(GameObject obj) |
| | | { |
| | | yield return new WaitForSeconds(2.05f); |
| | | Destroy(obj); |
| | | |
| | | isShowing = false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 飘连击奖励分数 |