Beispiel #1
0
    bool Move(Vector2Int direction)
    {
        if (direction.x > 0)
        {
            lastMoveLeftRight = LRDirection.Right;
        }
        else if (direction.x < 0)
        {
            lastMoveLeftRight = LRDirection.Left;
        }

        RobotBehavior otherRobot = _gameManager.isCellBlockedByRobot(cellIndex + direction);

        if (otherRobot && otherRobot != this)
        {
            SetBroken();
            otherRobot.isBroken = true;
            return(false);
        }

        previousCellIndex = cellIndex;
        cellIndex        += direction;
        lastMoveTime      = Time.time;

        return(true);
    }
Beispiel #2
0
 public void ResetSimulation()
 {
     SetRenderPosition(_gameManager.GetTileCenterPosition(_spawnIndex));
     cellIndex         = _spawnIndex;
     previousCellIndex = _spawnIndex;
     lastMoveTime      = -1;
     SetCarryEmpty();
     _commandIndex = -1;
     isBroken      = false;
     isFinished    = false;
     hasDelivered  = false;
     Move(Vector2Int.zero);
     lastMoveLeftRight = LRDirection.Right;
 }