public static AiInfo ReadFrom(PrimitiveReader reader) { AiInfo info = new AiInfo(); info.Unknown = reader.ReadUInt16(); ushort stringsCount = reader.ReadUInt16(); System.Diagnostics.Debugger.Break(); info.Unknown2 = reader.ReadUInt32(); List <string> resources = new List <string>(stringsCount); for (int i = 0; i < stringsCount; i++) { resources.Add(Utils.ReadUInt32LengthPrefixedString(reader)); } info.Resources = resources; info.Unknown3 = reader.ReadBytes(6); AiData[] data = new AiData[8]; for (int i = 0; i < data.Length; i++) { data[i] = AiData.ReadFrom(reader); } info.Data = data; info.Unknown4 = reader.ReadBytes(104); AiTimer[] timers = new AiTimer[8]; for (int i = 0; i < timers.Length; i++) { timers[i] = AiTimer.ReadFrom(reader); } info.Timers = timers; info.SharedGoals = reader.ReadUInt32Array(256); info.Unknown5 = reader.ReadUInt32Array(1024); return(info); }
public void Initialize(AiData aiData, WanderData wanderData, CharacterAnimation animation, CharacterCombat combat) { this.aiData = aiData; this.wanderData = wanderData; this.animation = animation; this.combat = combat; }
public override void Init() { aiData = AiManager.Get(aiName); player = netData as PlayerData; vInput = new VirtulInput(); player.Input = vInput; teamManager = player.client.GetManager <TeamManager>(); }
void Start() { _rb = GetComponent <Rigidbody>(); _stateMachine = GetComponent <PlayerStateMachine>(); _player = GetComponent <Player>(); _abilityHandler = GetComponent <PlayerAbilityHandler>(); _data = Resources.Load <AiData>("AiData"); //Retrieve AI settings from scriptedobject _players = TargetContainer.Instance.Players; _pickups = TargetContainer.Instance.Pickups; _controlPoints = TargetContainer.Instance.ControlPoints; _projectiles = TargetContainer.Instance.Projectiles; _meteors = TargetContainer.Instance.Meteors; }
public static AiData ReadFrom(PrimitiveReader reader) { AiData data = new AiData(); data.Unknown = reader.ReadUInt32(); data.Unknown2 = reader.ReadUInt32(); data.MaximumRules = reader.ReadUInt16(); ushort rulesCount = reader.ReadUInt16(); data.Unknown3 = reader.ReadUInt32(); List <AiRule> rules = new List <AiRule>(rulesCount); for (int i = 0; i < rulesCount; i++) { rules.Add(AiRule.ReadFrom(reader)); } data.Rules = rules; return(data); }
public AiLogRequest(int sequence, AiConfig aiConfig, string action) { Name = $"Microsoft.ApplicationInsights.{aiConfig.InstrumentationKey}.{action}"; Time = $"{DateTime.UtcNow:O}"; Sequence = sequence.ToString("0000000000"); InstrumentationKey = aiConfig.InstrumentationKey; Tags = new AiTags { OSVersion = aiConfig.XTBVersion, DeviceType = aiConfig.PluginName, ApplicationVersion = aiConfig.PluginVersion, SessionId = aiConfig.SessionId.ToString(), OperationName = aiConfig.OperationName }; Data = new AiData { BaseType = $"{action}Data", BaseData = new AiBaseData() }; }
public List <AiData> Parser(string aiList) { // 将要做 AiData _aiData = new AiData(); List <AiData> listAiDataCtr = new List <AiData>(); SysMonsterAiVo monsterAiVo = BaseDataMgr.instance.GetDataById <SysMonsterAiVo>(uint.Parse(aiList)); string strAiValue = monsterAiVo.AiValue; // 122=720000,100|218=1;104=5|200=930035 _aiData.ID = int.Parse(aiList); string[] strEachState = strAiValue.Split(';'); for (int i = 0; i < strEachState.Length; i++) { string[] strConditionState = strEachState[i].Split('|'); // 122=720000,100 string[] strConditionValue = strConditionState[0].Split('='); _aiData.conditionType = int.Parse(strConditionValue[0]); string[] value = strConditionValue[1].Split(','); for (int k = 0; k < value.Length; k++) { _aiData.conditionParamList.Add(int.Parse(value[k])); } // 218=1 string[] strActionValue = strConditionState[1].Split('='); _aiData.actionType = int.Parse(strActionValue[0]); value = strActionValue[1].Split(','); for (int k = 0; k < value.Length; k++) { _aiData.actionParamList.Add(int.Parse(value[k])); } listAiDataCtr.Add(_aiData); // 一个条件就一个 _aiData; } return(listAiDataCtr); }
public override void Initialize(System.IO.BinaryReader reader, RecordHeader header) { while (reader.BaseStream.Position < header.DataEndPos) { var type = (SubRecordType)reader.ReadInt32(); var size = reader.ReadInt32(); switch (type) { case SubRecordType.Id: name = reader.ReadString(size); break; case SubRecordType.Model: model = reader.ReadString(size); break; case SubRecordType.Name: fullName = reader.ReadString(size); break; case SubRecordType.RaceName: race = Record.GetRecord <Race>(reader.ReadString(size)); break; // Npc's have this even if they are part of no faction, so it needs to be checked if empty first case SubRecordType.Anam: string fac = reader.ReadString(size); faction = string.IsNullOrEmpty(fac) ? null : faction = Record.GetRecord <Faction>(fac); break; case SubRecordType.BodyName: head = BodyPartRecord.Get(reader.ReadString(size)); break; case SubRecordType.CreatureName: classId = Record.GetRecord <ClassRecord>(reader.ReadString(size)); break; case SubRecordType.KeyName: hair = BodyPartRecord.Get(reader.ReadString(size)); break; case SubRecordType.NpcData: npcData = new NpcRecordData(reader, size); break; case SubRecordType.Flag: npcFlags = (NpcFlags)reader.ReadInt32(); break; case SubRecordType.InventoryItem: items.Add(new InventoryItem(reader)); break; case SubRecordType.NpcSpell: spells.Add(Record.GetRecord <SpellRecord>(reader.ReadString(size))); break; case SubRecordType.AiData: aiData = new AiData(reader); break; case SubRecordType.AiWanderData: wanderData = new WanderData(reader); break; case SubRecordType.AiTravelData: travelData = new TravelData(reader); break; case SubRecordType.AiFollowData: followData = new FollowData(reader); break; case SubRecordType.AiEscortData: escortData = new EscortData(reader); break; case SubRecordType.ContainerData: cellEscortFollow = reader.ReadString(size); break; case SubRecordType.AiActivateData: activateData = new ActivateData(reader); break; case SubRecordType.DoorData: destinationData.Add(DoorExitData.Create(reader)); break; case SubRecordType.DoorName: destinations.Add(reader.ReadString(size)); break; case SubRecordType.Scale: scale = reader.ReadSingle(); break; case SubRecordType.Script: script = Script.Get(reader.ReadString(size)); break; } } }
private void OnGUI() { GUILayout.Label("Select character to edit"); selectedCharacter = EditorGUILayout.Popup(selectedCharacter, existingCharacterList.ToArray()); var currentCharacter = characterDataList[selectedCharacter]; if (previousCharacterSelection != selectedCharacter) { if (currentCharacter.JsonAiData == null) { currentCharacter.JsonAiData = string.Empty; } currentAi = JsonConvert.DeserializeObject <AiData>(currentCharacter.JsonAiData); if (currentAi == null) { currentAi = new AiData(); } if (currentAi.aiData == null) { currentAi.aiData = new List <CharacterAI>(); } previousCharacterSelection = selectedCharacter; } if (currentAi.aiData.Count <= 0) { GUILayout.Label("Data is empty"); } else { int index = 0; foreach (var ai in currentAi.aiData) { GUILayout.BeginHorizontal(); { GUILayout.Box(index.ToString()); GUILayout.Label("Target"); ai.Target = (AiTarget)EditorGUILayout.EnumPopup(ai.Target, GUILayout.Width(80f)); GUILayout.Label("Condition"); ai.ConditionToCheck = (Condition)EditorGUILayout.EnumPopup(ai.ConditionToCheck, GUILayout.Width(80f)); GUILayout.Label("Value1"); ai.ConditionValue1 = EditorGUILayout.IntField(ai.ConditionValue1, GUILayout.Width(100f)); GUILayout.Label("Value2"); ai.ConditionValue2 = EditorGUILayout.IntField(ai.ConditionValue2, GUILayout.Width(100f)); GUILayout.Label("Behavior"); ai.Behavior = (Behavior)EditorGUILayout.EnumPopup(ai.Behavior, GUILayout.Width(80f)); GUILayout.Label("BehaviorValue"); if (ai.Behavior == Behavior.UseSkill) { var popupList = currentCharacter.Skills.ToArray(); ai.BehaviorValue = EditorGUILayout.Popup(ai.BehaviorValue, popupList); } else { ai.BehaviorValue = EditorGUILayout.IntField(ai.BehaviorValue, GUILayout.Width(100f)); } } GUILayout.EndHorizontal(); ++index; } } if (GUILayout.Button("+", GUILayout.Width(50f), GUILayout.Height(20f))) { CharacterAI newAi = new CharacterAI(); currentAi.aiData.Add(newAi); } if (GUILayout.Button("Save", GUILayout.Width(200f), GUILayout.Height(40f))) { currentCharacter.JsonAiData = JsonConvert.SerializeObject(currentAi); } if (GUILayout.Button("Coroutine")) { EditorCoroutineUtility.StartCoroutine(CoroutineTest(), this); } }
private void OnGUI() { GUILayout.Label("Select charater to edit"); selectedCharacter = EditorGUILayout.Popup(selectedCharacter, existingCharacterList, GUILayout.Width(300f)); CharacterDataSO currentCharacter = characterDataList[selectedCharacter]; if (previousCharacterSelection != selectedCharacter) { if (currentCharacter.JsonAiData == null) { currentCharacter.JsonAiData = string.Empty; } currentAi = JsonConvert.DeserializeObject <AiData>(currentCharacter.JsonAiData); if (currentAi == null) { currentAi = new AiData(); } if (currentAi.aiData == null) { currentAi.aiData = new List <CharacterAI>(); } previousCharacterSelection = selectedCharacter; } if (currentAi.aiData.Count == 0) { GUILayout.Label("Ai data is empty"); } else { int index = 0; foreach (var preset in currentAi.aiData) { GUILayout.BeginHorizontal(); GUILayout.Box(index.ToString(), GUILayout.Width(20f)); GUILayout.Space(5f); GUILayout.Label("Target", GUILayout.Width(60f)); preset.Target = (AiTarget)EditorGUILayout.EnumPopup(preset.Target, GUILayout.Width(80f)); GUILayout.Space(10f); GUILayout.Label("Condition", GUILayout.Width(70f)); preset.ConditionToCheck = (Condition)EditorGUILayout.EnumPopup(preset.ConditionToCheck, GUILayout.Width(80f)); GUILayout.Space(10f); GUILayout.Label("Value 1", GUILayout.Width(50f)); preset.ConditionValue1 = EditorGUILayout.IntField(preset.ConditionValue1, GUILayout.MinWidth(100f), GUILayout.MaxWidth(100f)); GUILayout.Space(10f); GUILayout.Label("Value 2", GUILayout.Width(50f)); preset.ConditionValue2 = EditorGUILayout.IntField(preset.ConditionValue2, GUILayout.MinWidth(100f), GUILayout.MaxWidth(100f)); GUILayout.Space(10f); GUILayout.Label("Behavior", GUILayout.Width(80f)); preset.Behavior = (Behavior)EditorGUILayout.EnumPopup(preset.Behavior, GUILayout.Width(120f)); if (preset.Behavior == Behavior.UseSkill) { GUILayout.Label("BehaviorValue", GUILayout.Width(100f)); preset.BehaviorValue = EditorGUILayout.Popup(preset.BehaviorValue, currentCharacter.Skills.ToArray(), GUILayout.Width(100f)); } if (GUILayout.Button("-", GUILayout.Width(30f))) { deleteList.Add(preset); } GUILayout.EndHorizontal(); ++index; } } foreach (var presetToDelete in deleteList) { currentAi.aiData.Remove(presetToDelete); } if (GUILayout.Button("+", GUILayout.Width(50f))) { currentAi.aiData.Add(new CharacterAI() { Target = AiTarget.None, ConditionToCheck = Condition.None, Behavior = Behavior.None }); } if (GUILayout.Button("Save", GUILayout.Width(200f), GUILayout.Height(50f))) { currentCharacter.JsonAiData = JsonConvert.SerializeObject(currentAi); } }
public override void Initialize(System.IO.BinaryReader reader, RecordHeader header) { while (reader.BaseStream.Position < header.DataEndPos) { var type = (SubRecordType)reader.ReadInt32(); var size = reader.ReadInt32(); switch (type) { case SubRecordType.Id: name = reader.ReadString(size); break; case SubRecordType.Model: model = reader.ReadString(size); break; case SubRecordType.Name: fullName = reader.ReadString(size); break; case SubRecordType.Script: script = Script.Get(reader.ReadString(size)); break; case SubRecordType.AiData: aiData = new AiData(reader); break; case SubRecordType.AiActivateData: activateData = new ActivateData(reader); break; case SubRecordType.AiEscortData: escortData = new EscortData(reader); break; case SubRecordType.AiFollowData: followData = new FollowData(reader); break; case SubRecordType.AiTravelData: travelData = new TravelData(reader); break; case SubRecordType.AiWanderData: wanderData = new WanderData(reader); break; case SubRecordType.CreatureName: soundGeneratorName = reader.ReadString(size); break; case SubRecordType.InventoryItem: items.Add(new InventoryItem(reader)); break; case SubRecordType.NpcSpell: spells.Add(Record.GetRecord <SpellRecord>(reader.ReadString(size))); break; case SubRecordType.Scale: scale = reader.ReadSingle(); break; case SubRecordType.NpcData: data = new CreatureData(reader); break; case SubRecordType.Flag: flags = (CreatureFlags)reader.ReadInt32(); break; } } // Use the record id for sound generation if no SoundGeneratorName is specified if (soundGeneratorName == null) { soundGeneratorName = name; } }