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


PHP Position::getFloorX方法代码示例

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


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

示例1: getPosList

 public function getPosList()
 {
     $out = [];
     switch ($this->axis) {
         case self::X:
             for ($i = 0; $i < $this->height; $i++) {
                 $x = $this->base->getFloorX() + $i;
                 $centre = new Vector3($x, $this->base->getFloorY(), $this->base->getFloorZ());
                 for ($y = $this->base->getFloorY() - $this->radius; $y <= $this->base->getFloorY() + $this->radius; $y++) {
                     for ($z = $this->base->getFloorZ() - $this->radius; $z <= $this->base->getFloorZ() + $this->radius; $z++) {
                         $v = new Vector3($x, $y, $z);
                         if ($centre->distance($v) <= $this->radius) {
                             $out[] = $this->base->getLevel();
                         }
                     }
                 }
             }
             break;
         case self::Y:
             for ($i = 0; $i < $this->height; $i++) {
                 $y = $this->base->getFloorY() + $i;
                 $centre = new Vector3($this->base->getFloorX(), $y, $this->base->getFloorZ());
                 for ($x = $this->base->getFloorX() - $this->radius; $x <= $this->base->getFloorX() + $this->radius; $x++) {
                     for ($z = $this->base->getFloorZ() - $this->radius; $z <= $this->base->getFloorZ() + $this->radius; $z++) {
                         $v = new Position($x, $y, $z, $this->base->getLevel());
                         if ($centre->distance($v) <= $this->radius) {
                             $out[] = $v;
                         }
                     }
                 }
             }
             break;
         case self::Z:
             for ($i = 0; $i < $this->height; $i++) {
                 $z = $this->base->getFloorZ() + $i;
                 $centre = new Vector3($this->base->getFloorX(), $this->base->getFloorY(), $z);
                 for ($x = $this->base->getFloorX() - $this->radius; $x <= $this->base->getFloorY() + $this->radius; $x++) {
                     for ($y = $this->base->getFloorY() - $this->radius; $y <= $this->base->getFloorY() + $this->radius; $y++) {
                         $v = new Position($x, $y, $z, $this->base->getLevel());
                         if ($centre->distance($v) <= $this->radius) {
                             $out[] = $v;
                         }
                     }
                 }
             }
             break;
     }
     return $out;
 }
开发者ID:barnseyminesuk,项目名称:Small-ZC-Plugins,代码行数:49,代码来源:CylinderSpace.php

示例2: getLocByBlock

 public function getLocByBlock(Position $block)
 {
     return $block->getFloorX() . ";" . $block->getFloorY() . ";" . $block->getFloorZ() . ";" . $block->getLevel()->getFolderName();
 }
开发者ID:JungHyun3459,项目名称:PMMP-Plugins,代码行数:4,代码来源:SpeedBlock.php

示例3: encodeLoc

 public static function encodeLoc(Position $location)
 {
     return $location->getFloorX() . ";" . $location->getFloorY() . ";" . $location->getFloorZ() . ";" . $location->getLevel()->getFolderName();
 }
开发者ID:organization,项目名称:XcelWarp,代码行数:4,代码来源:XcelWarp.php


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