| | |
| | | this.hurts = hurtList; |
| | | this.mBulletIndex = bulletIndex; |
| | | |
| | | // 设置bulletTrans坐标为caster.heroRectTrans的世界坐标转换到bulletTrans父节点下的本地坐标 |
| | | if (bulletTrans != null && caster.heroRectTrans != null) |
| | | // 设置bulletTrans坐标为caster的世界坐标转换到bulletTrans父节点下的本地坐标 |
| | | RectTransform casterRect = caster.GetRectTransform(); |
| | | if (bulletTrans != null && casterRect != null) |
| | | { |
| | | var parent = bulletTrans.parent as RectTransform; |
| | | Vector2 localPoint; |
| | | RectTransformUtility.ScreenPointToLocalPointInRectangle( |
| | | parent, |
| | | RectTransformUtility.WorldToScreenPoint(null, caster.heroRectTrans.position), |
| | | RectTransformUtility.WorldToScreenPoint(null, casterRect.position), |
| | | null, |
| | | out localPoint); |
| | | bulletTrans.anchoredPosition = localPoint; |