controller keymap fix, inventory skeleton
This commit is contained in:
15
domain/inventory.go
Normal file
15
domain/inventory.go
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package domain
|
||||||
|
|
||||||
|
import "game/konstructor/entity"
|
||||||
|
|
||||||
|
func (d *Domain) AddToInventory(item *entity.Item) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Domain) RemoveFromInventory(item *entity.Item) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Domain) UseInventoryItem(item *entity.Item) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
15
konstructor/engine/engine.inventory.go
Normal file
15
konstructor/engine/engine.inventory.go
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package engine
|
||||||
|
|
||||||
|
import "game/konstructor/entity"
|
||||||
|
|
||||||
|
func (e *Engine) AddToInventory(item *entity.Item) {
|
||||||
|
e.Domain.AddToInventory(item)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Engine) RemoveFromInventory(item *entity.Item) {
|
||||||
|
e.Domain.RemoveFromInventory(item)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *Engine) UseInventoryItem(item *entity.Item) {
|
||||||
|
e.Domain.UseInventoryItem(item)
|
||||||
|
}
|
||||||
@@ -7,4 +7,7 @@ type DomainInterface interface {
|
|||||||
GetDialog(name string) Dialog
|
GetDialog(name string) Dialog
|
||||||
SetDialog(name string, menu Dialog)
|
SetDialog(name string, menu Dialog)
|
||||||
GetLevel(index int) Level
|
GetLevel(index int) Level
|
||||||
|
AddToInventory(item *Item) bool
|
||||||
|
RemoveFromInventory(item *Item) bool
|
||||||
|
UseInventoryItem(item *Item) bool
|
||||||
}
|
}
|
||||||
|
|||||||
12
konstructor/entity/entity.item.go
Normal file
12
konstructor/entity/entity.item.go
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
type ItemType struct {
|
||||||
|
ID string
|
||||||
|
RenderOptions RenderOptions
|
||||||
|
}
|
||||||
|
|
||||||
|
type Item struct {
|
||||||
|
ID string
|
||||||
|
Type ItemType
|
||||||
|
Position Position
|
||||||
|
}
|
||||||
12
konstructor/entity/entity.npc.go
Normal file
12
konstructor/entity/entity.npc.go
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
type NPCType struct {
|
||||||
|
ID string
|
||||||
|
RenderOptions RenderOptions
|
||||||
|
}
|
||||||
|
|
||||||
|
type NPC struct {
|
||||||
|
ID string
|
||||||
|
Type NPCType
|
||||||
|
Position Position
|
||||||
|
}
|
||||||
12
konstructor/entity/entity.object.go
Normal file
12
konstructor/entity/entity.object.go
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
type ObjectType struct {
|
||||||
|
ID string
|
||||||
|
RenderOptions RenderOptions
|
||||||
|
}
|
||||||
|
|
||||||
|
type Object struct {
|
||||||
|
ID string
|
||||||
|
Type ObjectType
|
||||||
|
Position Position
|
||||||
|
}
|
||||||
18
konstructor/entity/entity.player.go
Normal file
18
konstructor/entity/entity.player.go
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
type InventoryItem struct {
|
||||||
|
Item Item
|
||||||
|
Used bool
|
||||||
|
Active bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type Inventory struct {
|
||||||
|
Items []InventoryItem
|
||||||
|
}
|
||||||
|
|
||||||
|
type Player struct {
|
||||||
|
ID string
|
||||||
|
RenderOptions RenderOptions
|
||||||
|
Position Position
|
||||||
|
Inventory Inventory
|
||||||
|
}
|
||||||
@@ -7,48 +7,10 @@ type Position struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RenderOptions struct {
|
type RenderOptions struct {
|
||||||
Image string
|
Image string
|
||||||
Width int
|
Width int
|
||||||
Height int
|
Height int
|
||||||
}
|
Visible bool
|
||||||
|
|
||||||
type ObjectType struct {
|
|
||||||
ID string
|
|
||||||
RenderOptions RenderOptions
|
|
||||||
}
|
|
||||||
|
|
||||||
type Object struct {
|
|
||||||
ID string
|
|
||||||
Type ObjectType
|
|
||||||
Position Position
|
|
||||||
}
|
|
||||||
|
|
||||||
type NPCType struct {
|
|
||||||
ID string
|
|
||||||
RenderOptions RenderOptions
|
|
||||||
}
|
|
||||||
|
|
||||||
type NPC struct {
|
|
||||||
ID string
|
|
||||||
Type NPCType
|
|
||||||
Position Position
|
|
||||||
}
|
|
||||||
|
|
||||||
type Player struct {
|
|
||||||
ID string
|
|
||||||
RenderOptions RenderOptions
|
|
||||||
Position Position
|
|
||||||
}
|
|
||||||
|
|
||||||
type ItemType struct {
|
|
||||||
ID string
|
|
||||||
RenderOptions RenderOptions
|
|
||||||
}
|
|
||||||
|
|
||||||
type Item struct {
|
|
||||||
ID string
|
|
||||||
Type ItemType
|
|
||||||
Position Position
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Playground struct {
|
type Playground struct {
|
||||||
|
|||||||
@@ -21,5 +21,5 @@ type ScreenSettings struct {
|
|||||||
type Settings struct {
|
type Settings struct {
|
||||||
Name string
|
Name string
|
||||||
Screen *ScreenSettings
|
Screen *ScreenSettings
|
||||||
KeyMap *KeyMap
|
KeyMap KeyMap
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user