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


PHP math\AxisAlignedBB类代码示例

本文整理汇总了PHP中pocketmine\math\AxisAlignedBB的典型用法代码示例。如果您正苦于以下问题:PHP AxisAlignedBB类的具体用法?PHP AxisAlignedBB怎么用?PHP AxisAlignedBB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: recalculateBoundingBox

 protected function recalculateBoundingBox()
 {
     $f = 0.1875;
     $damage = $this->getFullDamage();
     $bb = new AxisAlignedBB($this->x, $this->y, $this->z, $this->x + 1, $this->y + 2, $this->z + 1);
     $j = $damage & 0x3;
     $isOpen = ($damage & 0x4) > 0;
     $isRight = ($damage & 0x10) > 0;
     if ($j === 0) {
         if ($isOpen) {
             if (!$isRight) {
                 $bb->setBounds($this->x, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + $f);
             } else {
                 $bb->setBounds($this->x, $this->y, $this->z + 1 - $f, $this->x + 1, $this->y + 1, $this->z + 1);
             }
         } else {
             $bb->setBounds($this->x, $this->y, $this->z, $this->x + $f, $this->y + 1, $this->z + 1);
         }
     } elseif ($j === 1) {
         if ($isOpen) {
             if (!$isRight) {
                 $bb->setBounds($this->x + 1 - $f, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + 1);
             } else {
                 $bb->setBounds($this->x, $this->y, $this->z, $this->x + $f, $this->y + 1, $this->z + 1);
             }
         } else {
             $bb->setBounds($this->x, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + $f);
         }
     } elseif ($j === 2) {
         if ($isOpen) {
             if (!$isRight) {
                 $bb->setBounds($this->x, $this->y, $this->z + 1 - $f, $this->x + 1, $this->y + 1, $this->z + 1);
             } else {
                 $bb->setBounds($this->x, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + $f);
             }
         } else {
             $bb->setBounds($this->x + 1 - $f, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + 1);
         }
     } elseif ($j === 3) {
         if ($isOpen) {
             if (!$isRight) {
                 $bb->setBounds($this->x, $this->y, $this->z, $this->x + $f, $this->y + 1, $this->z + 1);
             } else {
                 $bb->setBounds($this->x + 1 - $f, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + 1);
             }
         } else {
             $bb->setBounds($this->x, $this->y, $this->z + 1 - $f, $this->x + 1, $this->y + 1, $this->z + 1);
         }
     }
     return $bb;
 }
开发者ID:TexusDark,项目名称:Ananas-MP,代码行数:51,代码来源:Door.php

示例2: recalculateBoundingBox

 protected function recalculateBoundingBox()
 {
     $damage = $this->getDamage();
     $f = 0.1875;
     if (($damage & 0x8) > 0) {
         $bb = new AxisAlignedBB($this->x, $this->y + 1 - $f, $this->z, $this->x + 1, $this->y + 1, $this->z + 1);
     } else {
         $bb = new AxisAlignedBB($this->x, $this->y, $this->z, $this->x + 1, $this->y + $f, $this->z + 1);
     }
     if (($damage & 0x4) > 0) {
         if (($damage & 0x3) === 0) {
             $bb->setBounds($this->x, $this->y, $this->z + 1 - $f, $this->x + 1, $this->y + 1, $this->z + 1);
         } elseif (($damage & 0x3) === 1) {
             $bb->setBounds($this->x, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + $f);
         }
         if (($damage & 0x3) === 2) {
             $bb->setBounds($this->x + 1 - $f, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + 1);
         }
         if (($damage & 0x3) === 3) {
             $bb->setBounds($this->x, $this->y, $this->z, $this->x + $f, $this->y + 1, $this->z + 1);
         }
     }
     return $bb;
 }
开发者ID:psh3253,项目名称:PocketMine-MP_Windows,代码行数:24,代码来源:IronTrapdoor.php

示例3: recalculateBoundingBox

 protected function recalculateBoundingBox()
 {
     $damage = $this->getDamage();
     $f = 0.1875;
     if (($damage & self::MASK_UPPER) > 0) {
         $bb = new AxisAlignedBB($this->x, $this->y + 1 - $f, $this->z, $this->x + 1, $this->y + 1, $this->z + 1);
     } else {
         $bb = new AxisAlignedBB($this->x, $this->y, $this->z, $this->x + 1, $this->y + $f, $this->z + 1);
     }
     if (($damage & self::MASK_OPENED) > 0) {
         if (($damage & 0x3) === self::MASK_SIDE_NORTH) {
             $bb->setBounds($this->x, $this->y, $this->z + 1 - $f, $this->x + 1, $this->y + 1, $this->z + 1);
         } elseif (($damage & 0x3) === self::MASK_SIDE_SOUTH) {
             $bb->setBounds($this->x, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + $f);
         }
         if (($damage & 0x3) === self::MASK_SIDE_WEST) {
             $bb->setBounds($this->x + 1 - $f, $this->y, $this->z, $this->x + 1, $this->y + 1, $this->z + 1);
         }
         if (($damage & 0x3) === self::MASK_SIDE_EAST) {
             $bb->setBounds($this->x, $this->y, $this->z, $this->x + $f, $this->y + 1, $this->z + 1);
         }
     }
     return $bb;
 }
开发者ID:xxFlare,项目名称:PocketMine-MP,代码行数:24,代码来源:Trapdoor.php

示例4: collidesWithBB

 /**
  * Checks for collision against an AxisAlignedBB
  *
  * @param AxisAlignedBB $bb
  *
  * @return bool
  */
 public function collidesWithBB(AxisAlignedBB $bb)
 {
     $bb2 = $this->getBoundingBox();
     return $bb2 !== null and $bb->intersectsWith($bb2);
 }
开发者ID:1455931078,项目名称:Genisys,代码行数:12,代码来源:Block.php

示例5: collidesWithBB

 /**
  * Checks for collision against an AxisAlignedBB
  *
  * @param AxisAlignedBB $bb
  * @param Block[]       $list
  */
 public function collidesWithBB(AxisAlignedBB $bb, &$list = [])
 {
     $bb2 = $this->getBoundingBox();
     if ($bb2 !== null and $bb->intersectsWith($bb2)) {
         $list[] = $bb2;
     }
 }
开发者ID:TylerGames,项目名称:PocketMine-MP,代码行数:13,代码来源:Block.php

示例6: setPosition

 public function setPosition(Vector3 $pos)
 {
     if ($this->closed) {
         return false;
     }
     if ($pos instanceof Position and $pos->level !== null and $pos->level !== $this->level) {
         if ($this->switchLevel($pos->getLevel()) === false) {
             return false;
         }
     }
     $this->x = $pos->x;
     $this->y = $pos->y;
     $this->z = $pos->z;
     $radius = $this->width / 2;
     $this->boundingBox->setBounds($pos->x - $radius, $pos->y, $pos->z - $radius, $pos->x + $radius, $pos->y + $this->height, $pos->z + $radius);
     $this->checkChunks();
     return true;
 }
开发者ID:Cecil107,项目名称:PocketMine-0.13.0,代码行数:18,代码来源:Entity.php

示例7: setPosition

 public function setPosition(Vector3 $pos)
 {
     if ($this->closed) {
         return \false;
     }
     if ($pos instanceof Position and $pos->level !== \null and $pos->level !== $this->level) {
         if ($this->switchLevel($pos->getLevel()) === \false) {
             return \false;
         }
     }
     $this->x = $pos->x;
     $this->y = $pos->y;
     $this->z = $pos->z;
     $radius = $this->width / 2;
     $this->boundingBox->setBounds($pos->x - $radius, $pos->y, $pos->z - $radius, $pos->x + $radius, $pos->y + $this->height, $pos->z + $radius);
     if ($this->chunk === \null or $this->chunkX !== $this->x >> 4 and $this->chunkZ !== $this->z >> 4) {
         if ($this->chunk !== \null) {
             $this->chunk->removeEntity($this);
         }
         $this->level->loadChunk($this->x >> 4, $this->z >> 4);
         $this->chunk = $this->level->getChunk($this->x >> 4, $this->z >> 4, \true);
         $this->chunkX = $this->chunk->getX();
         $this->chunkZ = $this->chunk->getZ();
         if (!$this->justCreated) {
             $newChunk = $this->level->getUsingChunk($this->x >> 4, $this->z >> 4);
             foreach ($this->hasSpawned as $player) {
                 if (!isset($newChunk[$player->getId()])) {
                     $this->despawnFrom($player);
                 } else {
                     unset($newChunk[$player->getId()]);
                 }
             }
             foreach ($newChunk as $player) {
                 $this->spawnTo($player);
             }
         }
         $this->chunk->addEntity($this);
     }
     return \true;
 }
开发者ID:Cybertechpp,项目名称:Steadfast2,代码行数:40,代码来源:Entity.php

示例8: setPosition

 public function setPosition(Vector3 $pos, $force = false)
 {
     if ($pos instanceof Position and $pos->getLevel() instanceof Level and $pos->getLevel() !== $this->getLevel()) {
         if ($this->switchLevel($pos->getLevel()) === false) {
             return false;
         }
     }
     if (!$this->justCreated and $force !== true) {
         $ev = new EntityMoveEvent($this, $pos);
         $this->server->getPluginManager()->callEvent($ev);
         if ($ev->isCancelled()) {
             return false;
         }
     }
     $this->x = $pos->x;
     $this->y = $pos->y;
     $this->z = $pos->z;
     $radius = $this->width / 2;
     $this->boundingBox->setBounds($pos->x - $radius, $pos->y + $this->ySize, $pos->z - $radius, $pos->x + $radius, $pos->y + $this->height + $this->ySize, $pos->z + $radius);
     if ($this->chunk === null or $this->chunk->getX() !== $this->x >> 4 and $this->chunk->getZ() !== $this->z >> 4) {
         if ($this->chunk instanceof FullChunk) {
             $this->chunk->removeEntity($this);
         }
         $this->getLevel()->loadChunk($this->x >> 4, $this->z >> 4);
         $this->chunk = $this->getLevel()->getChunkAt($this->x >> 4, $this->z >> 4);
         if (!$this->justCreated) {
             $newChunk = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4);
             foreach ($this->hasSpawned as $player) {
                 if (!isset($newChunk[$player->getID()])) {
                     $this->despawnFrom($player);
                 } else {
                     unset($newChunk[$player->getID()]);
                 }
             }
             foreach ($newChunk as $player) {
                 $this->spawnTo($player);
             }
         }
         $this->chunk->addEntity($this);
     }
     return true;
 }
开发者ID:boybook,项目名称:PocketMine-MP,代码行数:42,代码来源:Entity.php


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