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


PHP Position::getY方法代码示例

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


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

示例1: calculateNewPoint

 /**
  * @param Movement $move
  * @return Position
  * return Posizione di Move.
  */
 public function calculateNewPoint(Movement $move)
 {
     $destination = new Position($this->x, $this->y);
     switch ($move->getDirection()) {
         case Movement::NORTH:
             $destination->setY($destination->getY() + $move->getSpeed());
             break;
         case Movement::SOUTH:
             $destination->setY($destination->getY() - $move->getSpeed());
             break;
         case Movement::WEST:
             $destination->setX($destination->getX() - $move->getSpeed());
             break;
         case Movement::EAST:
             $destination->setX($destination->getX() + $move->getSpeed());
             break;
         default:
             throw new \RuntimeException('errore direzione');
     }
     return $destination;
 }
开发者ID:ebasirico,项目名称:school-project,代码行数:26,代码来源:Position.php

示例2: onRun


//.........这里部分代码省略.........
                                     if ($arena->timer == 5) {
                                         //$arena->lobbyWarp.getWorld().playSound($arena->lobbyWarp, Sound.ORB_PICKUP, 1, 0);
                                         ArenaHandler::sendFMessage($arena, $this->plugin->storage->message->get("normal")["ingameArenaEnd"], "1-5");
                                     } else {
                                         if ($arena->timer == 4) {
                                             //$arena->lobbyWarp.getWorld().playSound($arena->lobbyWarp, Sound.ORB_PICKUP, 1, 0);
                                             ArenaHandler::sendFMessage($arena, $this->plugin->storage->message->get("normal")["ingameArenaEnd"], "1-4");
                                         } else {
                                             if ($arena->timer == 3) {
                                                 //$arena->lobbyWarp.getWorld().playSound($arena->lobbyWarp, Sound.ORB_PICKUP, 1, 1);
                                                 ArenaHandler::sendFMessage($arena, $this->plugin->storage->message->get("normal")["ingameArenaEnd"], "1-3");
                                             } else {
                                                 if ($arena->timer == 2) {
                                                     //$arena->lobbyWarp.getWorld().playSound($arena->lobbyWarp, Sound.ORB_PICKUP, 1, 1);
                                                     ArenaHandler::sendFMessage($arena, $this->plugin->storage->message->get("normal")["ingameArenaEnd"], "1-2");
                                                 } else {
                                                     if ($arena->timer == 1) {
                                                         $arena->lobbyWarp . getWorld() . playSound($arena->lobbyWarp, Sound . ORB_PICKUP, 1, 2);
                                                         ArenaHandler::sendFMessage($arena, $this->plugin->storage->message->get("normal")["ingameArenaEnd"], "1-1");
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 } else {
                     ArenaHandler::hidersWin(arena);
                     return;
                 }
                 foreach ($arena->playersInArena as $arenaPlayer) {
                     if (!$arena->seekers . contains($arenaPlayer)) {
                         $pLoc = new Position($arenaPlayer->getX() - 0.5, $arenaPlayer->getY(), $arenaPlayer->getZ() - 0.5, $arenaPlayer->getLevel());
                         $moveLoc = $this->plugin->storage->moveLoc[$arenaPlayer];
                         $block = $arenaPlayer->getInventory()->getItem(8);
                         if ($block == null && $this->plugin->storage->pBlock[$arenaPlayer] != null) {
                             $block = $this->plugin->storage->pBlock[$arenaPlayer];
                             $arenaPlayer->getInventory()->setItem(8, $block);
                         }
                         if ($moveLoc != null) {
                             if ($moveLoc->getX() == $pLoc->getX() && $moveLoc->getY() == $pLoc->getY() && $moveLoc->getZ() == $pLoc->getZ()) {
                                 if ($block->getSize() > 1) {
                                     $block->setAmount($block->getSize() - 1);
                                 } else {
                                     $pBlock = $player->getLocation()->getBlock();
                                     if ($pBlock->getType()->equals(Item::AIR) || $pBlock->getType()->equals(Item::WATER) || $pBlock->getType()->equals(Block::STILL_WATER)) {
                                         if ($pBlock->getType()->equals(Item::WATER) || $pBlock->getType()->equals(Item::STATIONARY_WATER)) {
                                             $this->plugin->storage->hiddenLocWater . put($player, true);
                                         } else {
                                             $this->plugin->storage->hiddenLocWater . put($player, false);
                                         }
                                         $arrayOfPlayer = array();
                                         if (DisguiseAPI . isDisguised($player)) {
                                             DisguiseAPI . undisguiseToAll(player);
                                             $j = count($arrayOfPlayer = $this->plugin->getServer()->getgetOnlinePlayers());
                                             for ($i = 0; $i < $j; $i++) {
                                                 $pl = $arrayOfPlayer[$i];
                                                 if ($pl->getID() != $player->getID()) {
                                                     $pl->hidePlayer($player);
                                                     $pl->sendBlockChange($pBlock->getLocation(), $block->getType(), $block->getDurability());
                                                 }
                                             }
                                             //$block->addUnsafeEnchantment(Enchantment::DURABILITY, 10);
                                             //$player->playSound($pLoc, Sound.ORB_PICKUP, 1, 1);
                                             $this->plugin->storage->hiddenLoc[$player] = $moveLoc;
                                             MessageM . sendFMessage($player, $this->plugin->storage->message->get("normal")["ingameNowSolid"], $block->toString());
                                         }
                                         $j = count($arrayOfPlayer = $this->plugin->getServer()->getgetOnlinePlayers());
                                         for ($i = 0; $i < $j; $i++) {
                                             $pl = $arrayOfPlayer[$i];
                                             if ($pl->getID() != $player->getID()) {
                                                 $pl->hidePlayer($player);
                                                 $pl->sendBlockChange($pBlock->getLocation(), $block->getType(), $block->getDurability());
                                             }
                                         }
                                     } else {
                                         MessageM . sendFMessage($player, ConfigC::warning_ingameNoSolidPlace, "");
                                     }
                                 }
                             } else {
                                 $block->setAmount(5);
                                 if (!DisguiseAPI::isDisguised($player)) {
                                     SolidBlockHandler::makePlayerUnsolid($player);
                                 }
                             }
                         }
                     }
                 }
             }
             foreach ($arena->playersInArena as $arenaPlayer) {
                 $arenaPlayer->setLevel($arena->timer);
                 $arenaPlayer->setGameMode(0);
             }
             //ScoreboardHandler::updateScoreboard($arena);
         }
         $this->plugin->signsHandler->updateSigns();
     }
 }
开发者ID:survicraft,项目名称:pocketmine-BlockHunt,代码行数:101,代码来源:ArenaObserverTask.php


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