Exemple #1
0
 public new void Update(GameTime gameTime, OWPlayer player)
 {
     base.Update(gameTime, player);
     if (movement.trigger == Movement.Trigger.AUTO)
     {
         RunEventCommand(script, player);
     }
     if (movement.trigger == Movement.Trigger.TOUCH)
     {
         bool touching = (player.travel.X == 0 && player.travel.Y == 0 && player.GetMapPos()[Character.Z] == mapZ && (
                              (player.GetDir() == Tile.Direction.NORTH && player.GetMapPos()[Character.X] == mapX && player.GetMapPos()[Character.Y] == mapY - 1) ||
                              (player.GetDir() == Tile.Direction.SOUTH && player.GetMapPos()[Character.X] == mapX && player.GetMapPos()[Character.Y] == mapY + 1) ||
                              (player.GetDir() == Tile.Direction.EAST && player.GetMapPos()[Character.X] == mapX - 1 && player.GetMapPos()[Character.Y] == mapY) ||
                              (player.GetDir() == Tile.Direction.WEST && player.GetMapPos()[Character.X] == mapX + 1 && player.GetMapPos()[Character.Y] == mapY)));
         if (!touching)
         {
             touching = false;
         }
         if (touching && !touched)
         {
             touched = true;
             RunEventCommand(script, player);
         }
     }
     if (!Global.action.dialog.visible)
     {
         sentRun = false;
     }
     if (!sentRun)
     {
         UpdateMovement(gameTime);
     }
 }
Exemple #2
0
 public void RunEventCommand(EventCommands commands, OWPlayer player)
 {
     if (movement.turnable)
     {
         if (player.GetDir() == Tile.Direction.NORTH)
         {
             SetDir(Tile.Direction.SOUTH);
         }
         else if (player.GetDir() == Tile.Direction.SOUTH)
         {
             SetDir(Tile.Direction.NORTH);
         }
         else if (player.GetDir() == Tile.Direction.EAST)
         {
             SetDir(Tile.Direction.WEST);
         }
         else if (player.GetDir() == Tile.Direction.WEST)
         {
             SetDir(Tile.Direction.EAST);
         }
     }
     sentRun = true;
     commands(player);
 }
 public void UpdateTrigger(OWPlayer player)
 {
     if (player.GetMapPos()[Character.Z] == mapZ && (((dir == Tile.Direction.NORTH || dir == Tile.Direction.SOUTH) && player.GetMapPos()[Character.X] == mapX) || (dir == Tile.Direction.WEST && player.GetMapPos()[Character.X] + 1 == mapX) || (dir == Tile.Direction.EAST && player.GetMapPos()[Character.X] - 1 == mapX)) && (((dir == Tile.Direction.WEST || dir == Tile.Direction.EAST) && player.GetMapPos()[Character.Y] == mapY) || (dir == Tile.Direction.NORTH && player.GetMapPos()[Character.Y] - 1 == mapY) || (dir == Tile.Direction.SOUTH && player.GetMapPos()[Character.Y] + 1 == mapY)))
     {
         state = 1;
     }
     else
     {
         state = -1;
     }
     if (player.GetMapPos()[Character.X] == mapX && player.GetMapPos()[Character.Y] == mapY && player.GetMapPos()[Character.Z] == mapZ && ((player.GetDir() == Tile.Direction.NORTH && dir == Tile.Direction.SOUTH) || (player.GetDir() == Tile.Direction.SOUTH && dir == Tile.Direction.NORTH) || (player.GetDir() == Tile.Direction.EAST && dir == Tile.Direction.WEST) || (player.GetDir() == Tile.Direction.WEST && dir == Tile.Direction.EAST)))
     {
         state = -1;
         Global.action.SetTileMap(mapDestKey, destPos, (playerDir != Tile.Direction.NONE)?playerDir:player.GetDir());
         player.Move(playerDir);
     }
     if (player.GetDir() == dir && player.GetMapPos()[Character.X] == mapX && player.GetMapPos()[Character.Y] == mapY && player.GetMapPos()[Character.Z] == mapZ)
     {
         state = 1;
     }
 }
 public void UpdateTrigger(OWPlayer player)
 {
     if (player.GetMapPos()[Character.Z] == mapZ && (((dir == Tile.Direction.NORTH || dir == Tile.Direction.SOUTH) && player.GetMapPos()[Character.X] == mapX) || (dir == Tile.Direction.WEST && player.GetMapPos()[Character.X] + 1 == mapX) || (dir == Tile.Direction.EAST && player.GetMapPos()[Character.X] - 1 == mapX)) && (((dir == Tile.Direction.WEST || dir == Tile.Direction.EAST) && player.GetMapPos()[Character.Y] == mapY) || (dir == Tile.Direction.NORTH && player.GetMapPos()[Character.Y] - 1 == mapY) || (dir == Tile.Direction.SOUTH && player.GetMapPos()[Character.Y] + 1 == mapY)))
     {
         state = 1;
     }else{
         state = -1;
     }
     if (player.GetMapPos()[Character.X] == mapX && player.GetMapPos()[Character.Y] == mapY && player.GetMapPos()[Character.Z] == mapZ && ((player.GetDir() == Tile.Direction.NORTH && dir == Tile.Direction.SOUTH) || (player.GetDir() == Tile.Direction.SOUTH && dir == Tile.Direction.NORTH) || (player.GetDir() == Tile.Direction.EAST && dir == Tile.Direction.WEST) || (player.GetDir() == Tile.Direction.WEST && dir == Tile.Direction.EAST)))
     {
         state = -1;
         Global.action.SetTileMap(mapDestKey, destPos, (playerDir != Tile.Direction.NONE)?playerDir:player.GetDir());
         player.Move(playerDir);
     }
     if (player.GetDir() == dir && player.GetMapPos()[Character.X] == mapX && player.GetMapPos()[Character.Y] == mapY && player.GetMapPos()[Character.Z] == mapZ)
     {
         state = 1;
     }
 }
 public void RunEventCommand(EventCommands commands, OWPlayer player)
 {
     if (movement.turnable){
         if (player.GetDir() == Tile.Direction.NORTH)
             SetDir(Tile.Direction.SOUTH);
         else if (player.GetDir() == Tile.Direction.SOUTH)
             SetDir(Tile.Direction.NORTH);
         else if (player.GetDir() == Tile.Direction.EAST)
             SetDir(Tile.Direction.WEST);
         else if (player.GetDir() == Tile.Direction.WEST)
             SetDir(Tile.Direction.EAST);
     }
     sentRun = true;
     commands(player);
 }
 public new void Update(GameTime gameTime, OWPlayer player)
 {
     base.Update(gameTime, player);
     if (movement.trigger == Movement.Trigger.AUTO){
         RunEventCommand(script, player);
     }
     if (movement.trigger == Movement.Trigger.TOUCH){
         bool touching = (player.travel.X == 0 && player.travel.Y == 0 && player.GetMapPos()[Character.Z] == mapZ && (
             (player.GetDir() == Tile.Direction.NORTH && player.GetMapPos()[Character.X] == mapX && player.GetMapPos()[Character.Y] == mapY - 1) ||
             (player.GetDir() == Tile.Direction.SOUTH && player.GetMapPos()[Character.X] == mapX && player.GetMapPos()[Character.Y] == mapY + 1) ||
             (player.GetDir() == Tile.Direction.EAST && player.GetMapPos()[Character.X] == mapX - 1 && player.GetMapPos()[Character.Y] == mapY) ||
             (player.GetDir() == Tile.Direction.WEST && player.GetMapPos()[Character.X] == mapX + 1 && player.GetMapPos()[Character.Y] == mapY)));
         if (!touching) touching = false;
         if (touching && !touched){
             touched = true;
             RunEventCommand(script, player);
         }
     }
     if (!Global.action.dialog.visible)
         sentRun = false;
     if(!sentRun)
         UpdateMovement(gameTime);
 }