简体   繁体   English

动态行为所需的结构

[英]Structure needed for dynamic behaviour

I am using Unity to build a visualisation of a serious game. 我正在使用Unity构建严肃游戏的可视化。 I am using C# programming language. 我正在使用C#编程语言。

My problem is that I receive data from a JSON and I parse it and I end up with a list of different 'words' saying for example: 我的问题是,我从JSON接收数据并进行解析,最终得到了一系列不同的“单词”,例如:

Player - walks to - Carl 玩家-步行至-卡尔

or 要么

Carl - says ... to - Player 卡尔-对球员说...

(note that this list is not limited to 3 words, it can be a longer statement, and it doew not HAVE to contain Player or NPC or whatever, it's very flexible) (请注意,此列表不限于3个字,它可以是更长的语句,并且不必包含Player或NPC或其他内容,这非常灵活)

I have a list containing all the possible actions & NPC names , so Carl in this example, would be in my NPC list of names so I can recognize him as an NPC. 我有一个包含所有可能的动作和NPC名称的列表,因此本示例中的Carl将出现在我的NPC名称列表中,这样我就可以将他识别为NPC。 Same goes for the 'actions' to perform. 要执行的“动作”也一样。

However now i need to map a lot of these different actions to visualisations in the game itself. 但是,现在我需要将许多这些不同的动作映射到游戏本身的可视化中。

Thus I think I need a way to store: 因此,我认为我需要一种存储方式:

1) the order of the words 1)单词的顺序

2) the 'meaning' (NPC or Player or Action) 2)“含义”(NPC或播放器或动作)

3) the word itself 3)单词本身

Can anyone point me in the direction of a very efficient structure or design pattern to use to make this work? 谁能指出我要采用的非常有效的结构或设计模式的方向吗? Thanks 谢谢

Sounds like you have your own Domain Specific Language (DSL). 听起来您有自己的域特定语言 (DSL)。

Maybe one of these may help you get started: 也许其中之一可以帮助您入门:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM