// You should always place GridObjects and GridTiles using their respective Brushes which initialize them automatically protected virtual void Start() { // Initial facing direction m_FacingDirection = GridManager.Instance.GetRelativeNeighborPositionFromOrientation(m_InitialOrientation.ToString(), (m_GridPosition.y & 1) == 1); if (_gridMovement != null) { _gridMovement.Rotate(m_FacingGridPosition); } // Initialize if (!_initialized && m_GridPosition != new Vector2Int(int.MaxValue, int.MaxValue)) { Initialize(new Vector3Int(m_GridPosition.x, m_GridPosition.y, 0)); } }
public Quaternion OrientationToRotation(Vector2Int initialPosition, Orientations orientation) { var targetPosition = initialPosition + GetRelativeNeighborPositionFromOrientation(orientation.ToString(), (initialPosition.y & 1) == 1); return(PositionToRotation(initialPosition, targetPosition)); }