コード例 #1
0
        List <LevelObj> Generate(int X, int Y, int Z, bool rot)
        {
            List <LevelObj> List      = new List <LevelObj>();
            LevelObj        BaseObj   = new The4Dimension.LevelObj();
            Form1           f         = (Form1)Application.OpenForms["Form1"];
            int             HighestId = f.higestID["ObjInfo"];

            BaseObj.Prop.Add("LayerName", new Node("共通", "A0"));
            BaseObj.Prop.Add("name", new Node("TransparentWall", "A0"));
            BaseObj.Prop.Add("dir_x", new Node("0", "D2"));
            BaseObj.Prop.Add("dir_y", new Node(rot ? "180" : "0", "D2"));
            BaseObj.Prop.Add("dir_z", new Node("0", "D2"));
            BaseObj.Prop.Add("pos_x", new Node(X.ToString(), "D2"));
            BaseObj.Prop.Add("pos_y", new Node(Y.ToString(), "D2"));
            BaseObj.Prop.Add("pos_z", new Node(Z.ToString(), "D2"));
            BaseObj.Prop.Add("scale_x", new Node("1", "D2"));
            BaseObj.Prop.Add("scale_y", new Node("1", "D2"));
            BaseObj.Prop.Add("scale_z", new Node("1", "D2"));
            BaseObj.Prop.Add("l_id", new Node("0", "D1"));
            for (int ix = 0; ix < numericUpDown2.Value; ix++)
            {
                for (int iy = 0; iy < numericUpDown1.Value; iy++)
                {
                    LevelObj tmpObj = BaseObj.Clone();
                    ((Node)tmpObj.Prop["pos_x"]).StringValue = (X + ix * 1000).ToString();
                    ((Node)tmpObj.Prop["pos_y"]).StringValue = (Y + iy * 1000).ToString();
                    ((Node)tmpObj.Prop["l_id"]).StringValue  = (++HighestId).ToString();
                    List.Add(tmpObj);
                }
            }
            f.higestID["ObjInfo"] = HighestId;
            return(List);
        }
コード例 #2
0
    void LoadLevels()
    {
        for (int i = 0; i < Age.levelsGrid.levels.Count; i++)
        {
            GameObject level = Instantiate(LevelPrefab, FindLevelPos(i), Quaternion.identity, this.transform);
            level.name = Age.levelsGrid.levels[i].Name;
            LevelObj levelObj = level.GetComponent <LevelObj> ();
            levelObj.level = Age.levelsGrid.levels[i];
            Levels.Add(i, level);
        }

        for (int i = 0; i < Age.levelsGrid.levels.Count; i++)
        {
            for (int j = 0; j < Age.levelsGrid.levels[i].Parents.Count; j++)
            {
                GameObject way = Instantiate(WayPrefab);
                way.transform.parent = this.transform;
                WayObj wayobj = way.GetComponent <WayObj> ();
                wayobj.childPos = Levels[i].transform.position;
                for (int k = 0; k < Levels.Count; k++)
                {
                    if (Levels[k].GetComponent <LevelObj> ().level == Levels[i].GetComponent <LevelObj> ().level.Parents[j])
                    {
                        wayobj.parentPos = Levels[k].transform.position;
                    }
                }
                Ways.Add(way);
            }
        }
    }
コード例 #3
0
ファイル: LevelBuilder.cs プロジェクト: lindenreid/ragamuffin
    public void OnSceneUpdate(SceneView sceneView)
    {
        Event e = Event.current;         // mouse/key events

        if (e.isMouse && e.button == 0 && e.clickCount == 1 && _activeObj)
        {
            //Debug.Log("active object: " + _activeObj.name);

            // get world-space mouse position
            Ray     r             = Camera.current.ScreenPointToRay(new Vector3(e.mousePosition.x, -e.mousePosition.y + Camera.current.pixelHeight));
            Vector3 mousePosition = r.origin;

            // snap position to closest grid location
            Vector3 closestGridPoint = grid.FindClosestGridPos(mousePosition);

            // instantiate object at mouse position
            GameObject obj = Instantiate(_activeObj, closestGridPoint, Quaternion.identity) as GameObject;

            // give obj references to grid & game controller
            LevelObj levelObj = obj.GetComponent <LevelObj>();
            if (levelObj)
            {
                levelObj.grid           = grid;
                levelObj.gameController = gameController;
            }
        }
    }
コード例 #4
0
ファイル: GameObjectDumper.cs プロジェクト: RR0000/Odyssave
        public static FoundObj Parse(LevelObj o)
        {
            FoundObj res = new FoundObj();

            if (o.Prop.ContainsKey("l_id"))
            {
                res.Ids.Add(((Node)o.Prop["l_id"]).StringValue);
            }
            if (o.Prop.ContainsKey("Arg"))
            {
                res.Args.AddRange((int[])o.Prop["Arg"]);
            }
            if (o.Prop.ContainsKey("GenerateChildren"))
            {
                foreach (LevelObj ob in ((C0List)o.Prop["GenerateChildren"]).List)
                {
                    res.ChildrenObj.Add(ob.ToString());
                }
            }
            if (o.Prop.ContainsKey("AreaChildren"))
            {
                foreach (LevelObj ob in ((C0List)o.Prop["AreaChildren"]).List)
                {
                    res.ChildrenObj.Add(ob.ToString());
                }
            }
            return(res);
        }
コード例 #5
0
 private GameState(LevelObj levelsObj)
 {
     _levelIndex   = 0;
     _levelsObj    = levelsObj;
     CarReturnRate = _levelConfig.CarReturnRate;
     Debug.Log("Level Count: " + levelsObj.Levels + ", NumRequired: " + (levelsObj?.Levels.First()?.NumCustomersRequired ?? -99));
 }
コード例 #6
0
ファイル: Interactable.cs プロジェクト: lindenreid/ragamuffin
 void Awake()
 {
     levelObj = GetComponent <LevelObj>();
     if (levelObj && levelObj.gameController)
     {
         mainCharacterTransform = levelObj.gameController.mainCharacter.transform;
     }
 }
コード例 #7
0
 public static void Init(LevelObj levels)
 {
     if (!_initialied)
     {
         Current     = new GameState(levels);
         _initialied = true;
         Debug.Log("Initialized Game State");
     }
 }
コード例 #8
0
ファイル: LevelsDrawer.cs プロジェクト: ArtStudy/ToE2.0
    public static void DrawLevel(GameObject level)
    {
        LevelObj levelObj = level.GetComponent <LevelObj> ();

        for (int i = 0; i < grid.levels.Count; i++)
        {
            if (grid.levels[i] == levelObj.level)
            {
                level.transform.position = grid.levelsPositions[i] * levelScale;
            }
        }
    }
コード例 #9
0
    static void Init()
    {
        objSelectorGrid = new LevelObj(new Rect(0, 0, 0, 0), Resources.Load <Texture>("HexaGridRed"), 0, 0);

        grid          = new Grid(800, 400, new Rect(215, 90, 500, 400), 40, 40);
        ChunkItemList = new Listbox(new string[] { "None" }, "LevelChunksHirarchy", new Rect(10, 480, 200, 140), 20);

        window         = (ChuckEditor)EditorWindow.GetWindow(typeof(ChuckEditor));
        window.minSize = new Vector2(735, 650);
        chunk          = new Chunk("NewChunk", new Rect(0, 0, 1, 1), 0, 0, new List <LevelObj>());
        string[] savedChunks = CubeFile.CheckDirectory("SavedFiles/Chunks");
        window.Canvas = new ObjRect(180, 90, 800, 400);
        window.movingCenterOfChunk = false;
        SavedChunksList            = new Listbox(savedChunks, "SavedLevels", new Rect(10, 295, 200, 140), 20);
        window.autoAdjustCOC       = true;
        foreach (var item in SavedChunksList.items)
        {
            item.action = window.LoadChunk;
        }
        window.gridScalerRect = new Rect(715, 490, 20, 150);
        //foreach (var item in ChunkItemList.items)
        //{
        //    item.action = window.SelectItemOnScene;
        //}
        window.lastGrabbedObjScale = new Vector2(40, 40);
        window.deletedItems        = new List <string>(0);
        window.grabbedObj          = new Rect(0, 0, window.lastGrabbedObjScale.x, window.lastGrabbedObjScale.y);
        string[] availObjs = window.LoadAvailableObjects();

        TextureList = new Listbox(availObjs, "AvailableObjects", new Rect(10, 110, 200, 140), 20);

        foreach (var item in TextureList.items)
        {
            item.action = window.changeSelectedBlockTexture;
        }

        window.layers     = new bool[10];
        window.layers[0]  = true;
        window.layersName = new string[] { "L1",
                                           "L2",
                                           "L3",
                                           "L4",
                                           "L5",
                                           "L6",
                                           "L7",
                                           "L8",
                                           "L9",
                                           "L10" };

        window.wantsMouseMove = true;
        window.changeSelectedBlockTexture("");
    }
コード例 #10
0
 public void SelectItemOnScene(string item)
 {
     if (ChunkItemList.items.Count > 0)
     {
         string   lst4SelectedItem = ChunkItemList.getSelectedItemContent();
         LevelObj obj = chunk.objects.Find(x =>
         {
             return(x.texture + "." + x.id == lst4SelectedItem);
         });
         selectedLevelObj = obj;
         if (obj != null)
         {
             objSelectorGrid.position = obj.position;
         }
     }
 }
コード例 #11
0
 void UpdateTreeView()
 {
     treeView1.Nodes.Clear();
     treeView1.Nodes.Add("Links");
     foreach (string k in LinksNode.Keys)
     {
         var node = treeView1.Nodes[0].Nodes.Add(k);
         node.Tag = k;
         for (int i = 0; i < LinksNode[k].Count; i++)
         {
             ILevelObj obj = LevelObj.FromNode(LinksNode[k][i]);
             node.Nodes.Add(obj.ToString()).Tag = obj;
         }
     }
     treeView1.Nodes[0].Expand();
 }
コード例 #12
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form1           f    = (Form1)Application.OpenForms["Form1"];
            List <LevelObj> List = new List <LevelObj>();

            List.AddRange(Generate((int)numericUpDown3.Value, (int)numericUpDown4.Value, (int)numericUpDown5.Value, false));
            if (checkBox1.Checked)
            {
                List.AddRange(Generate((int)numericUpDown3.Value, (int)numericUpDown4.Value, (int)numericUpDown5.Value + (int)numericUpDown6.Value, true));
                if (checkBox2.Checked)
                {
                    int X, Y, Z;
                    X = (int)numericUpDown3.Value;
                    Y = (int)(numericUpDown4.Value + (numericUpDown1.Value - 1) * 1000 + 500);
                    Z = (int)numericUpDown5.Value + 500;
                    LevelObj BaseObj   = new The4Dimension.LevelObj();
                    int      HighestId = f.higestID["ObjInfo"];
                    BaseObj.Prop.Add("LayerName", new Node("共通", "A0"));
                    BaseObj.Prop.Add("name", new Node("TransparentWall", "A0"));
                    BaseObj.Prop.Add("dir_x", new Node("90", "D2"));
                    BaseObj.Prop.Add("dir_y", new Node("0", "D2"));
                    BaseObj.Prop.Add("dir_z", new Node("0", "D2"));
                    BaseObj.Prop.Add("pos_x", new Node(X.ToString(), "D2"));
                    BaseObj.Prop.Add("pos_y", new Node(Y.ToString(), "D2"));
                    BaseObj.Prop.Add("pos_z", new Node(Z.ToString(), "D2"));
                    BaseObj.Prop.Add("scale_x", new Node("1", "D2"));
                    BaseObj.Prop.Add("scale_y", new Node("1", "D2"));
                    BaseObj.Prop.Add("scale_z", new Node("1", "D2"));
                    BaseObj.Prop.Add("l_id", new Node("0", "D1"));
                    for (int ix = 0; ix < numericUpDown2.Value; ix++)
                    {
                        LevelObj tmpObj = BaseObj.Clone();
                        ((Node)tmpObj.Prop["pos_x"]).StringValue = (X + ix * 1000).ToString();
                        ((Node)tmpObj.Prop["l_id"]).StringValue  = (++HighestId).ToString();
                        List.Add(tmpObj);
                    }
                    f.higestID["ObjInfo"] = HighestId;
                }
            }
            ClipBoardItem cl = new ClipBoardItem();

            cl.Type = ClipBoardItem.ClipboardType.ObjectArray;
            cl.Objs = List.ToArray();
            f.PasteValue(-1, f.GetListByName("ObjInfo"), "ObjInfo", cl);
            this.Close();
        }
コード例 #13
0
ファイル: LinksEditor.cs プロジェクト: bad1dea/OdysseyEditor
        void UpdateTreeView()
        {
            Level loadedLevel = ((Form1)Application.OpenForms[0]).LoadedLevel;

            treeView1.Nodes.Clear();
            treeView1.Nodes.Add("Links");
            foreach (string k in LinksNode.Keys)
            {
                var node = treeView1.Nodes[0].Nodes.Add(k);
                node.Tag = k;
                for (int i = 0; i < LinksNode[k].Count; i++)
                {
                    LevelObj obj = new LevelObj(LinksNode[k][i]);
                    node.Nodes.Add(obj.ToString()).Tag = obj;
                }
            }
            treeView1.Nodes[0].Expand();
        }
コード例 #14
0
    public static void setLevelDataToDefault()
    {
        currentLevelData         = null;
        currentLevelKey          = null;
        currentLevelDataFilePath = null;

        allLevelsData = new List <LevelObj>();;

        l1 = new LevelObj();
        l2 = new LevelObj();
        l3 = new LevelObj();

        gameData = new GameDataObj();
        gameData.defaultAchievementsMisssions();

        gameLog = "";

        initLevelDataDefaults();

        saveAllLevelDataFiles();
    }
コード例 #15
0
ファイル: Sorting.cs プロジェクト: ArtStudy/ToE2.0
        private static void CreateWeb()
        {
            int group = 0;

            for (int i = 0; i < levels.Count; i++)
            {
                LevelObj levelObj = levels[i].GetComponent <LevelObj>();
                if (levelObj.level.Parents.Count == 0)
                {
                    groups[i] = new Vector2(group, levelObj.level.ID);
                }
                if (levelObj.level.Parents.Count == 1)
                {
                    for (int j = 0; j < groups.Count; j++)
                    {
                    }
                    //      group = (ulong) groups[levelObj.level.Parents[0].ID].x + 1;
                    groups[i] = new Vector2(group, levelObj.level.ID);
                }
            }
            for (int i = 0; i < levels.Count; i++)
            {
                LevelObj levelObj = levels[i].GetComponent <LevelObj>();
                if (levelObj.level.Parents.Count > 1)
                {
                    for (int j = 0; j < levelObj.level.Parents.Count; j++)
                    {
                        int k = 0;
                        while ((ulong)groups[k].y != levelObj.level.Parents[j].ID)
                        {
                            k++;
                        }
                    }
                }
                groups[i] = new Vector2(group, levelObj.level.ID);
            }
        }
コード例 #16
0
        void ParseObject(LevelObj o)
        {
            internalObjectDatabaseEntry data;

            if (Objs.ContainsKey(o.Name))
            {
                data = Objs[o.Name];
            }
            else
            {
                data = new internalObjectDatabaseEntry();
                Objs.Add(o.Name, data);
            }

            foreach (var prop in (Dictionary <string, dynamic>)o.Prop)
            {
                if (prop.Value == null || data.Properties.ContainsKey(prop.Key))
                {
                    continue;
                }

                if (prop.Key == LevelObj.N_Links ||
                    prop.Key == LevelObj.N_ModelName ||
                    prop.Key == LevelObj.N_Name ||
                    prop.Key == LevelObj.N_Rotate ||
                    prop.Key == LevelObj.N_Scale ||
                    prop.Key == LevelObj.N_Translate ||
                    prop.Key == LevelObj.N_Id ||
                    prop.Key == LevelObj.N_UnitConfig ||
                    prop.Key == LevelObj.N_LinkDest ||
                    prop.Key == LevelObj.N_LayerConfigName ||
                    prop.Key == LevelObj.N_PlacementFileName ||
                    prop.Key == LevelObj.N_Comment ||
                    prop.Key == LevelObj.N_LinkReferenceList ||
                    prop.Key == LevelObj.N_ResourceCategory)
                {
                    continue;
                }

                if (prop.Value is IList <dynamic> )
                {
                    if (data.ArrWarn == null)
                    {
                        data.ArrWarn = new List <string>();
                    }
                    if (!data.ArrWarn.Contains(prop.Key))
                    {
                        data.ArrWarn.Add(prop.Key);
                    }
                }
                else if (prop.Value is IDictionary <string, dynamic> )
                {
                    if (data.DictWarn == null)
                    {
                        data.DictWarn = new List <string>();
                    }
                    if (!data.DictWarn.Contains(prop.Key))
                    {
                        data.DictWarn.Add(prop.Key);
                    }
                }
                else
                {
                    data.Properties.Add(prop.Key, ((Type)prop.Value.GetType()).Name);
                }
            }

            if (o.ContainsKey(LevelObj.N_ModelName) && o[LevelObj.N_ModelName] != null && !data.ModelNames.Contains(o[LevelObj.N_ModelName]))
            {
                data.ModelNames.Add(o[LevelObj.N_ModelName]);
            }

            if (o.ContainsKey(LevelObj.N_UnitConfig) && o[LevelObj.N_UnitConfig].ContainsKey(LevelObj.N_UnitConfigBaseClass))
            {
                if (data.ParameterConfigName != null)
                {
                    Debug.Assert(data.ParameterConfigName == ((string)o[LevelObj.N_UnitConfig][LevelObj.N_UnitConfigBaseClass]));
                }
                data.ParameterConfigName = o[LevelObj.N_UnitConfig][LevelObj.N_UnitConfigBaseClass];

                if (data.ParameterConfigName == o.Name)
                {
                    data.ParameterConfigName = null;
                }
            }

            if (o.ContainsKey(LevelObj.N_Links))
            {
                LinksNode n = o[LevelObj.N_Links];
                foreach (var k in n.Keys)
                {
                    if (data.LinkedObjs == null)
                    {
                        data.LinkedObjs = new Dictionary <string, List <string> >();
                    }

                    List <string> objNames = null;
                    if (data.LinkedObjs.ContainsKey(k))
                    {
                        objNames = data.LinkedObjs[k];
                    }
                    else
                    {
                        objNames = new List <string>();
                        data.LinkedObjs.Add(k, objNames);
                    }

                    foreach (dynamic d in n[k])
                    {
                        var g = new LevelObj(d);
                        if (!objNames.Contains(g.Name))
                        {
                            objNames.Add(g.Name);
                        }
                        ParseObject(g);
                    }
                }
            }
        }
コード例 #17
0
    GameObject CreateSceneObject(LevelObj item, Transform parent = null)
    {
        if (item is Chunk)
        {
            Debug.Log("Is Chunk");

            GameObject ChunkContainer = new GameObject(((Chunk)item).Name + "." + item.id.ToString());

            ChunkContainer.transform.position = new Vector3(1 * (float)(((Chunk)item).centerOfChunk.left) /
                                                            GlobalVariables.minifier, -1 * (float)(((Chunk)item).centerOfChunk.top) /
                                                            GlobalVariables.minifier, 0) + new Vector3(20.0f / GlobalVariables.minifier, 40.0f / GlobalVariables.minifier, item.position.depth);
            Debug.Log("Number of objects: " + ((Chunk)item).objects.Count + "Center of Chunk" + ((Chunk)item).centerOfChunk.top);

            ChunkData cData = ChunkContainer.AddComponent <ChunkData>();
            float     xMin  = ((Chunk)item).centerOfChunk.left + ((Chunk)item).objects[0].position.left;
            float     xMax  = ((Chunk)item).centerOfChunk.left + ((Chunk)item).objects[0].position.left + ((Chunk)item).objects[0].position.width;
            Debug.Log(xMax);
            foreach (var item2 in ((Chunk)item).objects)
            {
                if (item2.position.left + ((Chunk)item).centerOfChunk.left < xMin)
                {
                    xMin = item2.position.left + ((Chunk)item).centerOfChunk.left;
                }
                if (item2.position.left + item2.position.width + ((Chunk)item).centerOfChunk.left > xMax)
                {
                    xMax = item2.position.left + item2.position.width + ((Chunk)item).centerOfChunk.left;
                }
                CreateSceneObject(item2, ChunkContainer.transform);
            }
            Debug.Log(xMax + " " + xMin);
            ChunkContainer.GetComponent <ChunkData>().chunkLength = (xMax - xMin) / GlobalVariables.minifier;


            GameObject sample = AssetDatabase.LoadAssetAtPath("Assets/ChunkPrefabs/Prefabs/" + ((Chunk)item).Name + "." + item.id.ToString() + ".prefab", typeof(GameObject)) as GameObject;
            if (sample == null)
            {
                PrefabUtility.CreatePrefab("Assets/ChunkPrefabs/Prefabs/" + ChunkContainer.name + ".prefab", ChunkContainer.gameObject);
            }

            DestroyImmediate(ChunkContainer);

            return(AssetDatabase.LoadAssetAtPath("Assets/ChunkPrefabs/Prefabs/" + ((Chunk)item).Name + "." + item.id.ToString() + ".prefab", typeof(GameObject)) as GameObject);
        }
        else
        {
            GameObject   sceneObj;
            MeshFilter   tmpFilter;
            MeshRenderer tmpRenderer;
            Material     objMaterial       = AssetDatabase.LoadAssetAtPath("Assets/ChunkPrefabs/Materials/" + item.texture + item.id.ToString() + ".mat", typeof(Material)) as Material;
            GameObject   sceneObjContainer = GameObject.Find(item.texture + "." + item.id.ToString());
            if (sceneObjContainer == null || parent != null)
            {
                sceneObjContainer = new GameObject(item.texture + "." + item.id.ToString());
                sceneObj          = new GameObject(item.texture + "." + item.id.ToString() + "Sprite");
                tmpFilter         = sceneObj.AddComponent <MeshFilter>();
                tmpRenderer       = sceneObj.AddComponent <MeshRenderer>();
                if (objMaterial == null)
                {
                    objMaterial = new Material(Shader.Find("Transparent/Diffuse"));
                    AssetDatabase.CreateAsset(objMaterial, "Assets/ChunkPrefabs/Materials/" + item.texture + item.id.ToString() + ".mat");
                }
            }
            else
            {
                sceneObj    = sceneObjContainer.transform.GetChild(0).gameObject;
                tmpFilter   = sceneObj.GetComponent <MeshFilter>();
                tmpRenderer = sceneObj.GetComponent <MeshRenderer>();
                objMaterial = tmpRenderer.material;
            }

            string meshName = item.position.width.ToString() + "X" + item.position.height;
            Mesh   mesh     = AssetDatabase.LoadAssetAtPath("Assets/ChunkPrefabs/" + meshName + ".asset", typeof(Mesh)) as Mesh;

            if (mesh == null)
            {
                mesh          = new Mesh();
                mesh.vertices = new Vector3[] { new Vector3(0, 0, 0),
                                                new Vector3(0, (float)item.position.height / GlobalVariables.minifier, 0),
                                                new Vector3((float)item.position.width / GlobalVariables.minifier, 0, 0),
                                                new Vector3((float)item.position.width / GlobalVariables.minifier, (float)item.position.height / GlobalVariables.minifier, 0) };

                mesh.uv = new Vector2[] { new Vector2(0, 0),
                                          new Vector2(0, 1),
                                          new Vector2(1, 0),
                                          new Vector2(1, 1) };
                mesh.triangles = new int[] { 0, 1, 2, 3, 2, 1 };
                mesh.normals   = new Vector3[] { new Vector3(0, 0, -1), new Vector3(0, 0, -1), new Vector3(0, 0, -1), new Vector3(0, 0, -1) };
                //mesh.bounds = new Bounds (new Vector2 (mesh.bounds.center.x + (mesh.bounds.size.x / 2), mesh.bounds.center.y + (mesh.bounds.size.y / 2)), mesh.bounds.size);
                AssetDatabase.CreateAsset(mesh, "Assets/ChunkPrefabs/" + meshName + ".asset");
            }



            tmpFilter.mesh = mesh;
            objMaterial.SetTexture(0, Resources.Load <Texture>("Objects/" + item.texture));
            Shader defShader = Shader.Find("Transparent/Diffuse");

            objMaterial.shader   = defShader;
            objMaterial.color    = new Color(1, 1, 1);
            tmpRenderer.material = objMaterial;

            Camera levelCamera = SceneView.FindObjectOfType <Camera>();

            Debug.Log("______________________ Screen to world point: " + levelCamera.ScreenToWorldPoint(new Vector3(item.position.left, item.position.top, 0)));

            sceneObj.transform.parent = sceneObjContainer.transform;
            if ((sceneObjContainer.GetComponent <BoxCollider2D>() == null) && item.position.depth == 0)
            {
                sceneObjContainer.AddComponent <BoxCollider2D>();
            }

            if (sceneObjContainer.GetComponent <BoxCollider2D>() != null)
            {
                sceneObjContainer.GetComponent <BoxCollider2D>().size = mesh.bounds.size;
            }

            sceneObj.transform.localPosition = new Vector3(-1 * (float)item.position.width /
                                                           (GlobalVariables.minifier * 2), -1 * (float)item.position.height /
                                                           (GlobalVariables.minifier * 2), 0);

            sceneObjContainer.transform.position = new Vector3(1 * (float)item.position.left /
                                                               GlobalVariables.minifier, -1 * (float)item.position.top /
                                                               GlobalVariables.minifier, 0) + new Vector3((1 * (float)item.position.width /
                                                                                                           (GlobalVariables.minifier * 2)) + 1, (-1 * (float)item.position.height /
                                                                                                                                                 (GlobalVariables.minifier * 2)) + 2, parent == null ? item.position.depth : parent.position.z - item.position.depth);

            sceneObjContainer.transform.position += parent.position - new Vector3(25 / GlobalVariables.minifier, 50 / GlobalVariables.minifier, 0);
            sceneObjContainer.transform.parent    = parent;


            return(null);
        }
    }
コード例 #18
0
    public void RemoveObject(LevelObj o)
    {
        objects.Remove(o);

        AddImpassability(o.Collider, false);
    }