# automatically generated by the FlatBuffers compiler, do not modify

# namespace: flat

import flatbuffers

class Touch(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAsTouch(cls, buf, offset):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = Touch()
        x.Init(buf, n + offset)
        return x

    # Touch
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

# /// The name of the player involved with the touch.
    # Touch
    def PlayerName(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return bytes()

# /// Seconds that had elapsed in the game when the touch occurred.
    # Touch
    def GameSeconds(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

# /// The point of contact for the touch.
    # Touch
    def Location(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            x = o + self._tab.Pos
            from .Vector3 import Vector3
            obj = Vector3()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

# /// The direction of the touch.
    # Touch
    def Normal(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            x = o + self._tab.Pos
            from .Vector3 import Vector3
            obj = Vector3()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

# /// The Team which the touch belongs to, 0 for blue 1 for orange.
    # Touch
    def Team(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

# /// The index of the player involved with the touch.
    # Touch
    def PlayerIndex(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

def TouchStart(builder): builder.StartObject(6)
def TouchAddPlayerName(builder, playerName): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(playerName), 0)
def TouchAddGameSeconds(builder, gameSeconds): builder.PrependFloat32Slot(1, gameSeconds, 0.0)
def TouchAddLocation(builder, location): builder.PrependStructSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(location), 0)
def TouchAddNormal(builder, normal): builder.PrependStructSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(normal), 0)
def TouchAddTeam(builder, team): builder.PrependInt32Slot(4, team, 0)
def TouchAddPlayerIndex(builder, playerIndex): builder.PrependInt32Slot(5, playerIndex, 0)
def TouchEnd(builder): return builder.EndObject()
