当前位置: 首页>>代码示例>>C#>>正文


C# Entity.BecomeDynamic方法代码示例

本文整理汇总了C#中BEPUphysics.Entities.Entity.BecomeDynamic方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.BecomeDynamic方法的具体用法?C# Entity.BecomeDynamic怎么用?C# Entity.BecomeDynamic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BEPUphysics.Entities.Entity的用法示例。


在下文中一共展示了Entity.BecomeDynamic方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BepuBody

		public BepuBody(Entity realBody)
		{
			RealBody = realBody;
			RealBody.Tag = -1;
			RealBody.BecomeDynamic((float)_mass);
			//RealBody.CollisionInformation.LocalPosition = new Vector3(0, 0, -10); //center of mass?
			BepuEntityCollidableToBepuBody.Add(realBody.CollisionInformation, this);
		 //TODO. fix after new bodies.
			/*   RealBody.CollisionInformation.Events.InitialCollisionDetected += 
			(thisBody, other, x)=>
				{
					if (other is EntityCollidable)
						Body.RaiseCollisionEvent(BepuEntityCollidableToBepuBody[other as EntityCollidable].Body);
				};*/
			//IsStatic = false;
		}
开发者ID:DmitryZyr,项目名称:CVARC,代码行数:16,代码来源:BepuBody.cs

示例2: tankCollision

        public void tankCollision(Entity sender, Entity other, CollisionPair pair)
        {
            var enemy = other.Tag as TriangleMesh;
            if (enemy != null)
            {
                 // Terrain was hit!
            }

            var enemy2 = other.Tag as Player; // Player tank was was hit!
            if (enemy2 != null)
            {
                if (!enemy2.EnemyCollision)
                    enemy2.tank.Velocity = -enemy2.tank.Velocity;
                enemy2.EnemyCollision = true;
            }

            var enemy3 = other.Tag as Enemy;
            if (enemy3 != null)
            {  } // Enemy was hit

            var enemy4 = other.Tag as Wall;
            if (enemy4 != null && (other.IsDynamic == false))
                other.BecomeDynamic(1f);
        }
开发者ID:ravduke,项目名称:Tank-Wars,代码行数:24,代码来源:Enemy.cs

示例3: EntityEntersVolume

        /// <summary>
        /// Handles what happens when an entity enters the wall's hit volume.
        /// If it's an enemy, boom!!
        /// </summary>
        /// <param name="toucher">Entity touching the volume.</param>
        /// <param name="volume">Volume being touched.</param>
        public void EntityEntersVolume(Entity sender, Entity other, CollisionPair pair)
        {
            var enemy = other.Tag as TriangleMesh;
            if (enemy != null)
            {
                // Terrain was hit!
            }

            var enemy2 = other.Tag as Player;
            if (enemy2 != null)
            {
                if (enemy2.Life < 100)  // Player tank caught heath package!
                {
                    space.Remove(body);
                    game.Components.Remove(this);
                    Random rand = new Random(0);
                     ;
                     enemy2.Life = Math.Min(100, enemy2.Life + (int)((float)rand.NextDouble() * 30f + 20f) );
                 }
            }
            var enemy3 = other.Tag as Enemy;
            if (enemy3 != null) // Enemy caught heath package!
            {
                if (enemy3.Life < 150)
                {
                    space.Remove(body);
                    game.Components.Remove(this);
                    Random rand = new Random(0);
                    enemy3.Life = Math.Min(150, enemy3.Life + Math.Min(150, enemy3.Life + (int)((float)rand.NextDouble() * 30f + 30f)));
                }
            }

            var enemy4 = other.Tag as Wall;
            if (enemy4 != null && (other.IsDynamic == false))
                other.BecomeDynamic(1f);

            var enemy5 = other.Tag as Building;
            if (enemy5 != null)
            {

            } // Church was hit, not nice
        }
开发者ID:ravduke,项目名称:Tank-Wars,代码行数:48,代码来源:Health.cs

示例4: tankCollision

        public void tankCollision(Entity sender, Entity other, CollisionPair pair)
        {
            var enemy = other.Tag as TriangleMesh;
            if (enemy != null)
            {
                // Terrain was hit!
            }

            var enemy2 = other.Tag as Player;
            if (enemy2 != null)
            {
                // Player tank was was hit!
            }

            var enemy3 = other.Tag as Enemy;
            if (enemy3 != null)
            {
                if (!player.EnemyCollision)
                    player.tank.Velocity = -player.tank.Velocity;
                player.EnemyCollision = true;
            } // Enemy was hit

            var enemy4 = other.Tag as Wall;
            if (enemy4 != null && (other.IsDynamic == false))
                other.BecomeDynamic(1f);

            var enemy5 = other.Tag as Building;
            if (enemy5 != null)
            {
                if (!player.EnemyCollision)
                    player.tank.Velocity = -player.tank.Velocity;
                player.EnemyCollision = true;
            }

            var enemy6 = other.Tag as HardWall;
            if (enemy6 != null)
            {
                if (!player.EnemyCollision)
                    player.tank.Velocity = -player.tank.Velocity;
                player.EnemyCollision = true;
            }
        }
开发者ID:ravduke,项目名称:Tank-Wars,代码行数:42,代码来源:Physics.cs


注:本文中的BEPUphysics.Entities.Entity.BecomeDynamic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。