void Update() { Vector3 localCoordDiff = (cellCoordPosition.GetGlobalPos() - playerPosition.GetGlobalPos()) * cellCoordPosition.GetCellSize(); Vector3 localPosition = new Vector3(transform.position.x - localCoordDiff.x, transform.position.y - localCoordDiff.y, transform.position.z - localCoordDiff.z); cellCoordPosition.SetLocalPosition(localPosition.x, localPosition.y, localPosition.z); if (cellCoordPosition.OutOfCell()) { cellCoordPosition.UpdateGlobalPos(); cellCoordPosition.SnapCoordsBackToCell(); } }
public bool OutOfBounds() { return(cellCoordPosition.OutOfCell()); }