protected void RefreshBoxLocation() { int currNoOfPointsAdded = m_Decal.PointsCount; if (currNoOfPointsAdded != m_NoOfPointsAdded && currNoOfPointsAdded >= 2) { Vector3 StartPt = m_Decal.GetPoint(0); Vector3 EndPt = m_Decal.GetPoint(currNoOfPointsAdded - 1); m_DefenderCollider.center = (StartPt + EndPt) * 0.5f; } }
protected void RefreshBoxSize() { int currNoOfPointsAdded = m_Decal.PointsCount; if (currNoOfPointsAdded != m_NoOfPointsAdded && currNoOfPointsAdded >= 2) { Vector3 StartPt = m_Decal.GetPoint(0); Vector3 EndPt = m_Decal.GetPoint(currNoOfPointsAdded - 1); float boxlen = (EndPt - StartPt).magnitude * m_PercentOfPatchSizeToBoxSizeLength; float boxWidth = m_Decal.Thickness * m_PercentOfPatchSizeToBoxSizeWidth; m_AttackerCollider.size = new Vector3(boxWidth, m_ColliderHeight, boxlen); m_AttackerCollider.transform.position = (StartPt + EndPt) * 0.5f; m_AttackerCollider.transform.forward = (EndPt - StartPt).normalized; } }