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


PHP Human::setHealth方法代码示例

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


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

示例1: setHealth

 public function setHealth($amount)
 {
     parent::setHealth($amount);
     if ($this->spawned === true) {
         $pk = new SetHealthPacket();
         $pk->health = $this->getHealth();
         $this->dataPacket($pk);
     }
 }
开发者ID:NewDelion,项目名称:PocketMine-0.13.x,代码行数:9,代码来源:Player.php

示例2: setHealth

 public function setHealth($amount)
 {
     parent::setHealth($amount);
     if ($this->spawned === true) {
         $this->foodTick = 0;
         $this->getAttribute()->getAttribute(AttributeManager::MAX_HEALTH)->setValue($amount);
         if ($amount <= 0) {
             $pk = new RespawnPacket();
             $pos = $this->getSpawn();
             $pk->x = $pos->x;
             $pk->y = $pos->y;
             $pk->z = $pos->z;
             $this->dataPacket($pk);
         }
     }
 }
开发者ID:KillerXtream,项目名称:ImagicalMine,代码行数:16,代码来源:Player.php

示例3: setHealth

 public function setHealth($amount)
 {
     parent::setHealth($amount);
     if ($this->spawned === true) {
         $this->foodTick = 0;
         $this->getAttribute()->getAttribute(AttributeManager::MAX_HEALTH)->setMaxValue($this->getMaxHealth())->setValue($amount);
     }
 }
开发者ID:PepbookPvP,项目名称:Genisys,代码行数:8,代码来源:Player.php

示例4: setHealth

 public function setHealth($amount)
 {
     parent::setHealth($amount);
     if ($this->spawned === true) {
         $this->foodTick = 0;
         if ($amount <= 0) {
             $this->kill();
             return;
         }
         $this->getAttribute()->getAttribute(AttributeManager::MAX_HEALTH)->setValue($amount);
     }
 }
开发者ID:TexusDark,项目名称:ImagicalMine,代码行数:12,代码来源:Player.php

示例5: setHealth

 public function setHealth($amount)
 {
     parent::setHealth($amount);
     if ($this->spawned === \true) {
         ////            if($amount === 20 || $amount === 0) {
         //                $pk = new SetHealthPacket();
         //                $pk->health = $this->getHealth();
         //                $this->dataPacket($pk);
         ////            }
         $this->foodTick = 0;
         $this->getAttribute()->getAttribute(AttributeManager::MAX_HEALTH)->setValue($amount);
     }
 }
开发者ID:AASSuper,项目名称:PocketMine_0.13,代码行数:13,代码来源:Player.php

示例6: setHealth

 public function setHealth($amount)
 {
     parent::setHealth($amount);
     if ($this->spawned === true) {
         $pk = new UpdateAttributesPacket();
         $this->foodTick = 0;
         $pk->minValue = 0;
         $pk->maxValue = $this->getMaxHealth();
         $pk->value = $amount;
         $pk->name = UpdateAttributesPacket::HEALTH;
         $this->dataPacket($pk);
     }
 }
开发者ID:WonderlandPE,项目名称:Steadfast2,代码行数:13,代码来源:Player.php

示例7: setHealth

 public function setHealth($amount)
 {
     parent::setHealth($amount);
     if ($this->spawned === true) {
         $pk = new SetHealthPacket();
         $pk->health = $this->getHealth();
         $this->dataPacket($pk->setChannel(Network::CHANNEL_WORLD_EVENTS));
     }
 }
开发者ID:richarrj,项目名称:PocketMine-MP,代码行数:9,代码来源:Player.php

示例8: setHealth

 public function setHealth($amount)
 {
     parent::setHealth($amount);
     if ($this->spawned === true) {
         #$this->health = $amount;
         $this->getAttributeMap()->getAttribute(Attribute::HEALTH)->setMaxValue($this->getMaxHealth())->setValue($amount, false);
         //maybe setmax causes doublehit
         //Client hack: (Client always shows hit animation on SetHealthPacket) (Now its there because of /kill)
         if (!$this->isAlive()) {
             $pk = new SetHealthPacket();
             $pk->health = $this->getHealth();
             $this->dataPacket($pk);
         }
         $this->foodTickTimer = 0;
     }
 }
开发者ID:robske110,项目名称:ClearSky,代码行数:16,代码来源:Player.php


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