void EnqueueAction(ActObject aobj) { Type type = Type.GetType(aobj.className); object obj = FindObjectOfType(type); MethodInfo method = type.GetMethod(aobj.methodName); actQueue.Enqueue(() => method.Invoke(obj, null)); }
public static bool CheckProperties(ActObject act) { CheckResult result = new CheckResult(); result.SetNextCheck("Scene"); Check(result, act.properties); result.SetNextCheck("Scene.Code"); Check(result, act.code.properties); //... return true; }
//调用后直接在指定位置生成指定id的Animal public static GameObject CreateActObject(int i, Vector3 p) { //Debug.Log (i); ActItem tmp = AllActItems[i]; //Debug.Log (tmp.obj); GameObject g = (GameObject)Instantiate(tmp.obj, tmp.obj.transform.localPosition + p, tmp.obj.transform.localRotation); g.name = tmp.name; ActObject actO = g.GetComponent <ActObject>(); actO.life = tmp.life; actO.isnomaldie = tmp.isnomaldie; actO.isdiedrop = tmp.isdiedrop; actO.carryItem = tmp.carryItem; actO.carryIll = tmp.carryIll; actO.attedtype = tmp.attedtype; return(g); }
public void AddObject(string className, string questName) { for (int i = 0; i < actobject.Count; i++) { if (actobject[i].className == className && actobject[i].methodName == questName) { return; } } ActObject aobj = new ActObject(); aobj.className = className; aobj.methodName = questName; actobject.Add(aobj); JsonData questData = JsonMapper.ToJson(actobject); File.WriteAllText(Application.persistentDataPath + "/actqueue.json", questData.ToString()); ResetQueue(); }
public static Scene CreateScene(ActObject act) { return null; }