當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Player::isAlive方法代碼示例

本文整理匯總了PHP中pocketmine\Player::isAlive方法的典型用法代碼示例。如果您正苦於以下問題:PHP Player::isAlive方法的具體用法?PHP Player::isAlive怎麽用?PHP Player::isAlive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pocketmine\Player的用法示例。


在下文中一共展示了Player::isAlive方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: targetOption

 public function targetOption(Player $player, $distance)
 {
     return $player->spawned && $player->isAlive() && !$player->closed && $player->isSurvival() && $distance <= 81;
 }
開發者ID:rilex04,項目名稱:EntityManager,代碼行數:4,代碼來源:Monster.php

示例2: spawnTo

 /**
  * @param Player $player
  */
 public function spawnTo(Player $player)
 {
     if ($this->spawned and $player->spawned and $this->isAlive() and $player->isAlive() and $player->getLevel() === $this->level and $player->canSee($this) and !$this->isSpectator()) {
         parent::spawnTo($player);
     }
 }
開發者ID:NewDelion,項目名稱:PocketMine-0.13.x,代碼行數:9,代碼來源:Player.php

示例3: handlePlayerLeaveTheGame

 public function handlePlayerLeaveTheGame(Player $player)
 {
     if ($player != null) {
         foreach ($this->plugin->gameLevelManager->levels as &$lv) {
             if ($lv instanceof GameLevelModel) {
                 if (count($lv->joinedPlayers) > 0) {
                     if (isset($lv->joinedPlayers[$player->getName()])) {
                         unset($lv->joinedPlayers[$player->getName()]);
                         $this->plugin->log("[HG]gamelevelmanager handlePlayerLeaveTheGame: " . $player->getName() . " |  remains: " . count($lv->joinedPlayers));
                         if (count($lv->joinedPlayers) === 0 || count($lv->joinedPlayers) === 1) {
                             if ($lv->currentStep === GameLevelModel::STATUS_MAP_SELECTION || $lv->currentStep === GameLevelModel::STEP_WAITING) {
                                 $this->plugin->openGate($lv);
                                 $this->plugin->log("[HG] No player left in portal - reset portal state | " . $lv->type . " | " . $lv->name);
                                 $lv->joinDownCounter = $lv->joinDownCounterReset;
                                 $lv->status = GameLevelModel::STATUS_AVAILABLE;
                                 $lv->currentStep = GameLevelModel::STEP_JOINING;
                             }
                         }
                         // @FIXE ME remove votes
                         foreach ($this->plugin->arenaManager->arenas as &$arena) {
                             if ($arena instanceof MapArenaModel) {
                                 if (isset($arena->votedPlayers[$player->getName()])) {
                                     unset($arena->votedPlayers[$player->getName()]);
                                     if ($arena->vote >= 1) {
                                         $arena->vote--;
                                     }
                                     break;
                                 }
                             }
                         }
                     }
                     if (!empty($lv->currentMap)) {
                         if (isset($lv->currentMap->livePlayers[$player->getName()])) {
                             unset($lv->currentMap->livePlayers[$player->getName()]);
                             $recordloss = new HungerGamesRecordLossTask($this->plugin, $lv, $player->getName());
                             $this->plugin->getServer()->getScheduler()->scheduleDelayedTask($recordloss, 30);
                         }
                         if (isset($lv->currentMap->joinedPlayers[$player->getName()])) {
                             unset($lv->currentMap->joinedPlayers[$player->getName()]);
                         }
                         if (isset($lv->currentMap->votedPlayers[$player->getName()])) {
                             unset($lv->currentMap->votedPlayers[$player->getName()]);
                         }
                         break;
                     }
                 }
             }
         }
     }
     // @FIXME
     if (!empty($player->getInventory() && $player->isAlive())) {
         HungerGameKit::clearAllInventories($player);
     }
 }
開發者ID:robozeri,項目名稱:SG,代碼行數:54,代碼來源:GameLevelManager.php

示例4: targetOption

 public function targetOption(Player $player, $distance)
 {
     return $player->spawned && $player->isAlive() && !$player->closed && $player->getInventory()->getItemInHand()->getId() == Item::WHEAT && $distance <= 49;
 }
開發者ID:rilex04,項目名稱:EntityManager,代碼行數:4,代碼來源:Cow.php

示例5: getKiller

 /**
  * @param Player $level
  * @return Player $killer
  */
 public function getKiller(Player $player)
 {
     if ($player->isOnline() && !$player->isAlive()) {
         $cause = $player->getLastDamageCause();
         if ($cause instanceof EntityDamageByEntityEvent) {
             $killer = $cause->getDamager();
             if ($killer->isOnline() && $killer instanceof Player) {
                 return $killer;
             }
         }
     }
 }
開發者ID:gitter-badger,項目名稱:Development-1,代碼行數:16,代碼來源:SAPI.php


注:本文中的pocketmine\Player::isAlive方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。