public DeploymentPoint.DeploymentPointState GetDeploymentPointState() { switch (this._deploymentPointType) { case DeploymentPoint.DeploymentPointType.BatteringRam: return(!this.IsDeployed ? DeploymentPoint.DeploymentPointState.NotDeployed : DeploymentPoint.DeploymentPointState.BatteringRam); case DeploymentPoint.DeploymentPointType.TowerLadder: return(!this.IsDeployed ? DeploymentPoint.DeploymentPointState.SiegeLadder : DeploymentPoint.DeploymentPointState.SiegeTower); case DeploymentPoint.DeploymentPointType.Breach: return(DeploymentPoint.DeploymentPointState.Breach); case DeploymentPoint.DeploymentPointType.Ranged: return(!this.IsDeployed ? DeploymentPoint.DeploymentPointState.NotDeployed : DeploymentPoint.DeploymentPointState.Ranged); default: MBDebug.ShowWarning("Undefined deployment point type fetched."); return(DeploymentPoint.DeploymentPointState.NotDeployed); } }
void IDebugManager.ShowWarning(string message) => MBDebug.ShowWarning(message);
public static Mesh CreateBoundaryMesh( Scene scene, ICollection <Vec2> boundaryPoints, uint meshColor = 536918784) { if (boundaryPoints == null || boundaryPoints.Count < 3) { return((Mesh)null); } Mesh mesh = Mesh.CreateMesh(); UIntPtr num = mesh.LockEditDataWrite(); Vec3 min; Vec3 max; scene.GetBoundingBox(out min, out max); max.z += 50f; min.z -= 50f; for (int index = 0; index < boundaryPoints.Count; ++index) { Vec2 point1 = boundaryPoints.ElementAt <Vec2>(index); Vec2 point2 = boundaryPoints.ElementAt <Vec2>((index + 1) % boundaryPoints.Count); float height1 = 0.0f; float height2 = 0.0f; if (!scene.IsAtmosphereIndoor) { if (!scene.GetHeightAtPoint(point1, BodyFlags.CommonCollisionExcludeFlagsForCombat, ref height1)) { MBDebug.ShowWarning("GetHeightAtPoint failed at CreateBoundaryEntity!"); return((Mesh)null); } if (!scene.GetHeightAtPoint(point2, BodyFlags.CommonCollisionExcludeFlagsForCombat, ref height2)) { MBDebug.ShowWarning("GetHeightAtPoint failed at CreateBoundaryEntity!"); return((Mesh)null); } } else { height1 = min.z; height2 = min.z; } Vec3 vec3_1 = point1.ToVec3(height1); Vec3 vec3_2 = point2.ToVec3(height2); Vec3 vec3_3 = Vec3.Up * 2f; Vec3 vec3_4 = vec3_1; Vec3 vec3_5 = vec3_2; Vec3 vec3_6 = vec3_1; Vec3 vec3_7 = vec3_2; vec3_4.z = Math.Min(vec3_4.z, min.z); vec3_5.z = Math.Min(vec3_5.z, min.z); vec3_6.z = Math.Max(vec3_6.z, max.z); vec3_7.z = Math.Max(vec3_7.z, max.z); Vec3 p1 = vec3_4 - vec3_3; Vec3 p2 = vec3_5 - vec3_3; vec3_6 += vec3_3; Vec3 p3 = vec3_7 + vec3_3; mesh.AddTriangle(p1, p2, vec3_6, Vec2.Zero, Vec2.Side, Vec2.Forward, meshColor, num); mesh.AddTriangle(vec3_6, p2, p3, Vec2.Forward, Vec2.Side, Vec2.One, meshColor, num); } mesh.SetMaterial("editor_map_border"); mesh.VisibilityMask = VisibilityMaskFlags.Final | VisibilityMaskFlags.EditModeBorders; mesh.SetColorAlpha(150U); mesh.SetMeshRenderOrder(250); mesh.CullingMode = MBMeshCullingMode.None; float vectorArgument0 = 25f; if (MBEditor.IsEditModeOn && scene.IsEditorScene()) { vectorArgument0 = 100000f; } IEnumerable <GameEntity> entitiesWithTag = scene.FindEntitiesWithTag("walk_area_vertex"); float vectorArgument1 = entitiesWithTag.Count <GameEntity>() > 0 ? entitiesWithTag.Average <GameEntity>((Func <GameEntity, float>)(ent => ent.GlobalPosition.z)) : 0.0f; mesh.SetVectorArgument(vectorArgument0, vectorArgument1, 0.0f, 0.0f); mesh.ComputeNormals(); mesh.ComputeTangents(); mesh.RecomputeBoundingBox(); mesh.UnlockEditDataWrite(num); return(mesh); }
// 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; }