コード例 #1
0
ファイル: TestBlock.cs プロジェクト: simonkwong/20GBsOf3DCP
 public void alertCollision(I_WorldObject collidedObject)
 {
     if (platformName == "ScareBlock")
     {
         suspenseMusicInstance.Stop();
         scaryImage.scare(0, 1);
         this.setAlive(false);
     }
 }
コード例 #2
0
        public void Update(GameTime gameTime)
        {
            if (!endScene)
            {
                // reset objects to add
                objectsToAdd = new List <I_WorldObject>();
                scareImg.update(gameTime);

                camera.Update(gameTime);
                scrollBackground();


                musichandler();

                if (once == 0)
                {
                    checkforenter();
                }

                if (time == 0)
                {
                    updatetext();
                    time = 8;
                }
                else
                {
                    time--;
                }


                if (storyflip == false && gamemenu == false)
                {
                    // update worldObject's logic
                    foreach (I_WorldObject x in worldtextObjects)
                    {
                        x.Update(gameTime);
                    }
                }
                else
                {
                    foreach (I_WorldObject x in worldObjects)
                    {
                        x.Update(gameTime);

                        int level_before = WorldData.level;

                        if (x.getName() == "Jordan" || x.getName() == "Simon" || x.getName() == "Adam" || x.getName() == "fire particle")
                        {
                            x.setNode(qt.UpdateLocation(x, x.getNode()));
                            checkCollisions(x);
                        }


                        if (!x.isAlive())
                        {
                            x.getNode().RemoveElement(x);
                        }
                        else
                        {
                            x.setNode(qt.UpdateLocation(x, x.getNode()));
                        }



                        checkForAliveness(x, toDelete);

                        int level_after = WorldData.level;

                        if (level_before != level_after)
                        {
                            Console.WriteLine("NEW LEVEL EVENT OCCURED");
                            WorldData.newLevelEvent = true;



                            // level that end scene occurs
                            if (WorldData.level == 3)
                            {
                                endScene = true;
                                MediaPlayer.Stop();

                                scareImg.scare(1, 100000);
                            }
                            else
                            {
                                init_everything();
                                LoadContent(content);
                            }
                        }
                    }

                    // add the objects
                    foreach (I_WorldObject z in objectsToAdd)
                    {
                        worldObjects.Add(z);
                    }

                    foreach (I_WorldObject z in toDelete)
                    {
                        worldObjects.Remove(z);
                    }
                }
            }
        }