Пример #1
0
package entity

import (
	"log"
	"runtime/debug"

	"stabbey/interfaces"
	"stabbey/uidgenerator"
)

var UIDG = uidgenerator.New()

type Entity struct {
	EntityId, BoardId, X, Y, Ardour, MaxArdour int
	Game                                       interfaces.Game
	Name, Type, Subtype                        string
	Tangible, Dead                             bool
	DeathFunction                              func()
	TroddenFunction                            func(interfaces.Entity)
	RepositionFunction                         func(fromBId, fromX, fromY, toBId, toX, toY int)
	TurnFunction                               func(int) bool
	ActionQueue                                []interfaces.Action
}

func New(entid int, g interfaces.Game) *Entity {
	e := &Entity{}
	e.SetEntityId(entid)
	e.BoardId = 0
	e.X = -1
	e.Y = -1
	e.Game = g
Пример #2
0
package player

import (
	"strconv"
	"time"

	"stabbey/entity"
	"stabbey/interfaces"
	"stabbey/order"
	"stabbey/spectator"
	"stabbey/uidgenerator"
)

var uidg = uidgenerator.New()

type Player struct {
	*spectator.Spectator
	*entity.Entity
	PlayerId           int
	AvailableActions   []interfaces.Action
	PlayerLastTick     int
	PlayerLastTickTime time.Time
}

func New(g interfaces.Game) *Player {
	p := &Player{}

	/* Spectator stuff */
	p.Spectator = spectator.New()

	/* Player stuff */