| | |
| | | using UnityEngine; |
| | | using KTGMGemClient; |
| | | using System.Collections.Generic; |
| | | using Core.Utilities; |
| | | using DG.Tweening; |
| | | |
| | | namespace TowerDefense.Economy |
| | | { |
| | |
| | | if (agent != null) |
| | | { |
| | | EndlessLevelManager.instance.Currency.AddCurrency(lootDropped); |
| | | PlayDropGold(lootDropped, agent.position); |
| | | |
| | | // 处理掉落 |
| | | int tunel = agent.waveLineID + 1; |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void PlayDropGold(int lootDropped, Vector3 worldPos) |
| | | { |
| | | GameObject mainUI = GameObject.Find("MainUI"); |
| | | GameObject dropGoldPrefab = Resources.Load<GameObject>("Prefabs/DropGold"); |
| | | GameObject obj = Poolable.TryGetPoolable(dropGoldPrefab); |
| | | |
| | | DropGold dropGold = obj.GetComponent<DropGold>(); |
| | | dropGold.SetDrop(lootDropped); |
| | | |
| | | obj.GetComponent<Transform>().SetParent(GameObject.Find("MainUI").GetComponent<Transform>(), false); |
| | | Camera camera = GameObject.Find("SceneCamera3D").GetComponent<Camera>(); |
| | | Vector3 screenPos = camera.WorldToScreenPoint(worldPos); |
| | | screenPos.z = 0; |
| | | obj.transform.position = screenPos; |
| | | obj.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f); |
| | | float preY = obj.transform.position.y; |
| | | CanvasGroup canvasGroup = obj.GetComponent<CanvasGroup>(); |
| | | |
| | | Sequence sequence = DOTween.Sequence(); |
| | | sequence.Append(DOTween.To( |
| | | () => obj.transform.position.y, |
| | | (float v) => |
| | | { |
| | | Vector3 pos = obj.transform.position; |
| | | pos.y = v; |
| | | obj.transform.position = pos; |
| | | }, preY + 45, 0.2f) |
| | | .SetEase(Ease.OutCubic)); |
| | | sequence.Append(DOTween.To( |
| | | () => canvasGroup.alpha, |
| | | (float v) => |
| | | { |
| | | canvasGroup.alpha = v; |
| | | }, 0, 0.8f).SetDelay(0.5f)); |
| | | sequence.AppendCallback(() => |
| | | { |
| | | canvasGroup.alpha = 1; |
| | | Poolable.TryPool(obj); |
| | | }); |
| | | } |
| | | } |
| | | } |