Ejemplo n.º 1
0
    public void RequestRpc(int frame, UdpNetBehaviour beh, string methodName, ArraySegment <byte> seg)
    {
        /*
         * var builder = new FlatBufferBuilder(1);
         * var vec = RpcMsg.CreateRpcMsg(builder, beh.NetId, builder.CreateString(methodName), builder.CreateBuffVector(RpcMsg.StartArgbufVector, seg));
         * builder.Finish(vec.Value);
         * var dataBuffer = builder.DataBuffer;
         * */
        var msg = MsgRpc.CreateBuilder()
                  .SetNetId(beh.NetId)
                  .SetMethod(methodName)
                  .SetArgbuf(ByteString.CopyFrom(seg.Array, seg.Offset, seg.Count)).Build();

        Request(MessageType.Rpc, frame, msg);
    }
Ejemplo n.º 2
0
    protected override void OnInit()
    {
        base.OnInit();
        currentHealth = maxHealth = 100;
        SetHpProgress();
        network = this.GetUdpNetwork();
        IsMine  = (network.ownerIndex == UserInfo.Instance.Index);
        int index = FrameController.Instance.ListIndexOfPlayer(network.ownerIndex);

        TerrainManager.Instance.SetPos(index, transform);
        group = index % 2;
        if (group == 1)
        {
            body.localRotation = Quaternion.Euler(new Vector3(0, 0, 90));
        }
        lastShootTime = 0;
        movingState   = MovingState.Idle;
    }
Ejemplo n.º 3
0
 public void AddBehaviour(UdpNetBehaviour item)
 {
     behs.Add(item);
 }