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


C# Models.getRock方法代码示例

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


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

示例1: collisionDetection

        public void collisionDetection(ref Models.Gameworld gameWorld, Vector2 movementVector, Vector2 rightStick, GameTime gameTime)
        {
            rockCollisionIndex.Clear();
            rockProjectileCollisions.Clear();

            enemyCollisionIndex.Clear();
            enemyProjectileCollisions.Clear();

            playerProjectileCollisions.Clear();
            projectileCollisionsIndex.Clear();
            checkPlayerProjectileCollisions(gameWorld);

            checkEnemyProjectileCollisions(gameWorld);

            playerCollisions(gameWorld, movementVector, rightStick, gameTime);

            bounceThoseRocks(gameWorld.getRock());
        }
开发者ID:ProfChaos,项目名称:StudentGame,代码行数:18,代码来源:PhysicsEngine.cs

示例2: checkPlayerProjectileCollisions

        private void checkPlayerProjectileCollisions(Models.Gameworld gameWorld)
        {
            List<int> collidedProjectileIndexes = new List<int>();

            bool flaggBecauseFuckYouThatsWhy = false;

            for (int i = 0; i < gameWorld.getPlayer().BulletList.Count; i++)
            {
                flaggBecauseFuckYouThatsWhy = false;
                for (int j = 0; j < gameWorld.getRock().Count; j++)
                {
                    if (gameWorld.getRock()[j].BoundingBox.Intersects(gameWorld.getPlayer().BulletList[i].BoundingBox))
                    {
                        if (perPixelCollisionDetection(gameWorld.getPlayer().BulletList[i],
                                                        gameWorld.getRock()[j]))
                        {
                            collidedProjectileIndexes.Add(i);
                            rockCollisionIndex.Add(j);
                            rockProjectileCollisions.Add(gameWorld.getPlayer().BulletList[i]);
                            rockProjectileCollisions.Add(gameWorld.getRock()[j]);
                            flaggBecauseFuckYouThatsWhy = true;

                        }
                    }
                    if (flaggBecauseFuckYouThatsWhy) break;
                }
                if (!flaggBecauseFuckYouThatsWhy)
                {
                    for (int l = 0; l < gameWorld.EnemyList.Count; l++)
                    {
                        if (gameWorld.EnemyList[l].BoundingBox.Intersects(gameWorld.getPlayer().BulletList[i].BoundingBox))
                        {
                            if (perPixelCollisionDetection(gameWorld.getPlayer().BulletList[i],
                                                            gameWorld.EnemyList[l]))
                            {

                                collidedProjectileIndexes.Add(i);
                                enemyCollisionIndex.Add(l);
                                enemyProjectileCollisions.Add(gameWorld.getPlayer().BulletList[i]);
                                enemyProjectileCollisions.Add(gameWorld.EnemyList[l]);
                                flaggBecauseFuckYouThatsWhy = true;
                            }
                        }
                        if (flaggBecauseFuckYouThatsWhy) break;
                    }
                }
            }

            //Remove collided projectiles.

            if (collidedProjectileIndexes.Count > 0)
            {
                collidedProjectileIndexes.Sort();

                //for (int i = 0; i < collidedProjectileIndexes.Count; i++)
                for (int i = collidedProjectileIndexes.Count - 1; i >= 0; i--)
                {
                    gameWorld.getPlayer().BulletList.RemoveAt(collidedProjectileIndexes[i]);
                }
            }
        }
开发者ID:ProfChaos,项目名称:StudentGame,代码行数:61,代码来源:PhysicsEngine.cs

示例3: playerCollisions

        //Checks for collisions on the Player.
        private void playerCollisions(Models.Gameworld gameWorld, Vector2 movementVector, Vector2 rightStick, GameTime gameTime)
        {
            Vector2 prePosition = gameWorld.getPlayer().Position;

            gameWorld.getPlayer().update(movementVector, rightStick, gameTime);

            //for (int i = 0; i < gameWorld.getRock().Count(); i++)
            foreach (Models.Collidable rock in gameWorld.getRock())
            {
                if (rock.BoundingBox.Intersects(gameWorld.getPlayer().BoundingBox))
                {
                    if (perPixelCollisionDetection(gameWorld.getPlayer(), rock))
                    {

                        gameWorld.getPlayer().Position = new Vector2(prePosition.X, prePosition.Y);
                        //gameWorld.getPlayer().Velocity = (Vector2.Zero);

                        knockback(gameWorld.PlayerObject, rock);
                        break;
                    }
                }
            }

            levelBoundCollision(gameWorld, prePosition);
        }
开发者ID:ProfChaos,项目名称:StudentGame,代码行数:26,代码来源:PhysicsEngine.cs

示例4: handleProjectileCollisions

        public void handleProjectileCollisions(Models.Gameworld gameWorld)
        {
            List<int> rockCollisionsIndex                       = physicsEngine.RockCollisionIndexes;
            List<int> enemyCollisionsIndex                      = physicsEngine.EnemyCollisionIndexes;
            List<Models.GameObject> rockProjectileCollisions    = physicsEngine.getRockProjectileCollisions();
            List<Models.GameObject> enemyProjectileCollisions   = physicsEngine.getEnemyProjectileCollisions();
            Models.Projectile projectile                        = null;

            int damage;

            if (rockProjectileCollisions.Count != 0)
            {
                for (int i = 0; i < rockProjectileCollisions.Count; i++)
                {
                    projectile = (Models.Projectile)rockProjectileCollisions[i++];
                    damage = projectile.Damage;

                    rockProjectileCollisions[i].updateCurrentHealth(- damage);

                    spawnExplosionParticles(projectile, projectile, gameWorld.getParticleSystem());

                    physicsEngine.collisionUsingAllKindaCrazyStuff(rockProjectileCollisions[i], projectile);

                }
                for (int i = 0; i < rockCollisionsIndex.Count; i++)
                {
                    if (gameWorld.getRock()[rockCollisionsIndex[i]].CurrentHealth <= 0)
                    {
                        spawnExplosionParticles(gameWorld.getRock()[rockCollisionsIndex[i]], projectile, gameWorld.getParticleSystem());
                        soundManager.playSoundWithPositioning("explosion", gameWorld.PlayerObject, gameWorld.getRock()[rockCollisionsIndex[i]]);
                        gameWorld.getRock().RemoveAt(rockCollisionsIndex[i]);
                    }
                }
            }

            if(enemyProjectileCollisions.Count != 0)
            {
                for (int i = 0; i < enemyProjectileCollisions.Count; i++)
                {
                    projectile = (Models.Projectile)enemyProjectileCollisions[i];
                    i++;
                    damage = projectile.Damage;

                    enemyProjectileCollisions[i].updateCurrentHealth(-damage);
                    spawnExplosionParticles(projectile, projectile, gameWorld.getParticleSystem());

                }
                for (int i = enemyCollisionsIndex.Count -1; i >= 0; i--)
                {
                    if (gameWorld.EnemyList[enemyCollisionsIndex[i]].CurrentHealth <= 0)
                    {
                        spawnExplosionParticles(gameWorld.EnemyList[enemyCollisionsIndex[i]], projectile, gameWorld.getParticleSystem());
                        soundManager.playSoundWithPositioning("explosion", gameWorld.PlayerObject, gameWorld.EnemyList[enemyCollisionsIndex[i]]);
                        gameWorld.Score += gameWorld.EnemyList[enemyCollisionsIndex[i]].MaxHealth;
                        gameWorld.EnemyList.RemoveAt(enemyCollisionsIndex[i]);
                    }
                }
            }
        }
开发者ID:ProfChaos,项目名称:StudentGame,代码行数:59,代码来源:Controller.cs


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