Exemplo n.º 1
0
    public void CreateWorldSeed()
    {
        if (m_spawnedModules.Count >= 1)
        {
            SerializedWorld sWorld = new SerializedWorld();
            sWorld.modules = new SerializedModule[m_spawnedModules.Count];
            for (int m = 0; m < m_spawnedModules.Count; m++)
            {
                SerializedModule sMod = new SerializedModule();
                RoomModule       mod  = m_spawnedModules[m];

                sMod.id                   = mod.GetId();
                sMod.code                 = mod.moduleCode;
                sMod.position             = mod.transform.position;
                sMod.rotation             = Mathf.RoundToInt(mod.transform.eulerAngles.y);
                sMod.connectedModuleId    = new int[mod.connectors.Count];
                sMod.connectedModuleCodes = new string[mod.connectors.Count];
                sMod.connections          = new SerializedConnector[mod.connectors.Count];

                for (int c = 0; c < mod.connectors.Count; c++)
                {
                    sMod.connectedModuleId[c]    = mod.connectors[c].linkedModule.GetId();
                    sMod.connectedModuleCodes[c] = mod.connectors[c].linkedModule.moduleCode;
                    sMod.connections[c]          = new SerializedConnector(mod.connectors[c].UniqueId, mod.connectors[c].LinkedUniqueId);
                }

                sWorld.modules[m] = sMod;
            }

            string jsonWorld = JsonUtility.ToJson(sWorld);
            worldSeed = jsonWorld;

            Debug.Log("CREATED WORLD SEED : " + jsonWorld);
        }
    }
Exemplo n.º 2
0
 private void Init(SerializedModule m, string name)
 {
     this.maxColor = m.GetProperty(name, "maxColor");
     this.minColor = m.GetProperty(name, "minColor");
     this.minMax   = m.GetProperty(name, "minMax");
 }
Exemplo n.º 3
0
 public SerializedMinMaxColor(SerializedModule m, string name)
 {
     this.Init(m, name);
 }
Exemplo n.º 4
0
 public SerializedMinMaxColor(SerializedModule m)
 {
     this.Init(m, "curve");
 }
 private void Init(SerializedModule m, string name)
 {
   this.maxColor = m.GetProperty(name, "maxColor");
   this.minColor = m.GetProperty(name, "minColor");
   this.minMax = m.GetProperty(name, "minMax");
 }
 public SerializedMinMaxColor(SerializedModule m, string name)
 {
   this.Init(m, name);
 }
 public SerializedMinMaxColor(SerializedModule m)
 {
   this.Init(m, "curve");
 }