private void FaceDirectionalWall(DirectionWall wall) { switch (wall._Direction) { case DirectionWall.Direction.up: rotationDirection = new Vector3(0, 0, 0); break; case DirectionWall.Direction.right: rotationDirection = new Vector3(0, 90, 0); break; case DirectionWall.Direction.down: rotationDirection = new Vector3(0, 180, 0); break; case DirectionWall.Direction.left: rotationDirection = new Vector3(0, 270, 0); break; default: Debug.LogError("Direction not found!"); return; } _State = State.turning; }
private void BuildWall() { wall = poolTransferer.Aquire(_wallPrefab); wall.transform.parent = _wallParent.transform; wall.transform.localPosition = _wallParent.transform.localPosition; // wall.transform.localScale = _wallParent.transform.localScale; wall.transform.localEulerAngles = _wallParent.transform.localEulerAngles; DirectionWall directionWall = wall.GetComponent <DirectionWall>(); directionWall.BuildBetween(firstCoordinate, secondCoordinate); }
private void FaceWall(GameObject wall) { if (_State != State.moving) { return; } _nav.ResetPath(); _State = State.stop; DirectionWall directionWall = wall.GetComponentInParent <DirectionWall>(); if (directionWall != null) { FaceDirectionalWall(directionWall); } else { TurnInRandomDirection(); } }