public void MoveDirection(int dir)
    {
        switch (dir)
        {
        case 0:
            currentLocation = currentLocation.locationNorth;
            break;

        case 1:
            currentLocation = currentLocation.locationSouth;
            break;

        case 2:
            currentLocation = currentLocation.locationEast;
            break;

        case 3:
            currentLocation = currentLocation.locationWest;
            break;

        default:
            break;
        }

        UpdateLocation();
    }
Ejemplo n.º 2
0
    // Function to determine movement
    public void MoveDirection(int direction)
    {
        switch (direction)
        {
        case 0:                                                     //for case 0
            currentLocation = currentLocation.northLocation;        //move to the north location
            break;                                                  //get out of function

        case 1:                                                     //for case 1
            currentLocation = currentLocation.southLocation;        //move to the south location
            break;                                                  //get out of function

        case 2:                                                     //for case 2
            currentLocation = currentLocation.eastLocation;         //move to the east location
            break;                                                  //get out of function

        case 3:                                                     //for case 3
            currentLocation = currentLocation.westLocation;         //move to the west location
            break;                                                  //get out of function
        }
        Updatelocation();                                           //run UpdateLocation function
    }