| | |
| | | content.SetDamage(damageInfo, () => RemoveDamageContent(content)); |
| | | damageContentList.Add(content); |
| | | |
| | | // heroGo 的 parent 作为参考节点 |
| | | |
| | | var heroRect = damageInfo.hurtObj.heroRectTrans; |
| | | if (heroRect == null) |
| | | return; |
| | | |
| | | // 计算 heroGo 在 content 父节点下的 anchoredPosition |
| | | var contentRect = content.GetComponent<RectTransform>(); |
| | | var contentParentRect = contentRect.parent as RectTransform; |
| | | |
| | | // 获取 heroGo 的世界坐标 |
| | | Vector3 worldTargetPos = heroRect.TransformPoint(heroRect.anchoredPosition); |
| | | // 获取 heroRect 的世界坐标(锚点为中心) |
| | | Vector3 worldTargetPos = heroRect.transform.TransformPoint(heroRect.rect.center); |
| | | |
| | | // 转换到 content 父节点下的 anchoredPosition |
| | | Vector2 anchoredPos; |