動的条件文を作成したいとします。Dynamic if Unityの任意のクラスの条件
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;
}
}
ユニティエディタまたはC#ライブラリのキーワードを取得します。
意図は、上記のようなものを作成することです。
- ゲーム内の対話要素が変更される可能性があります。
- ゲーム内の要素を展開または追加できます。
- 私は変更または拡張ごとに条件文を変更したくありません。
例
ex1 ex2 私はC#での動的コンパイル中または実行時にクラスを追加した後に使用するライブラリを見て覚えています。
もちろん、私は動的が普遍的ではないことを知っています。 私はStarCraft Galaxy Editorの検証のようなことをしたい。これは、一般的な作り。ここ
がゲームの一例である
[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.
私はこの情報を入手できますか? >>> 'SomeClass.GetPropertiesList' arrayListまたはメンバーに関する情報のanyList。 – angdroid
'SomeClass'についての詳細は?私はこの例のために作ったクラスです。それとも他のことを求めているのですか?私は理解しません。 –
例:クラスユニットには[int] Health、[int] Atk、[bool] isAttackがあります。 Code 'Unit.GetGetPropertiesList()'にあります。私はArrayでinformationsCollectionを取得できます。 – angdroid