private void Pop() { popUpDirection = transform.position.normalized; float randomAngle = Random.Range(0f, 360f); Vector3 groundVec = (_player.transform.position - transform.position).normalized; popDirection = MathCustom.RotateDirectionAround(Vector3.Cross(popUpDirection, groundVec), randomAngle, popUpDirection); Cell cell = GetComponentInParent <Cell>(); GameObject newProps = EarthManager.Instance.CreateProps(popItem.prefab, transform.position, cell); StartCoroutine(PopJumpCoroutine(newProps.transform)); }
private Vector3 GetRosacePosition(float deltaTime) { for (int i = 0; i < angularSpeeds.Count; i++) { Vector3 nVector; nVector = MathCustom.RotateDirectionAround(vectors[i], deltaTime * angularSpeeds[i], Vector3.forward); nVector = nVector.normalized * nTime * 2f; vectors[i] = nVector; nVector.z = 0f; activeVectors.Add(nVector); } Vector3 pos = MathCustom.GetBarycenter(activeVectors.ToArray()); activeVectors.Clear(); return(pos); }