private void FixedUpdate() { if (_enemyController.IsFreezed) { return; } var roundedPos = transform.position; roundedPos.x = (float)System.Math.Round(roundedPos.x, 2); roundedPos.y = (float)System.Math.Round(roundedPos.y, 2); roundedPos.x = Mathf.Floor(Mathf.Abs(roundedPos.x) * 10); roundedPos.y = Mathf.Floor(Mathf.Abs(roundedPos.y) * 10); var posX = roundedPos.x / 10 % Consts.SHARE; var posY = roundedPos.y / 10 % Consts.SHARE; if (posX == 0 && posY == 0 && _random.Next(0, 32) == 0) { if (BehaviourMove()) { return; } } if (!_collider.CheckColliderBeside(_enemyController.DirectionMove)) { _directionRotate = null; return; } // Continue rotate if (_directionRotate.HasValue) { if (_random.Next(0, 16) == 0) { Rotate(_directionRotate); } return; } if ((posX == 0 || posY == 0) && _random.Next(0, 24) == 0) { Turning(); } else if (_random.Next(0, 16) == 0) { Rotate(null); } }