Exemplo n.º 1
0
    private void CmdSpawnIsland(Vector3 position2, int island)
    {
        WorldObjectTypes value = (WorldObjectTypes)island;
        WorldObject      wo    = WorldObjectManager.Instance.InstantiateWorldObject(value, position2, Quaternion.identity);
        IslandObjectData data  = (IslandObjectData)wo.ReturnData();

        data.SetTreeState(IslandObjectData.TreeStates.Default);
        wo.UpdateData(data);
        wo.name = name + "Island";
        WorldObjectManager.Instance.InitializeWorldObject(wo, value);
        Transform node = wo.transform.Find("Node");

        string start = "http://86.91.184.42/addWeatherNode.php?naam=" + playerName + "&PosX=" + node.transform.position.x + "&PosY=" + node.transform.position.y + "&PosZ=" + node.transform.position.z + "";

        StartCoroutine(SetNode(start));
    }
Exemplo n.º 2
0
    private void InitIslands()
    {
        var json22 = new WebClient().DownloadString(getIsland);

        if (json22 != "")
        {
            dynamic jsonObj = JsonConvert.DeserializeObject <JArray>(json22);
            foreach (var obj in jsonObj)
            {
                if (obj.IslandType != 0)
                {
                    Vector3          pos   = new Vector3((float)obj.x, (float)obj.y, (float)obj.z);
                    WorldObjectTypes value = (WorldObjectTypes)obj.IslandType;
                    WorldObject      wo    = WorldObjectManager.Instance.InstantiateWorldObject(value, pos, Quaternion.identity);
                    IslandObjectData data  = (IslandObjectData)wo.ReturnData();
                    data.SetTreeState(IslandObjectData.TreeStates.Default);
                    wo.UpdateData(data);
                    wo.name = obj.naam + "Island";
                    WorldObjectManager.Instance.InitializeWorldObject(wo, value);
                }
            }
        }
    }