instruction

package
v0.0.0-...-c0736c2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

工作流:用户操作 / AI 决策 -> 指令 —> 指令集 -> 战舰/建筑行为

Index

Constants

View Source
const (
	NameEnableWeapon  = "EnableWeapon"
	NameDisableWeapon = "DisableWeapon"
	NameShipMove      = "ShipMove"
	NameShipMovePath  = "ShipMovePath"
	NameShipSummon    = "ShipSummon"
)

Variables

This section is empty.

Functions

func GenInstrUid

func GenInstrUid(instrName, objUid string) string

GenInstrUid 生成指令 UID(不需要实际初始化指令)

Types

type DisableWeapon

type DisableWeapon struct {
	// contains filtered or unexported fields
}

DisableWeapon 禁用武器

func NewDisableWeapon

func NewDisableWeapon(shipUid string, weaponType obj.WeaponType) *DisableWeapon

NewDisableWeapon ...

func (*DisableWeapon) Exec

func (i *DisableWeapon) Exec(s *state.MissionState) error

func (*DisableWeapon) Executed

func (i *DisableWeapon) Executed() bool

func (*DisableWeapon) String

func (i *DisableWeapon) String() string

func (*DisableWeapon) Uid

func (i *DisableWeapon) Uid() string

type EnableWeapon

type EnableWeapon struct {
	// contains filtered or unexported fields
}

EnableWeapon 启用武器

func NewEnableWeapon

func NewEnableWeapon(shipUid string, weaponType obj.WeaponType) *EnableWeapon

NewEnableWeapon ...

func (*EnableWeapon) Exec

func (i *EnableWeapon) Exec(s *state.MissionState) error

func (*EnableWeapon) Executed

func (i *EnableWeapon) Executed() bool

func (*EnableWeapon) String

func (i *EnableWeapon) String() string

func (*EnableWeapon) Uid

func (i *EnableWeapon) Uid() string

type InstrStatus

type InstrStatus int

InstrStatus 指令状态

const (
	// Pending 待执行
	Pending InstrStatus = iota
	// Preparing 准备中
	Preparing
	// Ready 已就绪
	Ready
	// Executing 执行中
	Executing
	// Executed 执行完成
	Executed
)

type Instruction

type Instruction interface {
	// Exec 指令执行
	Exec(*state.MissionState) error
	// Executed 是否已执行完成
	Executed() bool
	// Uid 获取指令 UID
	Uid() string
	// String 指令描述
	String() string
}

Instruction 指令

type ShipMove

type ShipMove struct {
	// contains filtered or unexported fields
}

ShipMove 移动

func NewShipMove

func NewShipMove(shipUid string, targetPos obj.MapPos) *ShipMove

NewShipMove ...

func (*ShipMove) Exec

func (i *ShipMove) Exec(s *state.MissionState) error

func (*ShipMove) Executed

func (i *ShipMove) Executed() bool

func (*ShipMove) String

func (i *ShipMove) String() string

func (*ShipMove) Uid

func (i *ShipMove) Uid() string

type ShipMovePath

type ShipMovePath struct {
	// contains filtered or unexported fields
}

ShipMovePath 按照指定路径移动

func NewShipMovePath

func NewShipMovePath(shipUid string, curPos, targetPos obj.MapPos) *ShipMovePath

NewShipMovePath ...

func (*ShipMovePath) Exec

func (i *ShipMovePath) Exec(s *state.MissionState) error

func (*ShipMovePath) Executed

func (i *ShipMovePath) Executed() bool

func (*ShipMovePath) String

func (i *ShipMovePath) String() string

func (*ShipMovePath) Uid

func (i *ShipMovePath) Uid() string

type ShipSummon

type ShipSummon struct {
	// contains filtered or unexported fields
}

ShipSummon 召唤增援(仅 AI 使用)

func NewShipSummon

func NewShipSummon(reinforcePointUid string, shipName string) *ShipSummon

NewShipSummon ...

func (*ShipSummon) Exec

func (i *ShipSummon) Exec(s *state.MissionState) error

func (*ShipSummon) Executed

func (i *ShipSummon) Executed() bool

func (*ShipSummon) String

func (i *ShipSummon) String() string

func (*ShipSummon) Uid

func (i *ShipSummon) Uid() string

Jump to

Keyboard shortcuts

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