C# Class HelloWorld.Unit

代表一个玩家的单位
Inheritance: GameDataItem, IDisposable
显示文件 Open project: Ivony/HelloWorld Class Usage Examples

Public Methods

Method Description
Check ( System.DateTime now ) : void

例行检查状态

CreateUnit ( IGameDataService dataService, UnitDescriptor descriptor, System.Guid owner, Coordinate coordinate, System.Guid id, string name ) : Unit
Dispose ( ) : void
Equals ( object obj ) : bool

重写 Equals 方法比较两个单位对象的 GUID

GetActions ( ) : HelloWorld.ActionDescriptor[]

获取当前单位可以进行的行动

GetHashCode ( ) : int
GetInfo ( ) : object

获取用于输出给客户端的信息

GetPlayer ( ) : GamePlayer

单位所有者玩家对象

MobilityRequired ( HelloWorld.Place place ) : decimal

获取移动到指定位置所需要的移动力

Move ( Direction direction ) : bool

移动单位

Rename ( string name ) : void

更改单位名字

Unit ( ) : System

创建一个玩家单位对象

Protected Methods

Method Description
Initialize ( ) : void

初始化对象

RecoveryMobilityForIdle ( System.DateTime now ) : void

如果休息时间足够,则复原移动力

Method Details

Check() public method

例行检查状态
public Check ( System.DateTime now ) : void
now System.DateTime
return void

CreateUnit() public static method

public static CreateUnit ( IGameDataService dataService, UnitDescriptor descriptor, System.Guid owner, Coordinate coordinate, System.Guid id, string name ) : Unit
dataService IGameDataService
descriptor UnitDescriptor
owner System.Guid
coordinate Coordinate
id System.Guid
name string
return Unit

Dispose() public method

public Dispose ( ) : void
return void

Equals() public method

重写 Equals 方法比较两个单位对象的 GUID
public Equals ( object obj ) : bool
obj object
return bool

GetActions() public method

获取当前单位可以进行的行动
public GetActions ( ) : HelloWorld.ActionDescriptor[]
return HelloWorld.ActionDescriptor[]

GetHashCode() public method

public GetHashCode ( ) : int
return int

GetInfo() public method

获取用于输出给客户端的信息
public GetInfo ( ) : object
return object

GetPlayer() public method

单位所有者玩家对象
public GetPlayer ( ) : GamePlayer
return GamePlayer

Initialize() protected method

初始化对象
protected Initialize ( ) : void
return void

MobilityRequired() public method

获取移动到指定位置所需要的移动力
public MobilityRequired ( HelloWorld.Place place ) : decimal
place HelloWorld.Place 抵达位置
return decimal

Move() public method

移动单位
public Move ( Direction direction ) : bool
direction Direction 移动方向
return bool

RecoveryMobilityForIdle() protected method

如果休息时间足够,则复原移动力
protected RecoveryMobilityForIdle ( System.DateTime now ) : void
now System.DateTime
return void

Rename() public method

更改单位名字
public Rename ( string name ) : void
name string 新的名字
return void

Unit() public method

创建一个玩家单位对象
public Unit ( ) : System
return System