private SIMONObject CopyToObject() { SIMONObject newObject = new SIMONObject(); newObject.ObjectID = this.ObjectID; newObject.Properties = this.Properties; newObject.Actions = this.Actions; return newObject; }
public void SerializeObject(string filePath, SIMONObject sObject) { if (sObject == null) return; XmlSerializer serializer = new XmlSerializer(typeof(SIMONObject)); string fullPath = Directory.GetCurrentDirectory() + SIMONConstants.API_DEFINITION_PATH + filePath; string dirPath = Path.GetDirectoryName(fullPath); if (!Directory.Exists(dirPath)) Directory.CreateDirectory(dirPath); FileStream fStream = new FileStream(fullPath, FileMode.Create); StreamWriter sWriter = new StreamWriter(fStream, System.Text.Encoding.UTF8); if (fStream.CanWrite) serializer.Serialize(sWriter, sObject); fStream.Close(); }
IEnumerator MoveSimulationScene() { Sound_Btn_Click.GetComponent<AudioSource> ().Play (); yield return new WaitForSeconds(0.7f); if(SceneManager.SceneMode == 1) SceneManager.SM.changeAndMoveScene(SceneState.scene_setting_property); else if(SceneManager.SceneMode == 2) SceneManager.SM.changeAndMoveScene(SceneState.scene_play_simulation); else if(SceneManager.SceneMode == 3) { SIMONObject sObject; SIMONObject sObjectB; for(int i = 1; i < 8 ; i++) { sObject = new SIMONObject (); sObjectB = new SIMONObject(); sObject.ObjectID = "Monster_A_"+i.ToString(); GameTimeManager_Compare.GroupA.Add (sObject.ObjectID, sObject); sObjectB.ObjectID = "Monster_B_"+i.ToString(); GameTimeManager_Compare.GroupB.Add (sObject.ObjectID, sObjectB); } for (int i = 0; i< GameTimeManager_Compare.GroupB.Count; i++) { if(SceneManager.SimulationType == 1) { ((SIMONObject)GameTimeManager_Compare.GroupB.ValueOfIndex (i)).LoadObjectDefinition("PlayGame\\State_property_"+SceneManager.PlayGame_State.ToString(),((SIMONObject)GameTimeManager_Compare.GroupB.ValueOfIndex (i)).ObjectID); ((SIMONObject)GameTimeManager_Compare.GroupA.ValueOfIndex (i)).LoadObjectDefinition("PlayGame\\State_property_"+SceneManager.PlayGame_State.ToString(),((SIMONObject)GameTimeManager_Compare.GroupA.ValueOfIndex (i)).ObjectID); } else { ((SIMONObject)GameTimeManager_Compare.GroupB.ValueOfIndex (i)).LoadObjectDefinition("PlayGame\\State_action_"+SceneManager.PlayGame_State.ToString(),((SIMONObject)GameTimeManager_Compare.GroupB.ValueOfIndex (i)).ObjectID); ((SIMONObject)GameTimeManager_Compare.GroupA.ValueOfIndex (i)).LoadObjectDefinition("PlayGame\\State_action_"+SceneManager.PlayGame_State.ToString(),((SIMONObject)GameTimeManager_Compare.GroupA.ValueOfIndex (i)).ObjectID); } } SceneManager.SM.changeAndMoveScene(SceneState.scene_play_compare); } }
public System.Object ActionFunction_Skill_Range(SIMONObject a, SIMONObject[] b) { double MaxValue= -1000000.0d; double Total_Enemy = a.GetPropertyElement("Monster_Enemy_1")+ a.GetPropertyElement("Monster_Enemy_2") + a.GetPropertyElement("Monster_Enemy_3")+a.GetPropertyElement("Monster_Enemy_4"); double tempValue = 0.0d; double geneA, geneB, geneC , geneD; if (a.GetPropertyElement ("Range") < 20) return MaxValue; if (a.GetPropertyElement ("Type") == 1) { if (isSkillCoolTime((float)a.GetPropertyElement("coolTime_Skill_Start_7")) && !isSkill) { a.SetPropertyElement("coolTime_Skill_Start_7",(double)Time.time); MaxValue = 1000000.0d; } return MaxValue; } if(SimulationType == 1) { geneA = -48.0d; geneB = 22.0d; geneC = 24.0d; geneD = 176.0d; } else { geneA = a.GetActionObject("Skill_Range" ).FindWeight ("Range_Gene_A"); geneB = a.GetActionObject("Skill_Range" ).FindWeight ("Range_Gene_B"); geneC = a.GetActionObject("Skill_Range" ).FindWeight ("Range_Gene_C"); geneD = a.GetActionObject("Skill_Range" ).FindWeight ("Range_Gene_D"); } if (a.GetPropertyElement ("Range") < 20) return MaxValue; if (isSkillCoolTime((float)a.GetPropertyElement("coolTime_Skill_Start_7")) && !isSkill) { a.SetPropertyElement("coolTime_Skill_Start_7",(double)Time.time); for(int i = 0 ; i < b.Length ; i++) { if(b[i].GetPropertyElement("CurHp") <=0) continue; if(a.GetPropertyElement("Type") != b[i].GetPropertyElement("Type")) { tempValue =((scoreConversion(-25.0d,Total_Enemy)*geneA) )*4.0d; if(MaxValue < tempValue) { MaxValue = tempValue; } } } } return MaxValue; }
public System.Object ActionFunction_Skill_Defensive(SIMONObject a, SIMONObject[] b) { double MaxValue= -1000000.0d; double tempValue = 0.0d; double hp =a.GetPropertyElement("CurHp"); double total_hp = a.GetPropertyElement ("HP"); double attackedCount = a.GetPropertyElement ("AttackedCount"); double Total_Home = a.GetPropertyElement("Monster_Home_1")+ a.GetPropertyElement("Monster_Home_2") + a.GetPropertyElement("Monster_Home_3")+a.GetPropertyElement("Monster_Home_4"); double Total_Enemy = a.GetPropertyElement("Monster_Enemy_1")+ a.GetPropertyElement("Monster_Enemy_2") + a.GetPropertyElement("Monster_Enemy_3")+a.GetPropertyElement("Monster_Enemy_4"); double geneA, geneB, geneC , geneD; if (a.GetPropertyElement ("Defensive") < 20) return MaxValue; if (a.GetPropertyElement ("Type") == 1) { if (isSkillCoolTime((float)a.GetPropertyElement("coolTime_Skill_Start_5")) && !isSkill) { a.SetPropertyElement("coolTime_Skill_Start_5",(double)Time.time); MaxValue = 1000000.0d; } return MaxValue; } if(SimulationType == 1) { geneA = 400.0d; geneB = -1.0d; geneC = 6.0d; geneD = 5.0d; } else { geneA = a.GetActionObject("Skill_Defensive" ).FindWeight ("Defensive_Gene_A"); geneB = a.GetActionObject("Skill_Defensive" ).FindWeight ("Defensive_Gene_B"); geneC = a.GetActionObject("Skill_Defensive" ).FindWeight ("Defensive_Gene_C"); geneD = a.GetActionObject("Skill_Defensive" ).FindWeight ("Defensive_Gene_D"); } if (isSkillCoolTime((float)a.GetPropertyElement("coolTime_Skill_Start_5")) && !isSkill) { a.SetPropertyElement("coolTime_Skill_Start_5",(double)Time.time); for(int i = 0 ; i < b.Length ; i++) { if(b[i].GetPropertyElement("CurHp") <=0) continue; if(a.GetPropertyElement("Type") != b[i].GetPropertyElement("Type")) { tempValue =((scoreConversion(-1.0d * total_hp,hp)*geneA)+ (scoreConversion(25.0d,Total_Home)*geneB)+ (scoreConversion(25.0d,Total_Enemy)*geneD)+ (scoreConversion(25.0d,attackedCount)*geneC) )*2.0d; if(MaxValue < tempValue) { MaxValue = tempValue; } } } } return MaxValue; }
public System.Object PropertyUpdate(SIMONObject a, SIMONObject[] b) { GameObject myObject; myObject = GameObject.Find (a.ObjectID); int count = 0, count_H1 = 0, count_H2 = 0, count_H3=0,count_H4=0; int count_E1 = 0, count_E2 = 0, count_E3=0,count_E4=0; double positionX = 0.0d; double positionY = 0.0d; double myPositionX = myObject.transform.position.x; double myPositionY = myObject.transform.position.y; double disX, disY; Vector2 p; float distance; if(a.GetPropertyElement("Type") == 2) { if (myObject.GetComponent<SIMON_Controller>().animator.GetCurrentAnimatorStateInfo (0).IsTag ("Stay")) { a.SetPropertyElement("isCheck",1); } } else { if (myObject.GetComponent<UsualAI_Controller>().animator.GetCurrentAnimatorStateInfo (0).IsTag ("Stay")) { a.SetPropertyElement("isCheck",1); } } a.SetPropertyElement ("PositionX", (double)myObject.transform.position.x); a.SetPropertyElement ("PositionY", (double)myObject.transform.position.y); for(int i = 0; i < b.Length; i++) { if(b[i].GetPropertyElement ("CurHp") <= 0) { continue; } if(b[i].GetPropertyElement ("Attack_Target")== a.GetPropertyElement("ID")) { if(a.GetPropertyElement("Type") != b[i].GetPropertyElement("Type")) count++; } positionX = b[i].GetPropertyElement ("PositionX"); positionY = b[i].GetPropertyElement ("PositionY"); p = new Vector2((float)positionX,(float)positionY); distance = Vector2.Distance(p,myObject.transform.position); if(distance < a.GetPropertyElement("Monster_Sight")) { disX = positionX - myPositionX; disY = positionY - myPositionY; if(disX > 0 && disY > 0) { if(disY - disX > 0) { if(a.GetPropertyElement("Type") == b[i].GetPropertyElement("Type")) count_H1++; else count_E1++; } else { if(a.GetPropertyElement("Type") == b[i].GetPropertyElement("Type")) count_H4++; else count_E4++; } } else if(disX < 0 && disY > 0) { if(disY - (disX * -1.0d) > 0) { if(a.GetPropertyElement("Type") == b[i].GetPropertyElement("Type")) count_H1++; else count_E1++; } else { if(a.GetPropertyElement("Type") == b[i].GetPropertyElement("Type")) count_H2++; else count_E2++; } } else if(disX < 0 && disY < 0) { if((disY * -1.0d) - (disX * -1.0d) > 0) { if(a.GetPropertyElement("Type") == b[i].GetPropertyElement("Type")) count_H3++; else count_E3++; } else { if(a.GetPropertyElement("Type") == b[i].GetPropertyElement("Type")) count_H2++; else count_E2++; } } else if(disX > 0 && disY < 0) { if((disY * -1.0d) - disX > 0) { if(a.GetPropertyElement("Type") == b[i].GetPropertyElement("Type")) count_H3++; else count_E3++; } else { if(a.GetPropertyElement("Type") == b[i].GetPropertyElement("Type")) count_H4++; else count_E4++; } } } } a.SetPropertyElement ("AttackedCount", (double)count); a.SetPropertyElement ("Monster_Enemy_1", (double)count_E1); a.SetPropertyElement ("Monster_Enemy_2", (double)count_E2); a.SetPropertyElement ("Monster_Enemy_3", (double)count_E3); a.SetPropertyElement ("Monster_Enemy_4", (double)count_E4); a.SetPropertyElement ("Monster_Home_1", (double)count_H1); a.SetPropertyElement ("Monster_Home_2", (double)count_H2); a.SetPropertyElement ("Monster_Home_3", (double)count_H3); a.SetPropertyElement ("Monster_Home_4", (double)count_H4); return -1000000.0d; }
public System.Object FitnessFunction_Avoid(SIMONObject a, SIMONObject[] b) { double value=100.0d; value = -1.0d * a.GetPropertyElement("Monster_Total_AttackedCount"); return value; }
public System.Object PropertyUpdate_FitnessFunction(SIMONObject a, SIMONObject[] b) { double value ; value =-10000000.0d; return value; }
public Object Monster_defense(SIMONObject a, SIMONObject[] b) { a.SetPropertyElement ("State", (double)3.0d); a.SetPropertyElement ("Attack_Target", -1.0d); a.SetPropertyElement ("Move_Target", -1.0d); a.SetPropertyElement ("Target",-1.0d); return null; }
public void InsertSIMONObject(string key, SIMONObject sObject){ SimonManager.RegisterSIMONObject (key, sObject); }
public void InsertSIMONObject(SIMONObject sObject){ SimonManager.RegisterSIMONObject (sObject); }
public void PublishDefinition(string fileName, SIMONObject source){ SimonManager.PublishObject (fileName, source); }
/// <summary> /// methodName을 이름으로 하는 SimonFunction에 등록된 함수에 대한 비동기 작업을 수행합니다. /// </summary> /// <param name="methodName">함수 이름입니다.</param> /// <param name="thisObject">함수에 전달할 주체 Parameter입니다.</param> /// <param name="theOtherObjects">함수에 전달할 객체 Parameter 배열입니다.</param> /// <returns>함수 실행에 대한 비동기 결과.</returns> public IAsyncResult BeginMethod(string methodName, SIMONObject thisObject, SIMONObject[] theOtherObjects) { IAsyncResult result = SimonFunctions[methodName].BeginInvoke(thisObject, theOtherObjects, null, null); return result; }
/// <summary> /// methodName을 이름으로 하는 SimonFunction에 등록된 함수를 실행합니다. /// </summary> /// <param name="methodName">실행할 함수의 이름입니다.</param> /// <param name="thisObject">함수에 전달할 주체 Parameter입니다.</param> /// <param name="theOtherObjects">함수에 전달할 객체 Parameter배열입니다.</param> /// <returns>함수의 결과값입니다.</returns> public Object RunMethod(string methodName, SIMONObject thisObject, SIMONObject[] theOtherObjects) { return SimonFunctions[methodName].Invoke(thisObject, theOtherObjects); }
/// <summary> /// methodName을 이름으로 하는 SimonFunction에 등록된 함수를 실행합니다. /// </summary> /// <param name="methodName">실행할 함수의 이름입니다.</param> /// <param name="thisObject">함수에 전달할 주체 Parameter입니다.</param> /// <returns>함수의 결과값입니다.</returns> public Object RunMethod(string methodName, SIMONObject thisObject) { return SimonFunctions[methodName].Invoke(thisObject, null); }
public Object monster_Skill_Defensive(SIMONObject a, SIMONObject[] b) { a.SetPropertyElement ("Skill_number", 5); return null; }
public Object monster_Skill_Range(SIMONObject a, SIMONObject[] b) { a.SetPropertyElement ("Skill_number", 7); return null; }
public void DeleteSIMONObject(SIMONObject sObject){ SimonManager.UnregisterSIMONObject (sObject); }
public Object Monster_attack(SIMONObject a, SIMONObject[] b) { a.SetPropertyElement("State",2.0d); a.SetPropertyElement ("Move_Target", -1.0d); a.SetPropertyElement("Target",a.GetPropertyElement("Attack_Target")); return null; }
// Use this for initialization void Start () { gObj_Monster = this.gameObject; animator = GetComponent<Animator> (); SimulationType = SceneManager.SimulationType; sObject = new SIMONObject (); sObject.ObjectID = gObj_Monster.name; if (GameTimeManager_Compare.GroupA.Count == 7) { for(int i= 0 ; i < GameTimeManager_Compare.GroupA.Count ; i++) { if(((SIMONObject)GameTimeManager_Compare.GroupA.ValueOfIndex (i)).ObjectID.Equals(sObject.ObjectID)) { sObject = ((SIMONObject)GameTimeManager_Compare.GroupA.ValueOfIndex (i)); reStart(); if(SceneManager.PlayGame_State >1) return; break; } } } SIMON.GlobalSIMON.InsertSIMONObject(sObject); SIMONFunction propertyUpdate_Name = PropertyUpdate; SIMONFunction ExecutionFunction_propertyUpdate_Name = PropertyUpdate_Exection; SIMONFunction FitnessFunction_propertyUpdate_Name = PropertyUpdate_FitnessFunction; SIMONFunction ActionFunction_Move_Name = ActionFunction_Move; SIMONFunction ExecutionFunction_Move_Name = Monster_move; SIMONFunction FitnessFunction_Move_Name = FitnessFunction_Move; SIMONFunction ActionFunction_Attack_Name = ActionFunction_Attack; SIMONFunction ExecutionFunction_Attack_Name = Monster_attack; SIMONFunction FitnessFunction_Attack_Name = FitnessFunction_Attack; SIMONFunction ActionFunction_Defense_Name = ActionFunction_Defense; SIMONFunction ExecutionFunction_Defense_Name = Monster_defense; SIMONFunction FitnessFunction_Defense_Name = FitnessFunction_Defense; SIMONFunction ActionFunction_Avoid_Name = ActionFunction_Avoid; SIMONFunction ExecutionFunction_Avoid_Name = Monster_avoid; SIMONFunction FitnessFunction_Avoid_Name = FitnessFunction_Avoid; // SIMONFunction ActionFunction_Skill_Strength_Name = ActionFunction_Skill_Strength; SIMONFunction ExecutionFunction_Skill_Strength_Name = monster_Skill_Strength; SIMONFunction FitnessFunction_Skill_Strength_Name = FitnessFunction_Skill_Strength; SIMONFunction ActionFunction_Skill_Attack_Speed_Name = ActionFunction_Skill_Attack_Speed; SIMONFunction ExecutionFunction_Skill_Skill_Attack_Speed_Name = monster_Skill_Attack_Speed; SIMONFunction FitnessFunction_Skill_Attack_Speed_Name = FitnessFunction_Skill_Attack_Speed; SIMONFunction ActionFunction_Skill_Moving_Speed_Name = ActionFunction_Skill_Moving_Speed; SIMONFunction ExecutionFunction_Skill_Skill_Moving_Speed_Name = monster_Skill_Moving_Speed; SIMONFunction FitnessFunction_Skill_Moving_Speed_Name = FitnessFunction_Skill_Moving_Speed; SIMONFunction ActionFunction_Skill_Critical_Name = ActionFunction_Skill_Critical; SIMONFunction ExecutionFunction_Skill_Skill_Critical_Name = monster_Skill_Critical; SIMONFunction FitnessFunction_Skill_Critical_Name = FitnessFunction_Skill_Critical; SIMONFunction ActionFunction_Skill_Defensive_Name = ActionFunction_Skill_Defensive; SIMONFunction ExecutionFunction_Skill_Skill_Defensive_Name = monster_Skill_Defensive; SIMONFunction FitnessFunction_Skill_Defensive_Name = FitnessFunction_Skill_Defensive; SIMONFunction ActionFunction_Skill_CON_Name = ActionFunction_Skill_CON; SIMONFunction ExecutionFunction_Skill_Skill_CON_Name = monster_Skill_CON; SIMONFunction FitnessFunction_Skill_CON_Name = FitnessFunction_Skill_CON; SIMONFunction ActionFunction_Skill_Range_Name = ActionFunction_Skill_Range; SIMONFunction ExecutionFunction_Skill_Skill_Range_Name = monster_Skill_Range; SIMONFunction FitnessFunction_Skill_Range_Name = FitnessFunction_Skill_Range; // SIMON.GlobalSIMON.InsertSIMONMethod("propertyUpdate", propertyUpdate_Name); SIMON.GlobalSIMON.InsertSIMONMethod("Execution_propertyUpdate" , ExecutionFunction_propertyUpdate_Name); SIMON.GlobalSIMON.InsertSIMONMethod("FitnessFunction_propertyUpdate" , FitnessFunction_propertyUpdate_Name); SIMON.GlobalSIMON.InsertSIMONMethod("ActionFunction_Move" , ActionFunction_Move_Name); SIMON.GlobalSIMON.InsertSIMONMethod("Monster_Move" , ExecutionFunction_Move_Name); SIMON.GlobalSIMON.InsertSIMONMethod("FitnessFunction_Move" , FitnessFunction_Move_Name); SIMON.GlobalSIMON.InsertSIMONMethod("ActionFunction_Attack" , ActionFunction_Attack_Name); SIMON.GlobalSIMON.InsertSIMONMethod("Monster_Attack" , ExecutionFunction_Attack_Name); SIMON.GlobalSIMON.InsertSIMONMethod("FitnessFunction_Attack" , FitnessFunction_Attack_Name); SIMON.GlobalSIMON.InsertSIMONMethod("ActionFunction_Defense" , ActionFunction_Defense_Name); SIMON.GlobalSIMON.InsertSIMONMethod("Monster_Defense" , ExecutionFunction_Defense_Name); SIMON.GlobalSIMON.InsertSIMONMethod("FitnessFunction_Defense" , FitnessFunction_Defense_Name); SIMON.GlobalSIMON.InsertSIMONMethod("ActionFunction_Avoid" , ActionFunction_Avoid_Name); SIMON.GlobalSIMON.InsertSIMONMethod("Monster_Avoid" , ExecutionFunction_Avoid_Name); SIMON.GlobalSIMON.InsertSIMONMethod("FitnessFunction_Avoid" , FitnessFunction_Avoid_Name); // SIMON.GlobalSIMON.InsertSIMONMethod("ActionFunction_Skill_Strength" , ActionFunction_Skill_Strength_Name); SIMON.GlobalSIMON.InsertSIMONMethod("Monster_Skill_Strength" , ExecutionFunction_Skill_Strength_Name); SIMON.GlobalSIMON.InsertSIMONMethod("FitnessFunction_Skill_Strength" , FitnessFunction_Skill_Strength_Name); SIMON.GlobalSIMON.InsertSIMONMethod("ActionFunction_Skill_Attack_Speed" , ActionFunction_Skill_Attack_Speed_Name); SIMON.GlobalSIMON.InsertSIMONMethod("Monster_Skill_Attack_Speed" , ExecutionFunction_Skill_Skill_Attack_Speed_Name); SIMON.GlobalSIMON.InsertSIMONMethod("FitnessFunction_Skill_Attack_Speed" , FitnessFunction_Skill_Attack_Speed_Name); SIMON.GlobalSIMON.InsertSIMONMethod("ActionFunction_Skill_Moving_Speed" , ActionFunction_Skill_Moving_Speed_Name); SIMON.GlobalSIMON.InsertSIMONMethod("Monster_Skill_Moving_Speed" , ExecutionFunction_Skill_Skill_Moving_Speed_Name); SIMON.GlobalSIMON.InsertSIMONMethod("FitnessFunction_Skill_Moving_Speed" , FitnessFunction_Skill_Moving_Speed_Name); SIMON.GlobalSIMON.InsertSIMONMethod("ActionFunction_Skill_Critical" , ActionFunction_Skill_Critical_Name); SIMON.GlobalSIMON.InsertSIMONMethod("Monster_Skill_Critical" , ExecutionFunction_Skill_Skill_Critical_Name); SIMON.GlobalSIMON.InsertSIMONMethod("FitnessFunction_Skill_Critical" , FitnessFunction_Skill_Critical_Name); SIMON.GlobalSIMON.InsertSIMONMethod("ActionFunction_Skill_Defensive" , ActionFunction_Skill_Defensive_Name); SIMON.GlobalSIMON.InsertSIMONMethod("Monster_Skill_Defensive" , ExecutionFunction_Skill_Skill_Defensive_Name); SIMON.GlobalSIMON.InsertSIMONMethod("FitnessFunction_Skill_Defensive" , FitnessFunction_Skill_Defensive_Name); SIMON.GlobalSIMON.InsertSIMONMethod("ActionFunction_Skill_CON" , ActionFunction_Skill_CON_Name); SIMON.GlobalSIMON.InsertSIMONMethod("Monster_Skill_CON" , ExecutionFunction_Skill_Skill_CON_Name); SIMON.GlobalSIMON.InsertSIMONMethod("FitnessFunction_Skill_CON" , FitnessFunction_Skill_CON_Name); SIMON.GlobalSIMON.InsertSIMONMethod("ActionFunction_Skill_Range" , ActionFunction_Skill_Range_Name); SIMON.GlobalSIMON.InsertSIMONMethod("Monster_Skill_Range" , ExecutionFunction_Skill_Skill_Range_Name); SIMON.GlobalSIMON.InsertSIMONMethod("FitnessFunction_Skill_Range" , FitnessFunction_Skill_Range_Name); // setTotalHP((float)sObject.GetPropertyElement("HP")); curDirection = 3; isSkill = false; }
public System.Object FitnessFunction_Attack(SIMONObject a, SIMONObject[] b) { double value; value = a.GetPropertyElement("Monster_Total_Damage")/a.GetPropertyElement("Monster_Total_AttackCount"); return value; }
public System.Object ActionFunction_Defense(SIMONObject a, SIMONObject[] b) { double MaxValue= -1000000.0d; double tempValue = 0.0d; double hp =a.GetPropertyElement("CurHp"); double total_hp = a.GetPropertyElement ("HP"); double attackedCount = a.GetPropertyElement ("AttackedCount"); double Total_Home = a.GetPropertyElement("Monster_Home_1")+ a.GetPropertyElement("Monster_Home_2") + a.GetPropertyElement("Monster_Home_3")+a.GetPropertyElement("Monster_Home_4"); double Total_Enemy = a.GetPropertyElement("Monster_Enemy_1")+ a.GetPropertyElement("Monster_Enemy_2") + a.GetPropertyElement("Monster_Enemy_3")+a.GetPropertyElement("Monster_Enemy_4"); double geneA, geneB, geneD; if (a.GetPropertyElement ("Type") == 1) { if (a.GetPropertyElement ("HP") / 2 > a.GetPropertyElement ("CurHp")) { MaxValue = Random.Range(100,200); } return MaxValue; } if(SimulationType == 1) { geneA = 80.0d; geneB = -17.0d; geneD = -9.0d; } else { geneA = a.GetActionObject("Defense").FindWeight ("Defense_Gene_A"); geneB = a.GetActionObject("Defense").FindWeight ("Defense_Gene_B"); geneD = a.GetActionObject("Defense").FindWeight ("Defense_Gene_D"); } if (a.GetPropertyElement ("AttackedCount") == 0) { return MaxValue; } if (a.GetPropertyElement ("HP") == hp) { return MaxValue; } for(int i = 0 ; i < b.Length ; i++) { if(b[i].GetPropertyElement("CurHp") <=0) continue; if(a.GetPropertyElement("Type") != b[i].GetPropertyElement("Type")) { tempValue =((scoreConversion(-1.0d * total_hp,hp)*geneA)+ (scoreConversion(25.0d,Total_Home)*geneB)+ (scoreConversion(25.0d,Total_Enemy)*geneD) ); if(MaxValue < tempValue) { MaxValue = tempValue; } } } return MaxValue; }
public System.Object FitnessFunction_Skill_Range(SIMONObject a, SIMONObject[] b) { double value; value = a.GetPropertyElement("Monster_Total_Damage"); return value; }
public System.Object ActionFunction_Attack(SIMONObject a, SIMONObject[] b) { double MaxValue = -1000000.0d; double tempValue = 0.0d; double hp =a.GetPropertyElement("CurHp"); double damage = a.GetPropertyElement ("Monster_Damage"); double attack_Speed = a.GetPropertyElement ("Monster_Attack_Speed"); double attackedCount = a.GetPropertyElement ("AttackedCount"); double defensive = a.GetPropertyElement("Defensive"); double total_hp = a.GetPropertyElement ("HP"); double geneA, geneC, geneD; double pointX = a.GetPropertyElement ("PositionX"); double pointY = a.GetPropertyElement ("PositionY"); Vector2 a_v; GameObject Target_Temp; if (a.GetPropertyElement ("Type") == 1) { for (int i = 0; i < b.Length; i++) { if(b[i].GetPropertyElement("CurHp") <=0) continue; if(a.GetPropertyElement("Type") != b[i].GetPropertyElement("Type")) { Target_Temp = GameObject.Find (b[i].ObjectID); a_v= new Vector2((float)pointX,(float)pointY); dis = Vector2.Distance (a_v, Target_Temp.transform.position); if (dis < a.GetPropertyElement("Monster_Range")) { tempValue = 100000.0d - b[i].GetPropertyElement("CurHp")+100000; if(MaxValue < tempValue) { MaxValue = tempValue; a.SetPropertyElement("Attack_Target",b[i].GetPropertyElement("ID")); a.SetPropertyElement("Monster_Enemy_Defensive",b[i].GetPropertyElement("Monster_Defensive")); a.SetPropertyElement("Monster_Enemy_CurHp",b[i].GetPropertyElement("CurHp")); } } } } return MaxValue; } if(SimulationType == 1) { geneA = 192.0d; geneC = 20.0d; geneD = 2.4d; } else { geneA = a.GetActionObject("Attack").FindWeight ("Attack_Gene_A"); geneC = a.GetActionObject("Attack").FindWeight ("Attack_Gene_C"); geneD = a.GetActionObject("Attack").FindWeight ("Attack_Gene_D"); } for (int i = 0; i < b.Length; i++) { if(b[i].GetPropertyElement("CurHp") <=0) continue; if(a.GetPropertyElement("Type") != b[i].GetPropertyElement("Type")) { Target_Temp = GameObject.Find (b[i].ObjectID); a_v= new Vector2((float)pointX,(float)pointY); dis = Vector2.Distance (a_v, Target_Temp.transform.position); if (dis < a.GetPropertyElement("Monster_Range")) { tempValue =((scoreConversion(-1.0d * b[i].GetPropertyElement("HP"),b[i].GetPropertyElement("CurHp"))*geneA)+ (scoreConversion(-25.0d,a.GetPropertyElement("AttackedCount"))*geneC)+ (scoreConversion(-19.0d,dis)*geneD) ); if(MaxValue < tempValue) { MaxValue = tempValue; a.SetPropertyElement("Attack_Target",b[i].GetPropertyElement("ID")); a.SetPropertyElement("Monster_Enemy_Defensive",b[i].GetPropertyElement("Monster_Defensive")); a.SetPropertyElement("Monster_Enemy_CurHp",b[i].GetPropertyElement("CurHp")); } } } } return MaxValue; }
public System.Object ActionFunction_Skill_Critical(SIMONObject a, SIMONObject[] b) { double MaxValue= -1000000.0d; double hp =a.GetPropertyElement("CurHp"); double damage = a.GetPropertyElement ("Monster_Damage"); double attack_Speed = a.GetPropertyElement ("Monster_Attack_Speed"); double tempValue = 0.0d; double geneA, geneB, geneC ,geneD; double pointX = a.GetPropertyElement ("PositionX"); double pointY = a.GetPropertyElement ("PositionY"); Vector2 a_v; GameObject Target_Temp; if (a.GetPropertyElement ("Critical") < 20) return MaxValue; if (a.GetPropertyElement ("Type") == 1) { if (isSkillCoolTime((float)a.GetPropertyElement("coolTime_Skill_Start_4")) && !isSkill) { a.SetPropertyElement("coolTime_Skill_Start_4",(double)Time.time); MaxValue = 1000000.0d; } return MaxValue; } if(SimulationType == 1) { geneA = -2.0d; geneB = 195.0d; geneC = 43.0d; geneD = -3.0d; } else { geneA = a.GetActionObject("Skill_Critical" ).FindWeight ("Critical_Gene_A"); geneB = a.GetActionObject("Skill_Critical" ).FindWeight ("Critical_Gene_B"); geneC = a.GetActionObject("Skill_Critical" ).FindWeight ("Critical_Gene_C"); geneD = a.GetActionObject("Skill_Critical" ).FindWeight ("Critical_Gene_D"); } if (isSkillCoolTime((float)a.GetPropertyElement("coolTime_Skill_Start_4")) && !isSkill) { a.SetPropertyElement("coolTime_Skill_Start_4",(double)Time.time); for(int i = 0 ; i < b.Length ; i++) { if(b[i].GetPropertyElement("CurHp") <=0) continue; if(a.GetPropertyElement("Type") != b[i].GetPropertyElement("Type")) { Target_Temp = GameObject.Find (b[i].ObjectID); a_v= new Vector2((float)pointX,(float)pointY); dis = Vector2.Distance (a_v, Target_Temp.transform.position); tempValue =((scoreConversion(-1.0d * b[i].GetPropertyElement("HP"),b[i].GetPropertyElement("CurHp"))*geneA)+ (scoreConversion(25.0d,b[i].GetPropertyElement("AttackedCount"))*geneB)+ (scoreConversion(-25.0d,a.GetPropertyElement("AttackedCount"))*geneC)+ (scoreConversion(-19.0d,dis)*geneD) )*2.0d; if(MaxValue < tempValue) { MaxValue = tempValue; } } } } return MaxValue; }
public Object monster_Skill_Strength(SIMONObject a, SIMONObject[] b) { a.SetPropertyElement ("Skill_number", 1); return null; }
public System.Object ActionFunction_Skill_CON(SIMONObject a, SIMONObject[] b) { double MaxValue= -1000000.0d; double tempValue = 0.0d; double hp =a.GetPropertyElement("CurHp"); double total_hp = a.GetPropertyElement ("HP"); double attackedCount = a.GetPropertyElement ("AttackedCount"); double geneA, geneB, geneC ,geneD; if (a.GetPropertyElement ("CON") < 20) return MaxValue; if (a.GetPropertyElement ("Type") == 1) { if (isSkillCoolTime((float)a.GetPropertyElement("coolTime_Skill_Start_6")) && !isSkill) { a.SetPropertyElement("coolTime_Skill_Start_6",(double)Time.time); MaxValue = 1000000.0d; } return MaxValue; } if(SimulationType == 1) { geneA = 44.0d; geneB = 100.0d; geneC = 100.0d; geneD = 1.0d; } else { geneA = a.GetActionObject("Skill_CON" ).FindWeight ("CON_Gene_A"); geneB = a.GetActionObject("Skill_CON" ).FindWeight ("CON_Gene_B"); geneC = a.GetActionObject("Skill_CON" ).FindWeight ("CON_Gene_C"); geneD = a.GetActionObject("Skill_CON" ).FindWeight ("CON_Gene_D"); } if (isSkillCoolTime((float)a.GetPropertyElement("coolTime_Skill_Start_6")) && !isSkill) { a.SetPropertyElement("coolTime_Skill_Start_6",(double)Time.time); for(int i = 0 ; i < b.Length ; i++) { if(b[i].GetPropertyElement("CurHp") <=0) continue; if(a.GetPropertyElement("Type") != b[i].GetPropertyElement("Type")) { tempValue =((scoreConversion(-1.0d * total_hp,hp)*geneA) )*4.0d; if(MaxValue < tempValue) { MaxValue = tempValue; } } } } return MaxValue; }
public Object monster_Skill_Moving_Speed(SIMONObject a, SIMONObject[] b) { a.SetPropertyElement ("Skill_number", 3); return null; }
public object Move(SIMONObject[] obj, SIMONObject[] obj2){ Debug.Log ("Move Call"); return null; }
public Object monster_Skill_Critical(SIMONObject a, SIMONObject[] b) { a.SetPropertyElement ("Skill_number", 4); return null; }