C# Класс MBC.Shared.Entities.Ship

Наследование: System.Entity
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
GetAllLocations ( ) : IEnumerable

Описание методов

ConflictsWith() публичный Метод

Checks if another Ship occupies any cells that this Ship occupies.
public ConflictsWith ( Ship otherShip ) : bool
otherShip Ship The to check for confliction with.
Результат bool

Hit() публичный Метод

Hits the ship at the coordinates.
public Hit ( Coordinates coords ) : void
coords Coordinates
Результат void

IsAt() публичный Метод

Indicates whether or not a location is an occupied cell.
public IsAt ( Coordinates location ) : bool
location Coordinates The of the location to check.
Результат bool

IsHitAt() публичный Метод

Checks whether the hit flag has been set at the specific ship location index.
public IsHitAt ( Coordinates location ) : bool
location Coordinates
Результат bool

IsSunk() публичный Метод

public IsSunk ( ) : bool
Результат bool

Place() публичный Метод

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.
Результат void

Reset() публичный Метод

Resets the ship back to its initialized state.
public Reset ( ) : void
Результат void

Ship() публичный Метод

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.
Результат System

Ship() публичный Метод

Copies an existing Ship.
public Ship ( Ship shipCopy ) : System
shipCopy Ship
Результат System

Sink() публичный Метод

Sinks the ship
public Sink ( ) : void
Результат void

ToString() публичный Метод

Provides a string representation.
public ToString ( ) : string
Результат string