コード例 #1
0
ファイル: World.cs プロジェクト: mueschm/Spirit-Force
 /// <summary>
 /// 
 /// </summary>
 /// <param name="player">The player seen on the screen</param>
 public World(ContentManager content, String startMap, int offsetX, int offsetY)
 {
     this.offsetX = offsetX;
     this.offsetY = offsetY;
     this.content = content;
     SpiritForce.TheWorld.Controller.init();
     eventsTriggered = new List<String>();
     loadMap(startMap);
     allowControl = true;
     narrativeTime = false;
     currentNarrative = null;
     font = content.Load<SpriteFont>("Font1");
 }
コード例 #2
0
ファイル: World.cs プロジェクト: mueschm/Spirit-Force
 public void update(GameTime gameTime)
 {
     this.map.update(gameTime);
     if(allowControl)
         checkEvents(false);
     if (narrativeTime)
     {
         currentNarrative.update(gameTime);
         if (currentNarrative.isDone())
         {
             currentNarrative = null;
             narrativeTime = false;
             allowControl = true;
         }
     }
 }
コード例 #3
0
ファイル: World.cs プロジェクト: mueschm/Spirit-Force
 public void doEvent(String command, bool mapJustLoaded)
 {
     String[] c = command.Split(' ');
     if (c[0] == "Map")
     {
         loadMap(c[1]);
         delayDraw = 40;
         alreadyDelayed = 0;
         allowControl = false;
     }
     else if (c[0] == "Move")
     {
         map.getSprite(c[1]).setPosX(System.Convert.ToInt32(c[2]));
         map.getSprite(c[1]).setPosY(System.Convert.ToInt32(c[3]));
     }
     else if (c[0] == "Increment")
     {
         checkObjectCollision(map.getSprite(c[1]), System.Convert.ToInt32(c[2]), System.Convert.ToInt32(c[3]));
     }
     else if (c[0] == "Remove")
     {
         map.removeSprite(c[1]);
     }
     else if (c[0] == "Narrative")
     {
         currentNarrative = this.map.getNarrative(c[1]);
         this.allowControl = false;
         this.narrativeTime = true;
     }
     else if (c[0] == "Play" && !mapJustLoaded)
     {
         this.map.getSound(c[1]).Play();
     }
     else if (c[0] == "Music")
     {
         SpiritForce.TheWorld.Music.play(this.map.getMusic(c[1]));
     }
     else if (c[0] == "Animation")
     {
         if (this.map.getSprite(c[1]).getAnimation().getIdentifier() != c[2])
             this.map.getSprite(c[1]).setAnimation(this.map.getAnimation(c[2]).copy());
     }
     else if (c[0] == "AnimationState")
     {
         this.map.getSprite(c[1]).getAnimation().setEnabled(c[2].Equals("Enable"));
     }
     else if (c[0] == "Particle")
     {
         this.map.addEmitter(c[1]);
     }
 }