...

Text file src/github.com/google/flatbuffers/tests/union_vector/Attacker.php

Documentation: github.com/google/flatbuffers/tests/union_vector

     1<?php
     2// automatically generated by the FlatBuffers compiler, do not modify
     3
     4use \Google\FlatBuffers\Struct;
     5use \Google\FlatBuffers\Table;
     6use \Google\FlatBuffers\ByteBuffer;
     7use \Google\FlatBuffers\FlatBufferBuilder;
     8
     9class Attacker extends Table
    10{
    11    /**
    12     * @param ByteBuffer $bb
    13     * @return Attacker
    14     */
    15    public static function getRootAsAttacker(ByteBuffer $bb)
    16    {
    17        $obj = new Attacker();
    18        return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb));
    19    }
    20
    21    public static function AttackerIdentifier()
    22    {
    23        return "MOVI";
    24    }
    25
    26    public static function AttackerBufferHasIdentifier(ByteBuffer $buf)
    27    {
    28        return self::__has_identifier($buf, self::AttackerIdentifier());
    29    }
    30
    31    /**
    32     * @param int $_i offset
    33     * @param ByteBuffer $_bb
    34     * @return Attacker
    35     **/
    36    public function init($_i, ByteBuffer $_bb)
    37    {
    38        $this->bb_pos = $_i;
    39        $this->bb = $_bb;
    40        return $this;
    41    }
    42
    43    /**
    44     * @return int
    45     */
    46    public function getSwordAttackDamage()
    47    {
    48        $o = $this->__offset(4);
    49        return $o != 0 ? $this->bb->getInt($o + $this->bb_pos) : 0;
    50    }
    51
    52    /**
    53     * @param FlatBufferBuilder $builder
    54     * @return void
    55     */
    56    public static function startAttacker(FlatBufferBuilder $builder)
    57    {
    58        $builder->StartObject(1);
    59    }
    60
    61    /**
    62     * @param FlatBufferBuilder $builder
    63     * @return Attacker
    64     */
    65    public static function createAttacker(FlatBufferBuilder $builder, $sword_attack_damage)
    66    {
    67        $builder->startObject(1);
    68        self::addSwordAttackDamage($builder, $sword_attack_damage);
    69        $o = $builder->endObject();
    70        return $o;
    71    }
    72
    73    /**
    74     * @param FlatBufferBuilder $builder
    75     * @param int
    76     * @return void
    77     */
    78    public static function addSwordAttackDamage(FlatBufferBuilder $builder, $swordAttackDamage)
    79    {
    80        $builder->addIntX(0, $swordAttackDamage, 0);
    81    }
    82
    83    /**
    84     * @param FlatBufferBuilder $builder
    85     * @return int table offset
    86     */
    87    public static function endAttacker(FlatBufferBuilder $builder)
    88    {
    89        $o = $builder->endObject();
    90        return $o;
    91    }
    92}

View as plain text