update visitor pattern

This commit is contained in:
Edward 2020-05-04 23:05:00 +08:00
parent 7787fba31b
commit 16d5b8d8d4
2 changed files with 4 additions and 4 deletions

View File

@ -2,8 +2,8 @@ package visitor
import "fmt"
//IGameContext 游戏上下文
type IGameContext interface {
//IGameObject 游戏上下文对象
type IGameObject interface {
Accept(IGameVisitor)
}

View File

@ -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)