本文整理匯總了Golang中stabbey/interfaces.Entity.GetName方法的典型用法代碼示例。如果您正苦於以下問題:Golang Entity.GetName方法的具體用法?Golang Entity.GetName怎麽用?Golang Entity.GetName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類stabbey/interfaces.Entity
的用法示例。
在下文中一共展示了Entity.GetName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: NewEntity
func NewEntity(e interfaces.Entity) *Entity {
se := &Entity{}
se.EntityId = e.GetEntityId()
se.Name = e.GetName()
se.Type = e.GetType()
se.Subtype = e.GetSubtype()
se.MaxArdour = e.GetMaxArdour()
se.Ardour = e.GetArdour()
se.BoardId, se.X, se.Y = e.GetPosition()
se.ActionQueue = e.GetStringActionQueue()
return se
}
示例2: SwapPositionWith
func (e *Entity) SwapPositionWith(other interfaces.Entity) {
if !e.IsTangible() || !other.IsTangible() {
log.Fatalf("Swap only makes sense for tangible entities. Got %v & %v",
e.GetName(), other.GetName())
}
/* It's crucial that two tagnible entities don't end up on same tile */
boardId, x, y := e.GetPosition()
boardId2, x2, y2 := other.GetPosition()
e.BoardId, e.X, e.Y = boardId2, x2, y2
/* Can work since both entities are technically in the same place */
other.SetPosition(boardId, x, y)
/* Manually trigger trodden functions since we didn't SetPosition */
for _, entity := range e.Game.GetEntitiesAtSpace(e.GetPosition()) {
entity.Trodden(e)
}
/* other's reposition function will be called by SetPosition */
e.RepositionFunction(boardId, x, y, boardId2, x2, y2)
}
示例3: act
/* Generic action handler for any entity */
func act(entity interfaces.Entity, action interfaces.Action) {
if err := action.Act(entity, GAME); err != nil {
log.Printf("%v: %v", entity.GetName(), err)
}
}