public MapAtmosphereProbe()
 {
     this.hideAllProbes = MapAtmosphereProbe.hideAllProbesStatic;
     if (!MBEditor.IsEditModeOn)
     {
         return;
     }
     this.innerSphereMesh = MetaMesh.GetCopy("physics_sphere_detailed");
     this.outerSphereMesh = MetaMesh.GetCopy("physics_sphere_detailed");
     this.innerSphereMesh.SetMaterial(Material.GetFromResource("light_radius_visualizer"));
     this.outerSphereMesh.SetMaterial(Material.GetFromResource("light_radius_visualizer"));
 }
 public override int GetHashCode()
 {
     return(GetType().GetHashCode() ^
            (Layout != null ? Layout.GetHashCode() : 1) ^
            (MeshDescription != null ? MeshDescription.GetHashCode() : 1) ^
            (MetaMesh != null ? MetaMesh.GetHashCode() : 1) ^
            (Mesh != null ? Mesh.GetHashCode() : 1) ^
            (XMesh != null ? XMesh.GetHashCode() : 1) ^
            (MetaXMesh != null ? MetaXMesh.GetHashCode() : 1) ^
            XMeshFlags.GetHashCode() ^
            Pool.GetHashCode());
 }
예제 #3
0
        private void CameraLogicInit()
        {
            this.MissionScreen.MouseVisible            = true;
            this.MissionScreen.SceneLayer.ActiveCursor = CursorType.Default;



            this._camera = Camera.CreateCamera();


            this._cameraFrame       = MatrixFrame.Identity;
            this._idealCameraTarget = _cameraFrame.origin;
            this._cursor            = GameEntity.CreateEmpty(this.Mission.Scene);
            this._cursor.AddComponent((GameEntityComponent)MetaMesh.GetCopy("order_arrow_a", true, false));
        }
        private void SetMeshParams()
        {
            MetaMesh metaMesh = this.GameEntity.GetMetaMesh(0);

            if (!((NativeObject)metaMesh != (NativeObject)null))
            {
                return;
            }
            uint factor1 = this.CalculateFactor(new Vec3(this.DirectLightRed, this.DirectLightGreen, this.DirectLightBlue), this.DirectLightIntensity);

            metaMesh.SetFactor1Linear(factor1);
            uint factor2 = this.CalculateFactor(new Vec3(this.AmbientLightRed, this.AmbientLightGreen, this.AmbientLightBlue), this.AmbientLightIntensity);

            metaMesh.SetFactor2Linear(factor2);
            metaMesh.SetVectorArgument(this.Flatness_X, this.Flatness_Y, this.Flatness_Z, 1f);
        }
예제 #5
0
        protected override void UpdateAmmoMesh()
        {
            int num = 8 - this.AmmoCount;

            foreach (GameEntity child in this.GameEntity.GetChildren())
            {
                for (int metaMeshIndex = 0; metaMeshIndex < child.MultiMeshComponentCount; ++metaMeshIndex)
                {
                    MetaMesh metaMesh = child.GetMetaMesh(metaMeshIndex);
                    for (int meshIndex = 0; meshIndex < metaMesh.MeshCount; ++meshIndex)
                    {
                        metaMesh.GetMeshAtIndex(meshIndex).SetVectorArgument(0.0f, (float)num, 0.0f, 0.0f);
                    }
                }
            }
        }
예제 #6
0
        protected internal override void OnTick(float dt)
        {
            if ((double)dt == 0.0)
            {
                return;
            }
            MatrixFrame globalFrame = this.GameEntity.GetGlobalFrame();
            MetaMesh    metaMesh    = this.GameEntity.GetMetaMesh(0);

            if ((NativeObject)metaMesh == (NativeObject)null)
            {
                return;
            }
            Vec3 vec3_1 = globalFrame.origin - this._prevFlagMeshFrame;

            vec3_1.x /= dt;
            vec3_1.y /= dt;
            vec3_1.z /= dt;
            Vec3 vec3_2 = new Vec3(20f, z: -10f) * 0.1f - vec3_1;

            if ((double)vec3_2.LengthSquared < 9.99999993922529E-09)
            {
                return;
            }
            Vec3 local = globalFrame.rotation.TransformToLocal(vec3_2);

            local.z = 0.0f;
            double num1  = (double)local.Normalize();
            float  theta = (float)Math.Atan2((double)local.y, (double)local.x);

            this.SmoothTheta(ref theta, dt);
            Vec3        scaleVector = metaMesh.Frame.rotation.GetScaleVector();
            MatrixFrame identity    = MatrixFrame.Identity;

            identity.Scale(scaleVector);
            identity.rotation.RotateAboutUp(theta);
            this._prevTheta = theta;
            float num2 = this._prevSkew + Math.Min((float)Math.Acos((double)Vec3.DotProduct(vec3_2, globalFrame.rotation.u) / (double)vec3_2.Length) - this._prevSkew, 150f * dt) * 0.05f;

            this._prevSkew = num2;
            float num3 = MBMath.ClampFloat(vec3_2.Length, 1f / 1000f, 10000f);

            this._time             += (float)((double)dt * (double)num3 * 0.5);
            metaMesh.Frame          = identity;
            metaMesh.VectorUserData = new Vec3((float)Math.Cos((double)num2), 1f - (float)Math.Sin((double)num2), w: this._time);
            this._prevFlagMeshFrame = globalFrame.origin;
        }
예제 #7
0
        private void UpdatePathMesh()
        {
            this.pathEntity.ClearComponents();
            this.pathMesh = MetaMesh.CreateMetaMesh();
            Material fromResource = Material.GetFromResource(this.materialName);

            if ((NativeObject)fromResource != (NativeObject)null)
            {
                this.pathMesh.SetMaterial(fromResource);
            }
            else
            {
                this.pathMesh.SetMaterial(Material.GetDefaultMaterial());
            }
            this.pathEntity.AddMultiMesh(this.pathMesh);
            this.pathMesh.SetVectorArgument2(this.textureSweepX, this.textureSweepY, 0.0f, 0.0f);
        }
예제 #8
0
        protected virtual void UpdateAmmoMesh()
        {
            int num = 20 - this.AmmoCount;

            if (!((NativeObject)this.GameEntity != (NativeObject)null))
            {
                return;
            }
            for (int metaMeshIndex = 0; metaMeshIndex < this.GameEntity.MultiMeshComponentCount; ++metaMeshIndex)
            {
                MetaMesh metaMesh = this.GameEntity.GetMetaMesh(metaMeshIndex);
                for (int meshIndex = 0; meshIndex < metaMesh.MeshCount; ++meshIndex)
                {
                    metaMesh.GetMeshAtIndex(meshIndex).SetVectorArgument(0.0f, (float)num, 0.0f, 0.0f);
                }
            }
        }
        private void SetMeshParameters()
        {
            MetaMesh metaMesh = this.GameEntity.GetMetaMesh(0);

            if (!((NativeObject)metaMesh != (NativeObject)null))
            {
                return;
            }
            metaMesh.SetVectorArgument(this.Flatness_X, this.Flatness_Y, this.Flatness_Z, this.Alpha);
            if (this.Is_Dark_Light)
            {
                metaMesh.SetVectorArgument2(1f, 0.0f, 0.0f, 0.0f);
            }
            else
            {
                metaMesh.SetVectorArgument2(0.0f, 0.0f, 0.0f, 0.0f);
            }
        }
예제 #10
0
 public void AddHorseReinsClothMesh(MetaMesh reinMesh, MetaMesh ropeMesh) => MBAPI.IMBAgentVisuals.AddHorseReinsClothMesh(this.Pointer, reinMesh.Pointer, ropeMesh.Pointer);
예제 #11
0
 public void AddMultiMesh(MetaMesh metaMesh, BodyMeshTypes bodyMeshIndex) => MBAPI.IMBAgentVisuals.AddMultiMesh(this.GetPtr(), metaMesh.Pointer, (int)bodyMeshIndex);
예제 #12
0
 public static void RenderEditorMesh(MetaMesh mesh, MatrixFrame frame) => MBAPI.IMBEditor.RenderEditorMesh(mesh.Pointer, ref frame);
예제 #13
0
		// 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;
		}