behaviour_room

package
v0.0.0-...-aacbedc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsOutside

func IsOutside(instance gm.Object) bool

Types

type InstanceData

type InstanceData struct {
	IsDeleteWhenOutside bool
	// contains filtered or unexported fields
}

TODO: I don't feel convenince with this instance data model, because instance data is the data of instance that not have Room's behaviour.

The option that I think of is to put this data in Common as new field, or even in game as map[string]. I don't think the later will make the development easier, because there is no autocomplete that prevents typo, and we might need check isExist. Meanwhile the former will add bunch of other Behaviour instance data to Common that might not be used

The other option that I can think is with new behaviour called RoomInstance, then we can let this Room behaviour interact wirh RoomInstance behaviour. But I think this will be a little bit tedious, since I think every instance can be child of the Room.

If this case is true (every instance can be child of the Room), then it is a good idea to put this on the game package (as map[string]?), but again this is will prevent the ide for autocomplete. I think it's better to put in this instance data model for now.

func (*InstanceData) Parent

func (data *InstanceData) Parent() gm.Object

func (*InstanceData) Room

func (data *InstanceData) Room() *Room

type Room

type Room struct {
	gm.Instancer
	Position r2.Point
	Size     r2.Point
	// contains filtered or unexported fields
}

func (*Room) Data

func (bhvr *Room) Data() gm.BehavioursData

func (*Room) Draw

func (bhvr *Room) Draw(screen *ebiten.Image)

func (*Room) InitObject

func (bhvr *Room) InitObject(instance gm.Object, data InstanceData) gm.Object

InitObject register current instance to this room. It is also register to gm through gm.InitObject().

func (*Room) Instances

func (bhvr *Room) Instances() map[gm.Object]gm.Object

func (*Room) Pause

func (bhvr *Room) Pause()

func (*Room) PostInit

func (bhvr *Room) PostInit()

func (*Room) PreInit

func (bhvr *Room) PreInit()

func (*Room) Restart

func (bhvr *Room) Restart()

func (*Room) Resume

func (bhvr *Room) Resume()

type RoomsData

type RoomsData struct {
	gm.Instancer
	// contains filtered or unexported fields
}
var Data RoomsData

func (*RoomsData) Behaviour

func (data *RoomsData) Behaviour() gm.Behaviour

func (*RoomsData) ByInstance

func (data *RoomsData) ByInstance(instID int) *InstanceData

func (*RoomsData) DelInstance

func (data *RoomsData) DelInstance(instance gm.Object)

func (*RoomsData) PostUpdate

func (data *RoomsData) PostUpdate()

func (*RoomsData) PreUpdate

func (data *RoomsData) PreUpdate()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL