position->getWorld()->getTile($this->position); if($tile instanceof TileNote){ $this->pitch = $tile->getPitch(); }else{ $this->pitch = self::MIN_PITCH; } } public function writeStateToWorld() : void{ parent::writeStateToWorld(); $tile = $this->position->getWorld()->getTile($this->position); assert($tile instanceof TileNote); $tile->setPitch($this->pitch); } public function getFuelTime() : int{ return 300; } public function getPitch() : int{ return $this->pitch; } /** @return $this */ public function setPitch(int $pitch) : self{ if($pitch < self::MIN_PITCH || $pitch > self::MAX_PITCH){ throw new \InvalidArgumentException("Pitch must be in range " . self::MIN_PITCH . " - " . self::MAX_PITCH); } $this->pitch = $pitch; return $this; } //TODO }