private void OnGUI()
        {
            EditorGUILayout.BeginVertical();
            EditorGUILayout.Space();

            _data.ShouldGenerateBorder = EditorGUILayout.Toggle("ShouldGenerateBorder: ", _data.ShouldGenerateBorder);
            _data.DecorationsCount     = EditorGUILayout.IntField("DecorationsCount: ", _data.DecorationsCount);
            _data.GridSize             = EditorGUILayout.Vector2Field("LevelGridSize: ", _data.GridSize);

            EditorGUILayout.Space();

            bool isConstructPressed = GUILayout.Button("Construct", GUILayout.MinWidth(250f));
            bool isClearPressed     = GUILayout.Button("Clear Scene", GUILayout.MinWidth(250f));

            EditorGUILayout.EndVertical();

            if (isConstructPressed)
            {
                if (IsInputValuesCorrect())
                {
                    LevelBuilder.Construct(_data);
                }
            }
            else if (isClearPressed)
            {
                LevelBuilder.ClearScene();
            }
        }
Пример #2
0
        private void LoadEnvironment(Environments e)
        {
            environment = e;
            texture     = Assets.Get(environment).texture;
            mat         = Assets.Get(environment).mat;

            textureSize.x = texture.width / pixelsPerTile;
            textureSize.y = texture.height / pixelsPerTile;

            dynamicMesh.CreateMesh(LevelBuilder.GenerateMesh(map, textureSize), texture, mat);

            if (!isInEditMode)
            {
                Destroy(skybox);
                skybox = Instantiate <GameObject> (Assets.Get(environment).skybox);
            }
        }
Пример #3
0
        private void EnterPlayTestMode()
        {
            skybox = Instantiate <GameObject> (Assets.Get(environment).skybox);

            LogicEntity e = Contexts.sharedInstance.logic.CreateEntity();

            e.AddCollider(new Determinism.RectilinearCollider(LevelBuilder.GenerateDeterministicCollider(map)));
            e.collider.value.mask = Mask.DEFAULT;
            e.collider.value.tag  = Tag.DEFAULT;

            FixedVector2[] spawnPositions = new FixedVector2[numPlayers];

            for (int i = 0; i < numPlayers; i++)
            {
                spawnPositions[i] = new FixedVector2(spawnPoints[i].transform.position);
            }

            Contexts.sharedInstance.logic.ReplaceSpawnPoints(spawnPositions);

            orthoCam.SetActive(false);
            cameraHolder.SetActive(true);

            isInEditMode = false;
        }
Пример #4
0
 private void GenerateMesh()
 {
     shouldGenerateMesh = false;
     dynamicMesh.UpdateMesh(LevelBuilder.GenerateMesh(map, textureSize));
 }