| | |
| | | /// <summary> |
| | | /// 掉落半径 |
| | | /// </summary> |
| | | public float DropRadius { get; set; } = 50f; |
| | | public float DropRadius { get; set; } = 5f; |
| | | |
| | | public Canvas canvas; |
| | | |
| | |
| | | Transform mainUITransform = mainUI.GetComponent<Transform>(); |
| | | obj.GetComponent<Transform>().SetParent(mainUITransform, true); |
| | | |
| | | // Vector3 screenPos = Camera.main.WorldToScreenPoint(worldPos); |
| | | // Vector2 targetPos; |
| | | // RectTransformUtility.ScreenPointToLocalPointInRectangle(canvas.transform as RectTransform, screenPos, canvas.worldCamera, out targetPos); |
| | | // RectTransform rectTransform = obj.GetComponent<RectTransform>(); |
| | | // rectTransform.anchoredPosition = pos; |
| | | // obj.transform.localRotation = Quaternion.identity; |
| | | |
| | | // Vector3 screenPos = Camera.main.WorldToScreenPoint(worldPos); |
| | | // screenPos.z = 0; |
| | | |
| | | obj.transform.position = worldPos; |
| | | obj.transform.localRotation = Quaternion.identity; |
| | | obj.transform.localScale = Vector3.one; |
| | | |
| | | // if (isRandom) |
| | | // { |
| | | // Vector2 p = UnityEngine.Random.insideUnitCircle * DropRadius; |
| | | // Vector3 pos1 = p.normalized * p.magnitude; |
| | | // Vector3 objPos = obj.transform.position; |
| | | // objPos.x += pos1.x; |
| | | // objPos.y += pos1.y; |
| | | // obj.transform.position = objPos; |
| | | // } |
| | | if (isRandom) |
| | | { |
| | | Vector2 p = UnityEngine.Random.insideUnitCircle * DropRadius; |
| | | Vector3 pos1 = p.normalized * p.magnitude; |
| | | Vector3 objPos = obj.transform.position; |
| | | objPos.x += pos1.x; |
| | | objPos.z += pos1.y; |
| | | obj.transform.position = objPos; |
| | | } |
| | | |
| | | dropReward.PlayParticle(); |
| | | DropObjDic.Add(drop.Id, obj); |