public T2 SetState <T1, T2>(AIParam userData1 = null, AIParam userData2 = null) where T1 : AIState where T2 : AIState { AIState destState = GetState <T1>(); if (destState == null) { return(null); } if (_CurrentState != null) { _CurrentState.Leave(); } _CurrentState = destState; _CurrentState.SetUserData(userData1); _CurrentState.Execute(); T2 nextState = GetState <T2>(); _CurrentState.NextState = nextState; return(nextState); }
public virtual void GenerateParam() { id = AIParam.NextId(); myName = AIParam.RandomName(); radiusCommunication = AIParam.RadiusCommunication(); infoCanvas.SetInfo(myName, ""); infoCanvas.SetStarLevel(AIParam.StartLevel()); }
public AIState SetState(string state, AIParam userData = null) { if (!_StateList.ContainsKey(state)) { return(null); } if (_CurrentState != null) { _CurrentState.Leave(); } _CurrentState = _StateList[state]; _CurrentState.SetUserData(userData); _CurrentState.NextState = null; _CurrentState.Execute(); return(_CurrentState); }
public bool Deserialize(JSON_AIParam json) { if (json == null) { return(false); } this.iname = json.iname; this.role = (RoleTypes)json.role; this.param = (ParamTypes)json.prm; this.param_prio = (ParamPriorities)json.prmprio; if (json.best != 0) { AIParam aiParam = this; aiParam.flags = (OLong)((long)aiParam.flags | 1L); } if (json.sneak != 0) { AIParam aiParam = this; aiParam.flags = (OLong)((long)aiParam.flags | 2L); } if (json.notmov != 0) { AIParam aiParam = this; aiParam.flags = (OLong)((long)aiParam.flags | 4L); } if (json.notact != 0) { AIParam aiParam = this; aiParam.flags = (OLong)((long)aiParam.flags | 8L); } if (json.notskl != 0) { AIParam aiParam = this; aiParam.flags = (OLong)((long)aiParam.flags | 16L); } if (json.notavo != 0) { AIParam aiParam = this; aiParam.flags = (OLong)((long)aiParam.flags | 32L); } if (json.csff != 0) { AIParam aiParam = this; aiParam.flags = (OLong)((long)aiParam.flags | 64L); } if (json.notmpd != 0) { AIParam aiParam = this; aiParam.flags = (OLong)((long)aiParam.flags | 128L); } if (json.buff_self != 0) { AIParam aiParam = this; aiParam.flags = (OLong)((long)aiParam.flags | 256L); } if (json.notprio != 0) { AIParam aiParam = this; aiParam.flags = (OLong)((long)aiParam.flags | 512L); } if (json.use_old_sort != 0) { AIParam aiParam = this; aiParam.flags = (OLong)((long)aiParam.flags | 1024L); } this.escape_border = (OInt)json.sos; this.heal_border = (OInt)json.heal; this.gems_border = (OInt)json.gems; this.buff_border = (OInt)json.buff_border; this.cond_border = (OInt)json.cond_border; this.safe_border = (OInt)json.safe_border; this.gosa_border = (OInt)json.gosa_border; this.DisableSupportActionHpBorder = (OInt)json.notsup_hp; this.DisableSupportActionMemberBorder = (OInt)json.notsup_num; this.SkillCategoryPriorities = (SkillCategory[])null; this.BuffPriorities = (ParamTypes[])null; this.ConditionPriorities = (EUnitCondition[])null; if (json.skil_prio != null) { this.SkillCategoryPriorities = new SkillCategory[json.skil_prio.Length]; for (int index = 0; index < json.skil_prio.Length; ++index) { this.SkillCategoryPriorities[index] = (SkillCategory)json.skil_prio[index]; } } if (json.buff_prio != null) { this.BuffPriorities = new ParamTypes[json.buff_prio.Length]; for (int index = 0; index < json.buff_prio.Length; ++index) { this.BuffPriorities[index] = (ParamTypes)json.buff_prio[index]; } } if (json.cond_prio != null) { this.ConditionPriorities = new EUnitCondition[json.cond_prio.Length]; for (int index = 0; index < json.cond_prio.Length; ++index) { this.ConditionPriorities[index] = (EUnitCondition)(1L << json.cond_prio[index]); } } return(true); }
public virtual void SetUserData(AIParam data) { }
public T SetState <T>(AIParam userData = null) where T : AIState { return(SetState(typeof(T).ToString(), userData) as T); }
public override void SetUserData(AIParam data) { Param = data as AIObjectParam; }