C# Class MBC.Shared.Entities.Ship

Inheritance: System.Entity
Afficher le fichier Open project: aiclub/Mohawk_Battleship Class Usage Examples

Méthodes publiques

Méthode Description
ConflictsWith ( Ship otherShip ) : bool

Checks if another Ship occupies any cells that this Ship occupies.

Hit ( Coordinates coords ) : void

Hits the ship at the coordinates.

IsAt ( Coordinates location ) : bool

Indicates whether or not a location is an occupied cell.

IsHitAt ( Coordinates location ) : bool

Checks whether the hit flag has been set at the specific ship location index.

IsSunk ( ) : bool

Place ( Coordinates location, ShipOrientation orientation ) : void

Places this Ship with the location and orientation. Sets the state of being placed to true.

Reset ( ) : void

Resets the ship back to its initialized state.

Ship ( System.Entity parent, int length ) : System

Sets the length of the Ship to length. The length must be at least 1.

Ship ( Ship shipCopy ) : System

Copies an existing Ship.

Sink ( ) : void

Sinks the ship

ToString ( ) : string

Provides a string representation.

Private Methods

Méthode Description
GetAllLocations ( ) : IEnumerable

Method Details

ConflictsWith() public méthode

Checks if another Ship occupies any cells that this Ship occupies.
public ConflictsWith ( Ship otherShip ) : bool
otherShip Ship The to check for confliction with.
Résultat bool

Hit() public méthode

Hits the ship at the coordinates.
public Hit ( Coordinates coords ) : void
coords Coordinates
Résultat void

IsAt() public méthode

Indicates whether or not a location is an occupied cell.
public IsAt ( Coordinates location ) : bool
location Coordinates The of the location to check.
Résultat bool

IsHitAt() public méthode

Checks whether the hit flag has been set at the specific ship location index.
public IsHitAt ( Coordinates location ) : bool
location Coordinates
Résultat bool

IsSunk() public méthode

public IsSunk ( ) : bool
Résultat bool

Place() public méthode

Places this Ship with the location and orientation. Sets the state of being placed to true.
public Place ( Coordinates location, ShipOrientation orientation ) : void
location Coordinates The of the bottom-most/left-most part of /// the .
orientation ShipOrientation The to set.
Résultat void

Reset() public méthode

Resets the ship back to its initialized state.
public Reset ( ) : void
Résultat void

Ship() public méthode

Sets the length of the Ship to length. The length must be at least 1.
Thrown when the is less /// than 1.
public Ship ( System.Entity parent, int length ) : System
parent System.Entity
length int The number of cells the occupies.
Résultat System

Ship() public méthode

Copies an existing Ship.
public Ship ( Ship shipCopy ) : System
shipCopy Ship
Résultat System

Sink() public méthode

Sinks the ship
public Sink ( ) : void
Résultat void

ToString() public méthode

Provides a string representation.
public ToString ( ) : string
Résultat string