【发布时间】:2017-12-12 02:42:12
【问题描述】:
我想创建一个动态条件语句。
class Condition
{
targetObject; //Class or Struct or anythings..
targetMemberVariable; //the Member in targetObject
conditionFilter;
//It depends on the type of targetMemberVariable.
//targetMemberVariable is Float type,
//then conditionFilter automatically becomes a Float type.
//No need to change it in "Inspector"
comparisonValue;
//This is based on the type of conditionFilter.
//If it is a float type, the "Inspector" takes a float as its value.
Public bool CheckCondition(object targetObject)
{
//It checks with the above information and returns a true value.
return true or false;
}
}
我想获取 Unity Editor 或 C# 库关键字。
目的是创造类似上面的东西。
- 游戏中的互动元素可能会发生变化。
- 可以扩展或添加游戏内元素。
- 我不想修改每个更改或扩展的条件语句。
例子
ex1 ex2 我记得在 C# 中或在执行期间添加类之后看到了用于动态编译的库。
我当然知道动态不是通用的。 我想做一些类似星际争霸银河编辑器的验证。
这是一个游戏示例
[Bleeding shot]
Give 10 damage to enemies.
If the enemy's Health is below 20, it adds 10 damage.
unit,health,amount,<=(below)
true-> adds 10 damage.
false -> none.
[Hooking]
If the enemy is enemy, it gives 5 damage and pulls to the front.
If the target is ally, pull to the front and reduce cooldown to 5 seconds.
unit,Tag,Enemy(enum),==
true-> 5 damage and pulls to the front.
false-> pull to the front and reduce cooldown to 5 seconds.
[Healing the Moon]
Heal the target by 10.
If the current time is night, heal 10 more.
GameTimer,DayNight(Enum),Night,==
true->heal 10 more.
【问题讨论】:
标签: c# unity3d dynamic conditional-statements