mirror of
https://github.com/crazybber/go-pattern-examples.git
synced 2024-11-24 20:56:03 +03:00
update visitor pattern
This commit is contained in:
parent
7787fba31b
commit
16d5b8d8d4
@ -2,8 +2,8 @@ package visitor
|
||||
|
||||
import "fmt"
|
||||
|
||||
//IGameContext 游戏上下文
|
||||
type IGameContext interface {
|
||||
//IGameObject 游戏上下文对象
|
||||
type IGameObject interface {
|
||||
Accept(IGameVisitor)
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ package visitor
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestVisitor(t *testing.T) {
|
||||
func TestSingleVisitor(t *testing.T) {
|
||||
|
||||
//汽油提供给,制衣工厂
|
||||
g := gas{density: 100}
|
||||
@ -32,7 +32,7 @@ func TestGameVisitorsList(t *testing.T) {
|
||||
env := SystemEnv{"made by china", "v1.2.11"}
|
||||
|
||||
//游戏对象
|
||||
gameObjects := []IGameContext{pA, npc, env, pB}
|
||||
gameObjects := []IGameObject{pA, npc, env, pB}
|
||||
|
||||
for _, v := range gameObjects {
|
||||
v.Accept(retriveSetting)
|
||||
|
Loading…
Reference in New Issue
Block a user