Пример #1
0
        public void CheckCollision(Lane[] lanes, Camera camera, int current)
        {
            for (int i = 0; i < characters.Length; i++)
            {
                if (characters[i] != null && !characters[i].isInvulnerable)
                {
                    int checkingDepth = 10;
                    int limit = lanes[i].obstacles.Count;
                    if (limit > checkingDepth)
                        limit = checkingDepth;

                    for (int j = 0; j < limit; j++)
                    {
                        Obstacle obstacle = lanes[i].obstacles[current + j];
                        if (obstacle.Collides(characters[i].position, characters[i].collisionSize, camera.Position.X))
                        {
                            if (obstacle.Type == ObstacleType.Breakable &&
                                characters[i].CurrentAction == Character.Action.Slash)
                            {
                                var breakable = (BreakableObstacle)obstacle;
                                breakable.IsExploding = true;
                            }
                            else
                            {
                                characters[i].CurrentAction = Character.Action.Knockback;
                                soundBank.PlayCue("Collision");
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        public override void LoadContent(ContentManager Content)
        {
            //theme = Content.Load<Song>(@"Lumberjack Bustle\BennyHillTheme");
            //victory = Content.Load<Song>(@"Lumberjack Bustle\ff4victory");

            instruction.Load(Content);

            background = Content.Load<Texture2D>("Lumberjack Bustle/forestBackground");
            background = Content.Load<Texture2D>("Lumberjack Bustle/ffBackground");
            countdown = Content.Load<Texture2D>("Lumberjack Bustle/Countdown");
            finish = Content.Load<Texture2D>("Lumberjack Bustle/finishline");
            blackHole = Content.Load<Texture2D>("Lumberjack Bustle/blackHole");

            //countdown = Content.Load<Texture2D>("Lumberjack Bustle/treeBackground.png");
            font = Content.Load<SpriteFont>("Score");
            seconds = 3;
            started = false;

            lanes = new Lane[4];
            for (int i = 0; i < NUM_PLAYERS; i++)
            {
                lanes[i] = new Lane();
                lanes[i].Initialize(new Vector2(0, i * Lane.HEIGHT), background, finish);
            }

            InitializeLanes(Content);

            playerManager.LoadContent(Content, START);
            currentObstacle = 0;
        }