| | |
| | | { |
| | | AllDropList = new List<EndlessDrop>(); |
| | | DropObjDic = new Dictionary<int, GameObject>(); |
| | | allIconLis = new List<FlyImage>(); |
| | | } |
| | | |
| | | // Update is called once per frame |
| | |
| | | |
| | | if (AllDropList[i].ElapsedTime >= AllDropList[i].AutoPickupTime) |
| | | { |
| | | AllDropList[i].IsPickupCompleted = true; |
| | | SafelyCallObtainDrop(AllDropList[i]); |
| | | RemoveDrop(AllDropList[i].Id); |
| | | EndlessDropReward dropReward = DropObjDic[AllDropList[i].Id].GetComponent<EndlessDropReward>(); |
| | | // dropReward?.OnClick(); |
| | | |
| | | //AllDropList[i].IsPickupCompleted = true; |
| | | //SafelyCallObtainDrop(AllDropList[i]); |
| | | //RemoveDrop(AllDropList[i].Id); |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <param name="pos">小怪的世界坐标</param> |
| | | public void AddDrop(List<reward> list, Vector3 pos) |
| | | { |
| | | for (int i = 0; i < list.Count; ++i) |
| | | { |
| | | EndlessDrop drop = new EndlessDrop(); |
| | | drop.Reward = list[i]; |
| | | drop.Id = GetDropId(); |
| | | drop.AutoPickupTime = AutoPickupTime; |
| | | CreateDrop(drop, pos, list.Count > 0); |
| | | AllDropList.Add(drop); |
| | | } |
| | | // for (int i = 0; i < list.Count; ++i) |
| | | // { |
| | | // EndlessDrop drop = new EndlessDrop(); |
| | | // drop.Reward = list[i]; |
| | | // drop.Id = GetDropId(); |
| | | // drop.AutoPickupTime = AutoPickupTime; |
| | | // CreateDrop(drop, pos, list.Count > 0); |
| | | // AllDropList.Add(drop); |
| | | // } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | dropReward.DropData = drop; |
| | | dropReward.SetIcon(); |
| | | |
| | | GameObject mainUI = GameObject.Find("MainUI"); |
| | | GameObject mainUI = GameObject.Find("BottomUI"); |
| | | |
| | | Transform mainUITransform = mainUI.transform; |
| | | obj.transform.SetParent(mainUITransform, false); |
| | |
| | | obj.GetComponent<Transform>().SetParent(mainUITransform, true); |
| | | |
| | | obj.transform.position = worldPos; |
| | | |
| | | Vector3 offect = obj.GetComponent<RectTransform>().anchoredPosition3D; |
| | | offect.z = 0; |
| | | obj.GetComponent<RectTransform>().anchoredPosition3D = offect; |
| | | // obj.transform.localRotation = Quaternion.identity; |
| | | // obj.transform.localScale = Vector3.one; |
| | | |
| | |
| | | DropObjDic.Add(drop.Id, obj); |
| | | } |
| | | |
| | | |
| | | List<FlyImage> allIconLis; |
| | | public GameObject drapIcon; |
| | | |
| | | public FlyImage CreateIcon(Transform ts) |
| | | { |
| | | for (int i = 0; i < allIconLis.Count; i++) |
| | | { |
| | | if (!allIconLis[i].gameObject.activeSelf) |
| | | { |
| | | allIconLis[i].gameObject.SetActive(true); |
| | | return allIconLis[i]; |
| | | } |
| | | } |
| | | |
| | | GameObject obj = Instantiate(drapIcon, ts); |
| | | FlyImage fly = obj.GetComponent<FlyImage>(); |
| | | allIconLis.Add(fly); |
| | | return fly; |
| | | |
| | | } |
| | | |
| | | public void FlyIcon(Transform ts, Sprite sp, Vector3 startP, Vector3 endP, bool useBezier, int count) |
| | | { |
| | | StartCoroutine(CreateIcon(ts, sp, startP, endP, useBezier, count)); |
| | | } |
| | | |
| | | IEnumerator CreateIcon(Transform ts, Sprite sp, Vector3 startP, Vector3 endP, bool useBezier, int count) |
| | | { |
| | | FlyImage fly; |
| | | |
| | | // for (int i = 0; i < 5; i++) |
| | | // { |
| | | // fly = CreateIcon(ts); |
| | | // fly.SetDestination(sp, startP, endP, useBezier); |
| | | // } |
| | | // yield return new WaitForSeconds(0.2f); |
| | | |
| | | |
| | | for (int i = 0; i < 15; i++) |
| | | { |
| | | fly = CreateIcon(ts); |
| | | if (i == 0) |
| | | { |
| | | fly.Init(true, count); |
| | | } |
| | | else |
| | | { |
| | | fly.Init(false, 0); |
| | | } |
| | | |
| | | fly.SetDestination(sp, startP, endP, useBezier); |
| | | yield return new WaitForSeconds(0.01f); |
| | | |
| | | } |
| | | |
| | | yield break; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 调用掉落获得事件 |
| | | /// </summary> |