Exemplo n.º 1
0
 public void ProcessUpdateEntities(Entity_Model[] updated_entities)
 {
     SmartObject obj = new SmartObject();
     SmartObject updates = new SmartObject();
     for(int i = 0; i < updated_entities.Length; i++) {
         updates.AddEntity("Entity_" + i, updated_entities[i]);
     }
     updates.AddInt("length", updated_entities.Length);
     obj.AddSmartObject("Updates", updates);
     Networking.WriteCustom(EventHelper.GetEventId("PROCESS_ENTITES"), socket, EasySerialization.EasySerialize(obj), true, NetworkReceivers.All);
 }
Exemplo n.º 2
0
    public override void Setup(ref NetWorker socket)
    {
        base.Setup(ref socket);
        socket.AddCustomDataReadEvent(EventHelper.GetEventId("SERVER_REQUEST"), ReadRequest);
        //		socket.AddCustomDataReadEvent ("COMBAT_REGISTER", ReadCombatRegister);

        SmartObject obj = new SmartObject();
        SmartObject add = new SmartObject();
        Client_Model[] players = Turn_Controller.instance.server_players.players.ToArray();
        int entity_count = 0;
        for(int i = 0; i < players.Length; i++) {
            Entity_Model_Army army = Entity_Model_Army.GenerateRandomArmy(ref players[i], 2);
            for(int i2 = 0; i2 < army.entity_army.Length; i2++) {
                add.AddEntity("Entity_" + entity_count, army.entity_army[i2]);
                entity_count++;
            }
        }
        Debug_Console.i.add("Host controller setup");
        add.AddInt("length", entity_count);
        obj.AddSmartObject("Additions", add);
        BMSByte bms_byte = EasySerialization.EasySerialize(obj);
        StartCoroutine("Delayed", bms_byte);
    }