private IEnumerator MoveBackward() { //проверка на взлёт if (BoardModel.CheckForEmpty(_transform.position + Vector3.up)) { yield return(StartCoroutine(MakeStepUp())); } //проверка на шаг влево else if (BoardModel.CheckForEmptyOrPlatform(_transform.position + Vector3.left)) { yield return(StartCoroutine(MakeStepLeft())); } //проверка на шаг по диагонали else if (BoardModel.CheckForEmpty(_transform.position + Vector3.down) && BoardModel.CheckForEmptyOrPlatform(_transform.position + new Vector3(-1, -1, 0))) { yield return(StartCoroutine(MakeStepLeftDown())); } else if (BoardModel.CheckForPlatform(_transform.position)) { _robot.OnReturnAction(); } else { _robot.OnStoppageAction(); } }
private IEnumerator MoveBackward() { //проверка на падение if (BoardModel.CheckForEmpty(_transform.position + Vector3.down)) { yield return(StartCoroutine(MakeStepDown())); } //проверка на прыжок else if (BoardModel.CheckForEmpty(_transform.position + Vector3.left) && BoardModel.CheckForEmptyOrPlatform(_transform.position + 2 * Vector3.left) && BoardModel.CheckForEmpty(_transform.position + new Vector3(-1, -1, 0))) { yield return(StartCoroutine(MakeLeftJump())); } //проверка на шаг влево else if (BoardModel.CheckForEmptyOrPlatform(_transform.position + Vector3.left)) { yield return(StartCoroutine(MakeStepLeft())); } else if (BoardModel.CheckForPlatform(_transform.position)) { _robot.OnReturnAction(); } else { _robot.OnStoppageAction(); } }