1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-06 18:27:20 -05:00
OpenDiablo2/d2core/NPC.go

29 lines
854 B
Go
Raw Normal View History

2019-11-10 08:51:02 -05:00
package d2core
2019-11-10 03:36:53 -05:00
import (
"github.com/OpenDiablo2/OpenDiablo2/d2common"
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2interface"
"github.com/OpenDiablo2/OpenDiablo2/d2data"
2019-11-10 08:51:02 -05:00
"github.com/OpenDiablo2/OpenDiablo2/d2render"
2019-11-10 03:36:53 -05:00
"github.com/hajimehoshi/ebiten"
)
type NPC struct {
2019-11-10 08:51:02 -05:00
AnimatedEntity *d2render.AnimatedEntity
2019-11-10 03:36:53 -05:00
Paths []d2common.Path
}
func CreateNPC(object d2data.Object, fileProvider d2interface.FileProvider) *NPC {
result := &NPC{
2019-11-10 08:51:02 -05:00
AnimatedEntity: d2render.CreateAnimatedEntity(object, fileProvider, d2enum.Units),
2019-11-10 03:36:53 -05:00
Paths: object.Paths,
}
result.AnimatedEntity.SetMode(object.Lookup.Mode, object.Lookup.Class, 1, fileProvider)
return result
}
func (v *NPC) Render(target *ebiten.Image, offsetX, offsetY int) {
v.AnimatedEntity.Render(target, offsetX, offsetY)
}