60 lines
1.5 KiB
Go
60 lines
1.5 KiB
Go
package parkour
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/sys/timewheel"
|
|
"go_dreamfactory/pb"
|
|
"sync"
|
|
"time"
|
|
)
|
|
|
|
type Recommend struct {
|
|
parkour *pb.DBParkour
|
|
user *pb.DBUser
|
|
member *pb.DBRaceMember
|
|
}
|
|
|
|
///捕羊大赛对象
|
|
type RaceItem struct {
|
|
Id string //战斗id
|
|
lock sync.Mutex //战斗锁 防止计时器和消息同时操作对象
|
|
RedMember []*pb.DBRaceMember //红方成员
|
|
RedScore int32 //红方分值
|
|
RedEnergy int32 //红方能量
|
|
BuleMember []*pb.DBRaceMember //蓝方成员
|
|
Session map[string]comm.IUserSession
|
|
BuleScore int32 //蓝方分值
|
|
BuleEnergy int32 //蓝方能量
|
|
overtimer *timewheel.Task //准备倒计时定时器
|
|
}
|
|
|
|
type AILevel int32
|
|
|
|
const (
|
|
AILevelS AILevel = iota
|
|
AILevelSS
|
|
AILevelSSS
|
|
)
|
|
|
|
type AIHandleType int32
|
|
|
|
const (
|
|
AIHandle_Null AIHandleType = iota //空操作
|
|
AIHandle_Avoid0 //躲避障碍 失败
|
|
AIHandle_Avoid1 //躲避障碍 成功
|
|
AIHandle_Avoid2 //躲避障碍 完美
|
|
AIHandle_Shots0 //射门 失败
|
|
AIHandle_Shots1 //射门 成功
|
|
)
|
|
|
|
//捕羊大赛AI对象
|
|
type AI struct {
|
|
BattleId string //战场id
|
|
UId string //用户id
|
|
AILevel AILevel //AI级别
|
|
Handle []AIHandleType //操作列表
|
|
CurrIndex int32 //当前执行下标
|
|
LastTime time.Time //上一次操作时间
|
|
Interval time.Duration //最小操作时间
|
|
}
|