public SetAgentActionSet(Agent agent, AnimationSystemData animationSystemData) { this.Agent = agent; this.ActionSet = animationSystemData.ActionSet; this.NumPaces = animationSystemData.NumPaces; this.MonsterUsageSetIndex = animationSystemData.MonsterUsageSetIndex; this.WalkingSpeedLimit = animationSystemData.WalkingSpeedLimit; this.CrouchWalkingSpeedLimit = animationSystemData.CrouchWalkingSpeedLimit; this.StepSize = animationSystemData.StepSize; }
public Skeleton CreateWithActionSet( ref AgentVisualsNativeData agentVisualsNativeData, ref AnimationSystemData animationSystemData) { NativeObjectPointer nativeObjectPointer = ScriptingInterfaceOfIMBSkeletonExtensions.call_CreateWithActionSetDelegate(ref agentVisualsNativeData, ref animationSystemData); Skeleton skeleton = (Skeleton)null; if (nativeObjectPointer.Pointer != UIntPtr.Zero) { skeleton = new Skeleton(nativeObjectPointer.Pointer); LibraryApplicationInterface.IManaged.DecreaseReferenceCount(nativeObjectPointer.Pointer); } return(skeleton); }
private void AddMount(bool isRiderAgentMounted = false) { this.RemoveMount(); HorseComponent horseComponent = this._equipment[10].Item.HorseComponent; Monster arg_39_0 = horseComponent.Monster; this._mountEntity = GameEntity.CreateEmpty(this._tableauScene, true); AnimationSystemData animationSystemData = arg_39_0.FillAnimationSystemData(MBGlobals.GetActionSet(horseComponent.Monster.ActionSetCode), 1f, false); AgentVisualsNativeData agentVisualsNativeData = arg_39_0.FillAgentVisualsNativeData(); this._mountEntity.CreateSkeletonWithActionSet(ref agentVisualsNativeData, ref animationSystemData); if (isRiderAgentMounted) { this._mountEntity.Skeleton.SetAgentActionChannel(0, (horseComponent.Monster.MonsterUsage == "camel") ? SpouseCharacterTableau.act_camel_stand : SpouseCharacterTableau.act_horse_stand, MBRandom.RandomFloat, -0.2f); } else { this._mountEntity.Skeleton.SetAgentActionChannel(0, SpouseCharacterTableau.act_inventory_idle_start, MBRandom.RandomFloat, -0.2f); } this._mountEntity.EntityFlags |= EntityFlags.AnimateWhenVisible; MountVisualCreator.AddMountMeshToEntity(this._mountEntity, this._equipment[10].Item, this._equipment[11].Item, this._mountCreationKey, null); this._mountEntity.SetFrame(ref this._mountSpawnPoint); }
public override Agent SpawnTroop(BattleSideEnum side, bool hasFormation, bool spawnWithHorse, bool isReinforcement, bool enforceSpawningOnInitialPoint, int formationTroopCount, int formationTroopIndex, bool isAlarmed, bool wieldInitialWeapons, bool forceDismounted = false, string specialActionSet = null, MatrixFrame?initFrame = null) { BasicCharacterObject troop = Troop; var team = IsUnderPlayersCommand ? Mission.Current.PlayerTeam : Mission.Current.PlayerEnemyTeam; MatrixFrame frame = initFrame ?? Mission.Current .GetFormationSpawnFrame(team.Side, FormationClass.NumberOfRegularFormations, false).ToGroundMatrixFrame(); if (SPCharacter.IsPlayer && !forceDismounted) { spawnWithHorse = true; } AgentBuildData agentBuildData = new AgentBuildData(this) .Team(team).Banner(Banner) .ClothingColor1(team.Color).ClothingColor2(team.Color2) .NoHorses(!spawnWithHorse).CivilianEquipment(Mission.Current.DoesMissionRequireCivilianEquipment); agentBuildData.IsFemale(SPCharacter.IsFemale); if (!SPCharacter.IsPlayer) { agentBuildData.IsReinforcement(isReinforcement).SpawnOnInitialPoint(enforceSpawningOnInitialPoint); } if (!hasFormation || SPCharacter.IsPlayer) { agentBuildData.InitialFrame(frame); } if (spawnWithHorse) { agentBuildData.MountKey(MountCreationKey.GetRandomMountKey( troop.Equipment[EquipmentIndex.ArmorItemEndSlot].Item, troop.GetMountKeySeed())); } if (hasFormation && !SPCharacter.IsPlayer) { Formation formation = team.GetFormation(SPCharacter.FormationIndex); agentBuildData.Formation(formation); agentBuildData.FormationTroopCount(formationTroopCount).FormationTroopIndex(formationTroopIndex); } if (SPCharacter.IsPlayer) { agentBuildData.Controller(Agent.ControllerType.Player); } if (troop.IsHero) { agentBuildData.Equipment(troop.GetFirstEquipment(agentBuildData.AgentCivilianEquipment).Clone(false)); } else { var equipmentModifierType = BattleConfig.Instance.BattleTypeConfig.EquipmentModifierType; var equipment = Equipment.GetRandomEquipmentElements(troop, equipmentModifierType == EquipmentModifierType.Random, agentBuildData.AgentCivilianEquipment, agentBuildData.AgentEquipmentSeed); if (equipmentModifierType == EquipmentModifierType.Average) { for (EquipmentIndex index = EquipmentIndex.Weapon0; index < EquipmentIndex.NumEquipmentSetSlots; ++index) { var equipmentElement = equipment.GetEquipmentFromSlot(index); if (equipmentElement.Item != null) { if (equipmentElement.Item.HasArmorComponent) { equipmentElement.SetModifier( Utility.AverageItemModifier(equipmentElement.Item.ArmorComponent .ItemModifierGroup)); } else if (equipmentElement.Item.HasHorseComponent) { equipmentElement.SetModifier( Utility.AverageItemModifier(equipmentElement.Item.HorseComponent .ItemModifierGroup)); } } } } agentBuildData.Equipment(equipment); } Agent agent = Mission.Current.SpawnAgent(agentBuildData, false, formationTroopCount); if (agent.IsAIControlled & isAlarmed) { agent.SetWatchState(AgentAIStateFlagComponent.WatchState.Alarmed); } if (wieldInitialWeapons) { agent.WieldInitialWeapons(); } if (!specialActionSet.IsStringNoneOrEmpty()) { AnimationSystemData animationSystemData = agentBuildData.AgentMonster.FillAnimationSystemData(MBGlobals.GetActionSet(specialActionSet), agent.Character.GetStepSize(), false); AgentVisualsNativeData agentVisualsNativeData = agentBuildData.AgentMonster.FillAgentVisualsNativeData(); agentBuildData.AgentMonster.FillAgentVisualsNativeData(); agent.SetActionSet(ref agentVisualsNativeData, ref animationSystemData); } return(agent); }
public override Agent SpawnTroop(BattleSideEnum side, bool hasFormation, bool spawnWithHorse, bool isReinforcement, bool enforceSpawningOnInitialPoint, int formationTroopCount, int formationTroopIndex, bool isAlarmed, bool wieldInitialWeapons, bool forceDismounted = false, string specialActionSet = null, MatrixFrame?initFrame = null) { BasicCharacterObject troop = Troop; var team = IsUnderPlayersCommand ? Mission.Current.PlayerTeam : Mission.Current.PlayerEnemyTeam; MatrixFrame frame = initFrame ?? Mission.Current .GetFormationSpawnFrame(team.Side, FormationClass.NumberOfRegularFormations, false).ToGroundMatrixFrame(); if (MPCharacter.IsPlayer && !forceDismounted) { spawnWithHorse = true; } AgentBuildData agentBuildData = new AgentBuildData(this).Team(team).Banner(Banner) .ClothingColor1(team.Color).ClothingColor2(team.Color2) .NoHorses(!spawnWithHorse).CivilianEquipment(Mission.Current.DoesMissionRequireCivilianEquipment); var equipment = Utility.GetNewEquipmentsForPerks(MPCharacter.HeroClass, MPCharacter.IsHero, MPCharacter.SelectedFirstPerk, MPCharacter.SelectedSecondPerk, MPCharacter.IsHero, Seed); agentBuildData.Equipment(equipment); agentBuildData.IsFemale(MPCharacter.IsFemale); if (!MPCharacter.IsPlayer) { agentBuildData.IsReinforcement(isReinforcement).SpawnOnInitialPoint(enforceSpawningOnInitialPoint); } if (!hasFormation || MPCharacter.IsPlayer) { agentBuildData.InitialFrame(frame); } if (spawnWithHorse) { agentBuildData.MountKey(MountCreationKey.GetRandomMountKey( troop.Equipment[EquipmentIndex.ArmorItemEndSlot].Item, troop.GetMountKeySeed())); } if (hasFormation && !MPCharacter.IsPlayer) { Formation formation = team.GetFormation(MPCharacter.FormationIndex); agentBuildData.Formation(formation); agentBuildData.FormationTroopCount(formationTroopCount).FormationTroopIndex(formationTroopIndex); } if (MPCharacter.IsPlayer) { agentBuildData.Controller(Agent.ControllerType.Player); } Agent agent = Mission.Current.SpawnAgent(agentBuildData, false, formationTroopCount); if (agent.IsAIControlled & isAlarmed) { agent.SetWatchState(AgentAIStateFlagComponent.WatchState.Alarmed); } if (wieldInitialWeapons) { agent.WieldInitialWeapons(); } if (!specialActionSet.IsStringNoneOrEmpty()) { AnimationSystemData animationSystemData = agentBuildData.AgentMonster.FillAnimationSystemData(MBGlobals.GetActionSet(specialActionSet), agent.Character.GetStepSize(), false); AgentVisualsNativeData agentVisualsNativeData = agentBuildData.AgentMonster.FillAgentVisualsNativeData(); agentBuildData.AgentMonster.FillAgentVisualsNativeData(); agent.SetActionSet(ref agentVisualsNativeData, ref animationSystemData); } return(agent); }
// Token: 0x060001BD RID: 445 RVA: 0x0000E03C File Offset: 0x0000C23C private GameEntity AddItem(Scene scene, ItemObject item, MatrixFrame itemFrame, MatrixFrame itemFrame1, MatrixFrame itemFrame2) { ItemRosterElement rosterElement = new ItemRosterElement(item, 0, null); MetaMesh itemMeshForInventory = rosterElement.GetItemMeshForInventory(false); if (item.IsCraftedWeapon) { MatrixFrame frame = itemMeshForInventory.Frame; frame.Elevate(-item.WeaponDesign.CraftedWeaponLength / 2f); itemMeshForInventory.Frame = frame; } GameEntity gameEntity = null; if (itemMeshForInventory != null && rosterElement.EquipmentElement.Item.ItemType == ItemObject.ItemTypeEnum.HandArmor) { gameEntity = GameEntity.CreateEmpty(scene, true); AnimationSystemData animationSystemData = Game.Current.HumanMonster.FillAnimationSystemData(MBGlobals.PlayerMaleActionSet, 1f, false); AgentVisualsNativeData agentVisualsNativeData = Game.Current.HumanMonster.FillAgentVisualsNativeData(); gameEntity.CreateSkeletonWithActionSet(ref agentVisualsNativeData, ref animationSystemData); gameEntity.SetFrame(ref itemFrame); gameEntity.Skeleton.SetAgentActionChannel(0, this.act_tableau_hand_armor_pose, 0f, -0.2f); gameEntity.AddMultiMeshToSkeleton(itemMeshForInventory); gameEntity.Skeleton.TickAnimationsAndForceUpdate(0.01f, itemFrame, true); } else if (itemMeshForInventory != null) { if (item.WeaponComponent != null) { WeaponClass weaponClass = item.WeaponComponent.PrimaryWeapon.WeaponClass; if (weaponClass == WeaponClass.ThrowingAxe || weaponClass == WeaponClass.ThrowingKnife || weaponClass == WeaponClass.Javelin || weaponClass == WeaponClass.Bolt) { gameEntity = GameEntity.CreateEmpty(scene, true); MetaMesh metaMesh = itemMeshForInventory.CreateCopy(); metaMesh.Frame = itemFrame; gameEntity.AddMultiMesh(metaMesh, true); MetaMesh metaMesh2 = itemMeshForInventory.CreateCopy(); metaMesh2.Frame = itemFrame1; gameEntity.AddMultiMesh(metaMesh2, true); MetaMesh metaMesh3 = itemMeshForInventory.CreateCopy(); metaMesh3.Frame = itemFrame2; gameEntity.AddMultiMesh(metaMesh3, true); } else { gameEntity = scene.AddItemEntity(ref itemFrame, itemMeshForInventory); } } else { gameEntity = scene.AddItemEntity(ref itemFrame, itemMeshForInventory); if (item.Type == ItemObject.ItemTypeEnum.HorseHarness && item.ArmorComponent != null) { MetaMesh copy = MetaMesh.GetCopy(item.ArmorComponent.ReinsMesh, true, true); if (copy != null) { gameEntity.AddMultiMesh(copy, true); } } } } else { MBDebug.ShowWarning("[DEBUG]Item with " + rosterElement.EquipmentElement.Item.StringId + "[DEBUG] string id cannot be found"); } gameEntity.SetVisibilityExcludeParents(false); return gameEntity; }