예제 #1
0
    public void SendVariableManifest(AbilityCentralThreadPool inst, AbilityNodeNetworkData[] manifest)
    {
        byte[] playerId  = BitConverter.GetBytes(inst.ReturnPlayerCasted());
        byte[] centralId = BitConverter.GetBytes(inst.ReturnCentralId());

        //Debug.LogFormat("Sending out Data for {0},{1}", inst.ReturnPlayerCasted(), inst.ReturnCentralId());
        byte[] manifestData = PrepareVariableManifest(manifest);

        bytesToSend = new byte[8 + manifestData.Length];

        Buffer.BlockCopy(playerId, 0, bytesToSend, 0, 4);
        Buffer.BlockCopy(centralId, 0, bytesToSend, 4, 4);
        Buffer.BlockCopy(manifestData, 0, bytesToSend, 8, manifestData.Length);
        SendEncodedMessages();
    }
예제 #2
0
    public override void NodeCallback()
    {
        base.NodeCallback();

        //Debug.Log("Node was callbacked!");
        //Debug.LogFormat("NodeID {0}, Thread ID {1}", name, GetNodeThreadId());

        if (IsHost())
        {
            AbilityCentralThreadPool inst = GetCentralInst();
            AbilityCentralThreadPool newA = new AbilityCentralThreadPool(inst.GetPlayerId());
            //AbilitiesManager.aData[inst.GetPlayerId()].abilties[GetNodeVariable<string>("Ability Name")].SignalCentralCreation(newA);
            AbilitiesManager.aData[inst.GetPlayerId()].abilties[GetNodeVariable <string>("Ability Name")].CreateAbility(newA, ClientProgram.clientId);
            newA.StartThreads(0);
            GetCentralInst().UpdateVariableValue <int[]>(GetNodeId(), GetVariableId("Created Ability"), new int[] { inst.GetPlayerId(), ClientProgram.clientId, newA.ReturnCentralId() }, true, false);
            HandlePostAbilityCreation();
            return;
        }

        //if(GetNodeVariable<int[]>("Created Ability") != null)
        //TriggerOnHostProcessed(GetNodeVariable<int[]>("Created Ability"));
    }