public Vector3 GetRepositionInTile(int index, int amount) { Vector3 newPos = playerController.currentTile.transform.position; newPos.y = this.transform.position.y; float fixPos = 0.3f; if (amount == 2) { if (index == 0) { if (MathDt.IsBetween(this.transform.rotation.eulerAngles.y, 80, 100)) { newPos.z += fixPos; } else if (MathDt.IsBetween(this.transform.rotation.eulerAngles.y, 170, 190)) { newPos.x -= fixPos; } else if (MathDt.IsBetween(this.transform.rotation.eulerAngles.y, 260, 280)) { newPos.z -= fixPos; } else { newPos.x += fixPos; } } else { if (MathDt.IsBetween(this.transform.rotation.eulerAngles.y, 80, 100)) { newPos.z -= fixPos; } else if (MathDt.IsBetween(this.transform.rotation.eulerAngles.y, 170, 190)) { newPos.x += fixPos; } else if (MathDt.IsBetween(this.transform.rotation.eulerAngles.y, 260, 280)) { newPos.z += fixPos; } else { newPos.x -= fixPos; } } } return(OffsetRotation(newPos)); }
public Vector3 OffsetRotation(Vector3 newPos) { if (MathDt.IsBetween(this.transform.rotation.eulerAngles.y, 80, 100)) { newPos.x += playerController.currentTile.offsetZ; } else if (MathDt.IsBetween(this.transform.rotation.eulerAngles.y, 170, 190)) { newPos.z -= playerController.currentTile.offsetZ; } else if (MathDt.IsBetween(this.transform.rotation.eulerAngles.y, 260, 280)) { newPos.x += playerController.currentTile.offsetZ; } else { newPos.z -= playerController.currentTile.offsetZ; } return(newPos); }