本文整理汇总了C#中SIMONFramework.SIMONObject类的典型用法代码示例。如果您正苦于以下问题:C# SIMONObject类的具体用法?C# SIMONObject怎么用?C# SIMONObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SIMONObject类属于SIMONFramework命名空间,在下文中一共展示了SIMONObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyToObject
private SIMONObject CopyToObject()
{
SIMONObject newObject = new SIMONObject();
newObject.ObjectID = this.ObjectID;
newObject.Properties = this.Properties;
newObject.Actions = this.Actions;
return newObject;
}
示例2: SerializeObject
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();
}
示例3: MoveSimulationScene
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);
}
}
示例4: ActionFunction_Skill_Range
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;
}
示例5: ActionFunction_Skill_Defensive
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;
}
示例6: PropertyUpdate
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++;
//.........这里部分代码省略.........
示例7: FitnessFunction_Avoid
public System.Object FitnessFunction_Avoid(SIMONObject a, SIMONObject[] b)
{
double value=100.0d;
value = -1.0d * a.GetPropertyElement("Monster_Total_AttackedCount");
return value;
}
示例8: PropertyUpdate_FitnessFunction
public System.Object PropertyUpdate_FitnessFunction(SIMONObject a, SIMONObject[] b)
{
double value ;
value =-10000000.0d;
return value;
}
示例9: Monster_defense
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;
}
示例10: InsertSIMONObject
public void InsertSIMONObject(string key, SIMONObject sObject){
SimonManager.RegisterSIMONObject (key, sObject);
}
示例11: PublishDefinition
public void PublishDefinition(string fileName, SIMONObject source){
SimonManager.PublishObject (fileName, source);
}
示例12: BeginMethod
/// <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;
}
示例13: RunMethod
/// <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);
}
示例14: monster_Skill_Defensive
public Object monster_Skill_Defensive(SIMONObject a, SIMONObject[] b)
{
a.SetPropertyElement ("Skill_number", 5);
return null;
}
示例15: monster_Skill_Range
public Object monster_Skill_Range(SIMONObject a, SIMONObject[] b)
{
a.SetPropertyElement ("Skill_number", 7);
return null;
}