Documentation ¶
Index ¶
- Constants
- type AttackBase
- type AttackBehavier
- type Enemy
- type Entity
- func (e *Entity) Destroy()
- func (e *Entity) GetInfo() *Character
- func (e *Entity) GetTransform() *TransForm
- func (e *Entity) Harm(blood float32)
- func (e *Entity) Hit(damage int32)
- func (e *Entity) Init(gm *GameManager, room *Room, entityInfo *Character)
- func (e *Entity) Move(in *Input)
- func (e *Entity) PhysicUpdate()
- func (e *Entity) Run()
- func (e *Entity) Tick()
- type GameManager
- func (gm *GameManager) Calibrate(f *CallFuncInfo)
- func (gm *GameManager) Call(f *CallFuncInfo)
- func (gm *GameManager) CreateEntity(room *Room, entityInfo *Character, entityType string) IEntity
- func (gm *GameManager) CreateNewRoom(f *CallFuncInfo)
- func (gm *GameManager) CreatePlayer(room *Room, entityType string, userInfo *UserInfo) IEntity
- func (gm *GameManager) DestroyEntity(entityId int64)
- func (gm *GameManager) EnterRoom(f *CallFuncInfo)
- func (gm *GameManager) Entity(f *CallFuncInfo)
- func (gm *GameManager) ErrorHandle(err *Error)
- func (gm *GameManager) GetAllRoomInfo(f *CallFuncInfo)
- func (gm *GameManager) GetLoginData(f *CallFuncInfo)
- func (gm *GameManager) GetRoomStatus(f *CallFuncInfo)
- func (gm *GameManager) Init(rpc *service.Rpc)
- func (gm *GameManager) LeaveRoom(f *CallFuncInfo)
- func (gm *GameManager) ReadyRoom(f *CallFuncInfo)
- func (gm *GameManager) RegistEnitity(EntityTypeName string, iEntity IEntity)
- func (gm *GameManager) RegistRoom(roomTypeName string, iRoom IRoom)
- func (gm *GameManager) Run()
- func (gm *GameManager) SyncPos(input *Input)
- func (gm *GameManager) UserDisconnect(f *CallFuncInfo)
- type IEntity
- type IGameBehavier
- type IRoom
- type Player
- type Room
- func (r *Room) CreateEnemies()
- func (r *Room) CreateEnemy()
- func (r *Room) CreateShell(iEntity IEntity, entityInfo *Character, p *Vector3, q *Quaternion)
- func (r *Room) Destroy()
- func (r *Room) DestroyEntity(id int64)
- func (r *Room) EnterRoom(userId int64) bool
- func (r *Room) GetAllTransform()
- func (r *Room) GetInfo() *RoomInfo
- func (r *Room) GetUserInRoom() (ids []int64)
- func (r *Room) Init(gm *GameManager, roomInfo *RoomInfo)
- func (r *Room) LeaveRoom(userId int64) int64
- func (r *Room) PhysicUpdate()
- func (r *Room) Ready(userId int64) bool
- func (r *Room) Run()
- func (r *Room) SendFuncToAll(f *CallFuncInfo)
- func (r *Room) Tick()
- func (r *Room) UserDisconnect(userId int64)
- func (r *Room) UserReconnect(userId int64)
- type Shell
- type ShootBehavier
- type Treasure
Constants ¶
View Source
const ( FRAME_INTERVAL = 60 * time.Millisecond PHYSIC_UPDATE_INTERVAL = 10 * time.Millisecond )
View Source
const (
ExplosionRadius = 5.0
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttackBase ¶
type AttackBase struct { AutoAttackable bool CoolDownLeftTime int32 MaxValue float64 MaxCombo int32 }
func (*AttackBase) Attack ¶
func (atk *AttackBase) Attack(FromPos Position, Value float64)
func (*AttackBase) AutoAttack ¶
func (atk *AttackBase) AutoAttack(targetId int64)
type AttackBehavier ¶
type Enemy ¶
func (*Enemy) FindTargetAndAttack ¶
func (*Enemy) PhysicUpdate ¶
func (e *Enemy) PhysicUpdate()
type Entity ¶
type Entity struct { sync.RWMutex EntityInfo *Character TypeName string Health float32 Alive bool I IEntity GM *GameManager Room *Room World *physic.World Obj *physic.Obj Skill map[string]AttackBehavier }
func (*Entity) GetTransform ¶
func (e *Entity) GetTransform() *TransForm
func (*Entity) Init ¶
func (e *Entity) Init(gm *GameManager, room *Room, entityInfo *Character)
func (*Entity) PhysicUpdate ¶
func (e *Entity) PhysicUpdate()
type GameManager ¶
type GameManager struct { ////basic information Uuid int64 ReflectFunc sync.Map TypeMapRoom map[string]reflect.Type IdMapRoom map[int64]IRoom TypeMapEntity map[string]reflect.Type IdMapEntity map[int64]IEntity UserIdMapEntityId map[int64]int64 UserIdMapRoomId sync.Map ////rpc channel SendFuncToClient map[int64](chan *CallFuncInfo) RecvFuncFromClient chan *CallFuncInfo PosToClient map[int64](chan *Position) InputFromClient chan *Input ErrToClient map[int64](chan *Error) ErrFromClient chan *Error // contains filtered or unexported fields }
func (*GameManager) Calibrate ¶
func (gm *GameManager) Calibrate(f *CallFuncInfo)
func (*GameManager) Call ¶
func (gm *GameManager) Call(f *CallFuncInfo)
func (*GameManager) CreateEntity ¶
func (gm *GameManager) CreateEntity(room *Room, entityInfo *Character, entityType string) IEntity
func (*GameManager) CreateNewRoom ¶
func (gm *GameManager) CreateNewRoom(f *CallFuncInfo)
func (*GameManager) CreatePlayer ¶
func (gm *GameManager) CreatePlayer(room *Room, entityType string, userInfo *UserInfo) IEntity
func (*GameManager) DestroyEntity ¶
func (gm *GameManager) DestroyEntity(entityId int64)
func (*GameManager) EnterRoom ¶
func (gm *GameManager) EnterRoom(f *CallFuncInfo)
func (*GameManager) Entity ¶
func (gm *GameManager) Entity(f *CallFuncInfo)
func (*GameManager) ErrorHandle ¶
func (gm *GameManager) ErrorHandle(err *Error)
func (*GameManager) GetAllRoomInfo ¶
func (gm *GameManager) GetAllRoomInfo(f *CallFuncInfo)
func (*GameManager) GetLoginData ¶
func (gm *GameManager) GetLoginData(f *CallFuncInfo)
func (*GameManager) GetRoomStatus ¶
func (gm *GameManager) GetRoomStatus(f *CallFuncInfo)
Not Done Yet
func (*GameManager) Init ¶
func (gm *GameManager) Init(rpc *service.Rpc)
func (*GameManager) LeaveRoom ¶
func (gm *GameManager) LeaveRoom(f *CallFuncInfo)
func (*GameManager) ReadyRoom ¶
func (gm *GameManager) ReadyRoom(f *CallFuncInfo)
func (*GameManager) RegistEnitity ¶
func (gm *GameManager) RegistEnitity(EntityTypeName string, iEntity IEntity)
func (*GameManager) RegistRoom ¶
func (gm *GameManager) RegistRoom(roomTypeName string, iRoom IRoom)
func (*GameManager) Run ¶
func (gm *GameManager) Run()
func (*GameManager) SyncPos ¶
func (gm *GameManager) SyncPos(input *Input)
func (*GameManager) UserDisconnect ¶
func (gm *GameManager) UserDisconnect(f *CallFuncInfo)
type IEntity ¶
type IEntity interface { IGameBehavier Hit(int32) GetInfo() *Character Init(*GameManager, *Room, *Character) Move(in *Input) GetTransform() *TransForm Harm(blood float32) }
type IGameBehavier ¶
type IGameBehavier interface { Tick() PhysicUpdate() Destroy() Run() }
type Player ¶
type Player struct {
Entity
}
func (*Player) Init ¶
func (e *Player) Init(gm *GameManager, room *Room, entityInfo *Character)
func (*Player) PhysicUpdate ¶
func (e *Player) PhysicUpdate()
type Room ¶
type Room struct { RoomInfo *RoomInfo sync.RWMutex EntityInRoom map[int64]IEntity GM *GameManager EntityOfUser map[int64]int64 //map[id]id World *physic.World PosChans map[int64](chan *Position) FuncChans map[int64](chan *CallFuncInfo) // contains filtered or unexported fields }
func (*Room) CreateEnemies ¶
func (r *Room) CreateEnemies()
func (*Room) CreateEnemy ¶
func (r *Room) CreateEnemy()
func (*Room) CreateShell ¶
TODO : These two function should be combined
func (*Room) DestroyEntity ¶
func (*Room) GetAllTransform ¶
func (r *Room) GetAllTransform()
func (*Room) GetUserInRoom ¶
func (*Room) Init ¶
func (r *Room) Init(gm *GameManager, roomInfo *RoomInfo)
func (*Room) PhysicUpdate ¶
func (r *Room) PhysicUpdate()
func (*Room) SendFuncToAll ¶
func (r *Room) SendFuncToAll(f *CallFuncInfo)
func (*Room) UserDisconnect ¶
func (*Room) UserReconnect ¶
type Shell ¶
func (*Shell) PhysicUpdate ¶
func (s *Shell) PhysicUpdate()
type ShootBehavier ¶
type ShootBehavier struct {
AttackBase
}
func NewShootBehavier ¶
func NewShootBehavier(autoAttackable bool, coolDownLeftTime int32, maxValue float64, maxCombo int32) *ShootBehavier
func (*ShootBehavier) Attack ¶
func (atk *ShootBehavier) Attack(FromPos Position, Value float64)
func (*ShootBehavier) AutoAttack ¶
func (atk *ShootBehavier) AutoAttack(targetId int64)
type Treasure ¶
type Treasure struct { Entity // contains filtered or unexported fields }
func (*Treasure) BeAttracted ¶
func (t *Treasure) BeAttracted()
func (*Treasure) BeCollected ¶
func (t *Treasure) BeCollected()
Click to show internal directories.
Click to hide internal directories.