public void StartWorld(bool isPreview)
    {
        WorldConstants.MirrorContainer = new GameObject("Mirror Objects");
        WorldConstants.WallContainer   = new GameObject("Walls");

        //Get some references.
        CreateLevel     levG = WorldConstants.MatchWrapper.GetComponent <CreateLevel>();
        GenerateObjects objG = WorldConstants.MatchWrapper.GetComponent <GenerateObjects>();

        //Take ownership of the game rules.
        if (!isPreview)
        {
            MatchRules       = MatchData.MatchSettings;
            MatchRules.Owner = this;
            MatchStarted     = true;
        }
        CountdownToGameEnd = new System.TimeSpan(MatchRules.MatchLength.Ticks);

        //Create the level and objects.
        levG.SetGenerationData(MatchData.GeneratedLevel, MatchData.Spawns);
        WorldConstants.LevelOffset = Vector2.zero;
        levG.Generate(Vector2.zero, isPreview);
        objG.Generate(MatchData, isPreview);

        //Start crowd cheering.
        if (!isPreview)
        {
            WorldConstants.CrowdCheering.StartCheering();
            WorldConstants.CrowdCheering.CreateCrowdCheer(CrowdCheers.Events.GameStart);
        }
    }
    void LevelGenerator()
    {
        levelList.Clear();
        foreach (Transform child in scrollViewPanel.transform)
        {
            GameObject.Destroy(child.gameObject);
        }
        //
        GameObject backBtn = GameObject.Instantiate(backBtnObject);

        backBtn.transform.SetParent(scrollViewPanel.transform);
        try
        {
            ds = new DBService();
            IEnumerable <LevelScore> lList = ds.getConnection().Table <LevelScore>();
            foreach (LevelScore lScore in lList)
            {
                totalLevel++;
                bool        isLock = lScore.Lock;
                int         score  = lScore.LastScore;
                CreateLevel level  = new CreateLevel(isLock, totalLevel, score, gameObjectIni, levelSprite);
                level.getGeneratedLevel().transform.SetParent(scrollViewPanel.transform);
                //Adding to the list
                levelList.Add(level);
            }
        }
        catch (Exception ex)
        {
            print(ex.ToString());
        }
        finally
        {
            ds.DisConnect();
        }
    }
Example #3
0
    void CreateNewLevel()
    {
        // There is no overwrite protection here!
        // There is No "Are you sure you want to overwrite your existing object?" if it exists.
        // This should probably get a string from the user to create a new name and pass it ...

        level = CreateLevel.Create();
    }
    void LoadLevelActual(LevelSaveable levelSaveable)
    {
        for (int i = 0; i < levelSaveable.saveLevelObjects_List.Count; i++)
        {
            SaveableLevelObject s_obj = levelSaveable.saveLevelObjects_List[i];

            Node nodeToPlace = GridGenerator.GetInstance().grid[s_obj.posX, s_obj.posZ];

            GameObject go = Instantiate(
                ResourceManager.GetInstance().GetObjBase(s_obj.obj_Id).objPrefab,
                nodeToPlace.vis.transform.position,
                Quaternion.Euler(
                    s_obj.rotX,
                    s_obj.rotY,
                    s_obj.rotZ))
                            as GameObject;

            nodeToPlace.placedObj               = go.GetComponent <CreateLevel>();
            nodeToPlace.placedObj.gridPosX      = nodeToPlace.nodePosX;
            nodeToPlace.placedObj.gridPosZ      = nodeToPlace.nodePosZ;
            nodeToPlace.placedObj.worldRotation = nodeToPlace.placedObj.transform.localEulerAngles;
        }

        for (int i = 0; i < levelSaveable.saveStackableObjects_List.Count; i++)
        {
            SaveableLevelObject s_obj = levelSaveable.saveStackableObjects_List[i];

            Node nodeToPlace = GridGenerator.GetInstance().grid[s_obj.posX, s_obj.posZ];

            GameObject go = Instantiate(
                ResourceManager.GetInstance().GetStackObjBase(s_obj.obj_Id).objPrefab,
                nodeToPlace.vis.transform.position,
                Quaternion.Euler(
                    s_obj.rotX,
                    s_obj.rotY,
                    s_obj.rotZ))
                            as GameObject;

            CreateLevel stack_obj = go.GetComponent <CreateLevel>();
            stack_obj.gridPosX = nodeToPlace.nodePosX;
            stack_obj.gridPosZ = nodeToPlace.nodePosZ;

            nodeToPlace.stackedObjs.Add(stack_obj);
        }

        for (int i = 0; i < levelSaveable.saveNodeObjectsList.Count; i++)
        {
            Node node =
                GridGenerator.GetInstance().grid[levelSaveable.saveNodeObjectsList[i].posX,
                                                 levelSaveable.saveNodeObjectsList[i].posZ];

            node.vis.GetComponent <Node_Object>().UpdateNodeObject(node, levelSaveable.saveNodeObjectsList[i]);
        }
    }
Example #5
0
    private void Awake()
    {
        //Gather together all references you will need later on
        if (Instance == null)
        {
            Instance = this;
        }

        //Build the values for xExt and zExt from xHalfExt and zHalfExt
        _xExt = 2 * xHalfExt + 1;
        _zExt = 2 * zHalfExt + 1;

        _cells            = new Cell[_xExt, _zExt];
        _backTrackerStack = new Stack <Cell>();

        //Build an offset for the dynamic play field from the BasePlatform e.g. the bigger halfExtent value in unity units
        var offset = Math.Max(xHalfExt, zHalfExt);

        //Calculate a scale factor for scaling the non-movable environment (and therefore the camera) and the BasePlatform
        // the factors that the environment are scaled for right now are for x/zHalfExt =1, scale accordingly
        //i.e. the play field/environment should be as big as the dynamic field
        floor.transform.localScale = new Vector3(_xExt * TileSize, 1, _zExt * TileSize);
        floor.transform.Translate(Vector3.up * -offset);



        //Scale Environment
        // if the offset is 0 or 1 we do not change the scale
        // otherwise we scale the environment stepwise with an increase of 0.3
        var scaleValue = offset < 2 ? DefaultScaleValue : DefaultScaleValue + IncreaseScaleFactor * (offset - 1f);

        environment.transform.localScale = new Vector3(scaleValue, scaleValue, scaleValue);

        if (root != null)
        {
            CreateOuterWalls();
            CreateInnerWalls();

            // Make the initial cell the current cell and mark it as visited
            _currentCell         = _cells[0, 0];
            _currentCell.Visited = true;

            //create a maze
            //Build the maze from the given set of prefabs
            //Set the walls for the maze (place only one wall between two cells, not two!)
            CreateMaze();

            CreateExit();

            //Place the PlayerBall above the play field
            PlaceBallStart();
        }
    }
Example #6
0
    void Start()
    {
        //Get the camera if this is a player.
        if (gameObject.name.Contains("Player"))
        {
            IDData     id = GetComponent <IDData>();
            string     s  = id.PlayerID + " Camera";
            GameObject o  = GameObject.Find(s);
            Cam = o.transform;
        }

        Self    = transform;
        GenData = WorldConstants.MatchWrapper.GetComponent <CreateLevel>();
    }
    public void InitLevel()
    {
        //Debug.Log("Loaded level with " + SceneChangeHelper._mapSize + " and " + SceneChangeHelper._mapOrientation);
        // Create level on selected parameters
        _levelCreator = new CreateLevel(0, 0, SceneChangeHelper._mapSize, SceneChangeHelper._mapOrientation);
        //_levelCreator = new CreateLevel(0, 0, mapSize, mapOrientation);
        // Get player and set new position
        var go = GameObject.FindGameObjectWithTag("Player");

        go.transform.Translate(GetPlayerSpawnX(SceneChangeHelper._mapSize, SceneChangeHelper._mapOrientation));

        //Debug.Log(go.name + "( "+go.transform.position+" )");

        UnpackAndInstantiateChunks();
    }
Example #8
0
    private void Start()
    {
        instance = this;
        int tempCounter = 0;

        for (int i = (int)(-(GameScene.ScreenAspect / 2 - 50) / 250); i <= (int)((GameScene.ScreenAspect / 2 - 50) / 250); i++)
        {
            PossiblePlace.Add(new List <Vector2>());
            for (int j = (int)(-(Screen.height / 2 - 300) / 250); j <= (int)((Screen.height / 2 - 400) / 250); j++)
            {
                PossiblePlace[tempCounter].Add(new Vector2(i * 2.5f, j * 2.5f));
            }
            tempCounter++;
        }
    }
    new public void OnInspectorGUI()
    {
        DrawDefaultInspector();

        _createLevel     = (CreateLevel)target;
        _wallPrefab      = _createLevel.wall;
        _innerWallPrefab = _createLevel.innerWall;

        // Creates two buttons in the editor, which are placed side by side,
        // and triggers the provided functions, based on the conditions specified.
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Create Border"))
        {
            if (!_isScriptActive)
            {
                BuildBorder();
            }
        }

        if (GUILayout.Button("Delete Border"))
        {
            if (!_isScriptActive)
            {
                DeleteBorder();
            }
        }
        EditorGUILayout.EndHorizontal();

        // Same as creating outer walls, except this time, we generate inner walls!
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Create Inner Walls"))
        {
            if (!_isScriptActive)
            {
                BuildInnerWalls();
            }
        }

        if (GUILayout.Button("Delete Inner Walls"))
        {
            if (!_isScriptActive)
            {
                DeleteInnerWalls();
            }
        }
        EditorGUILayout.EndHorizontal();
    }
Example #10
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        leftWallPos    = GameObject.FindGameObjectWithTag("LeftWall").transform.position;
        rightWallPos   = GameObject.FindGameObjectWithTag("RightWall").transform.position;
        startSpawnYPos = GameObject.FindGameObjectWithTag("Roof").transform.position.y - 2f;

        spawnXPos      = leftWallPos.x + 3f;
        startSpawnXPos = spawnXPos;

        firstBrickPos = new Vector3(spawnXPos, startSpawnYPos, 0f);

        CreateGroupOfBlocks();
    }
Example #11
0
    public void OnSceneGUI()
    {
        CreateLevel creator = (CreateLevel)target;

        if (creator.Editing)
        {
            Event e = Event.current;
            if (e.type == EventType.MouseDown && (!e.control && !e.alt))
            {
                if (e.button == 0)
                {
                    RaycastHit hit;
                    if (Physics.Raycast(HandleUtility.GUIPointToWorldRay(e.mousePosition), out hit))
                    {
                        if (hit.transform.GetComponent <CreateLevel>() != null)
                        {
                            creator.Addcell(creator.transform.InverseTransformPoint(hit.point));
                            EditorUtility.SetDirty(creator.gameObject);
                        }
                    }
                }
                else if (e.button == 1)
                {
                    RaycastHit hit;
                    if (Physics.Raycast(HandleUtility.GUIPointToWorldRay(e.mousePosition), out hit))
                    {
                        if (hit.transform.GetComponent <CreateLevel>() != null)
                        {
                            creator.Removecell(creator.transform.InverseTransformPoint(hit.point));
                            EditorUtility.SetDirty(creator.gameObject);
                        }
                    }
                }
            }
            HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive));
        }
    }
    /// <summary>
    /// Handles the logic when the Next button is pressed
    /// </summary>
    private void _on_NextBtn_pressed()
    {
        string levelName = levelNameLine.Text;
        //int monsterId = Int32.Parse(monsterIdBtn.Text);
        int monsterId = monsterList[count].MonsterId;
        int timeLimit = Int32.Parse(timeLimitBtn.Text);


        if (levelName == "")
        {
            GD.Print("Level name field is empty!");
            errorMessageLabel.SetText("Level name field is empty!");
        }
        else if (CreateLevelBL.CheckValidLevelName(levelName) != 1)
        {
            GD.Print("Level name already exist!");
            errorMessageLabel.SetText("Level name already exist!");
        }
        else
        {
            GetTree().ChangeScene("res://Presentation/CreateLevel/CreateLevel.tscn");
            CreateLevel.SetLevelInitInfo(levelName, monsterId, timeLimit);
        }
    }
Example #13
0
 void CreateNewLevel()
 {
     waveViewIndex = 1;
     level         = CreateLevel.Create(newLevelName, mapWidth, mapHeight);
     if (level)
     {
         //level.itemList = new List<InventoryItem>();
         string relPath = AssetDatabase.GetAssetPath(level);
         EditorPrefs.SetString("ObjectPath", relPath);
         startingTiles = new HashSet <Tile>();
         endingTiles   = new HashSet <Tile>();
         foreach (Tile tile in level.mapData.tiles)
         {
             if (tile.IsEndingPoint)
             {
                 endingTiles.Add(tile);
             }
             if (tile.IsStartingPoint)
             {
                 startingTiles.Add(tile);
             }
         }
     }
 }
Example #14
0
 // Use this for initialization
 void Start()
 {
     gameCtrl = FindObjectOfType <CreateLevel>();
 }
Example #15
0
 // Use this for initialization
 void Start()
 {
     createLevel = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CreateLevel>();
 }
Example #16
0
    // Use this for initialization
    void Start()
    {
        player = this.gameObject.GetComponent<Player>();
        playerController = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<PlayerController>();
        playerObject = this.gameObject.GetComponent<PlayerObject>();
        createLevel = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CreateLevel>();

        canMove = false;
        movedDistance = 0;
        walkedDistance = 0;

        endingTurn = false;

        if(this.name == "Player00")
            toBeChecked = 1;
        else if(this.name == "Player01")
            toBeChecked = 2;
        else if(this.name == "Player02")
            toBeChecked = 3;
        else if(this.name == "Player03")
            toBeChecked = 4;

        for(int x = 0; x < 10; x++)
        {
            for(int y = 0; y < 10; y++)
            {
                if(playerController.PlayerLevelInformation[x, y] == toBeChecked)
                    currentArrayPosition = new Vector2(x, y);
            }
        }
    }
 // Use this for initialization
 private void Start()
 {
     //Get a
     _gameCtrl = CreateLevel.Instance;
 }
Example #18
0
 // Use this for initialization
 void Start()
 {
     createLevel = GameObject.FindGameObjectWithTag("mainCamera").GetComponent<CreateLevel>();
     LastFrameAreaData = createLevel.lvlInformation;
 }
Example #19
0
 void Start()
 {
     createLevel = GameObject.Find("LevelManager").GetComponent <CreateLevel>();
 }
Example #20
0
    void OnGUI()
    {
        // Set the border
        customStyle.border = new RectOffset(5, 5, 5, 5);

        // Set the background
        customStyle.normal.background = GUI.skin.textArea.normal.background;

        // Set the padding around the text
        customStyle.padding = new RectOffset(10, 10, 10, 10);

        EditorGUILayout.Space();

        EditorGUILayout.LabelField("Ascii Map Editor", centeredStyle);

        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();

        EditorGUILayout.BeginVertical();

        EditorGUILayout.LabelField("Font: ", EditorStyles.boldLabel, GUILayout.Width(120));

        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical();

        EditorGUI.BeginChangeCheck();
        indexF = EditorGUILayout.Popup(indexF, systemFonts);

        if (EditorGUI.EndChangeCheck())
        {
            font             = systemFonts[indexF];
            customStyle.font = Font.CreateDynamicFontFromOSFont(font, 12);
        }

        EditorGUILayout.EndVertical();

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();

        EditorGUILayout.BeginVertical();

        EditorGUILayout.LabelField("Select Level File: ", EditorStyles.boldLabel, GUILayout.Width(120));

        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical();

        EditorGUI.BeginChangeCheck();
        indexL = EditorGUILayout.Popup(indexL, levelObjectNames.ToArray());

        if (EditorGUI.EndChangeCheck())
        {
            txtSource = levelObjects[indexL];
        }
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical();

        if (GUILayout.Button("New", GUILayout.Height(14)))
        {
            CreateLevel.Create();
            GetLevels();
        }

        EditorGUILayout.EndVertical();

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();

        //txtSource = EditorGUILayout.ObjectField(txtSource, typeof(Object), true);

        TextAsset newTxtAsset = (TextAsset)txtSource;

        if (newTxtAsset != txtAsset)
        {
            ReadTextAsset(newTxtAsset);
        }

        scroll = EditorGUILayout.BeginScrollView(scroll, customStyle);
        EditorGUI.BeginChangeCheck();
        text = EditorGUILayout.TextArea(text, customStyle);
        if (EditorGUI.EndChangeCheck())
        {
            //Undo.RecordObject(text, "Changed Level Text");
            fileChanged = true;
        }
        EditorGUILayout.EndScrollView();

        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();

        if (fileChanged)
        {
            EditorGUILayout.LabelField("Your file is NOT saved", EditorStyles.boldLabel);
            GUI.enabled = true; // Enable following control (Button for saving)
        }
        else
        {
            EditorGUILayout.LabelField("Your file is saved", EditorStyles.boldLabel);
            GUI.enabled = false; // Disable following control (Button for saving)
        }

        if (GUILayout.Button("Save"))
        {
            SaveTextAsset(text, txtSource);
        }
        //EditorGUILayout.Space();

        EditorGUILayout.EndHorizontal();
        EditorGUILayout.Space();
    }
    void Start()
    {
        //Get the cached references.
        if (LevelGen == null)
        {
            GameObject g = WorldConstants.MatchWrapper;
            LevelGen = g.GetComponent <CreateLevel>();
            creator  = WorldConstants.Creator;
        }

        bool wrapX = LevelGen.LevelGen.GenSettings.WrapX,
             wrapY = LevelGen.LevelGen.GenSettings.WrapY;

        GameObject temp;

        if (wrapX)
        {
            for (int i = -1; i <= 1; ++i)
            {
                if (i != 0)
                {
                    temp = creator.CreateMirrorObject(name, gameObject, new Vector3(i * Constants.Size.x, 0, 0));

                    if (temp != null)
                    {
                        temp.layer = gameObject.layer;
                    }
                }
            }
        }
        if (wrapY)
        {
            for (int j = -1; j <= 1; ++j)
            {
                if (j != 0)
                {
                    temp = creator.CreateMirrorObject(name, gameObject, new Vector3(0, j * Constants.Size.y, 0));

                    if (temp != null)
                    {
                        temp.layer = gameObject.layer;
                    }
                }
            }
        }

        if (wrapX && wrapY)
        {
            temp = creator.CreateMirrorObject(name, gameObject, new Vector3(-Constants.Size.x, -Constants.Size.y, 0));
            if (temp != null)
            {
                temp.layer = gameObject.layer;
            }

            temp = creator.CreateMirrorObject(name, gameObject, new Vector3(Constants.Size.x, -Constants.Size.y, 0));
            if (temp != null)
            {
                temp.layer = gameObject.layer;
            }

            temp = creator.CreateMirrorObject(name, gameObject, new Vector3(-Constants.Size.x, Constants.Size.y, 0));
            if (temp != null)
            {
                temp.layer = gameObject.layer;
            }

            temp = creator.CreateMirrorObject(name, gameObject, new Vector3(Constants.Size.x, Constants.Size.y, 0));
            if (temp != null)
            {
                temp.layer = gameObject.layer;
            }
        }
    }
Example #22
0
    void OnGUI()
    {
        GUILayout.BeginHorizontal();
        GUILayout.Label("Level Editor", EditorStyles.boldLabel);
        if (level != null)
        {
            if (GUILayout.Button("Show Level"))
            {
                EditorUtility.FocusProjectWindow();
                Selection.activeObject = level;
            }
        }
        if (GUILayout.Button("Open Level"))
        {
            OpenLevel();
        }
        if (GUILayout.Button("New Level"))
        {
            EditorUtility.FocusProjectWindow();
            level = CreateLevel.Create();
            Selection.activeObject = level;
        }
        GUILayout.EndHorizontal();
        GUILayout.Space(20);


        if (level != null)
        {
            level.numLevel = EditorGUILayout.IntField("Numero du niveau", level.numLevel);
            GUILayout.Label("Events : ");
            if (GUILayout.Button("Add Event", GUILayout.ExpandWidth(false)))
            {
                level.addWave();
            }
            scrollPosition = GUILayout.BeginScrollView(scrollPosition);


            for (int i = 0; i < level.eventList.Count; i++)
            {
                Rect rectEvent = EditorGUILayout.BeginVertical();
                rectEvent.x += 5;
                GUI.Box(rectEvent, GUIContent.none);
                GUILayout.BeginHorizontal();
                GUILayout.Space(5);
                GUILayout.Label("Event " + (i + 1) + " :");
                GUILayout.Label("nb Dialog : " + level.eventList[i].dialogs.Count);
                GUILayout.Label("nb Enemy : " + level.eventList[i].enemies.Count);

                level.eventList[i].show = ((bool)EditorGUILayout.Toggle("Show", level.eventList[i].show, GUILayout.ExpandWidth(false)));

                if (GUILayout.Button("Delete", GUILayout.ExpandWidth(false)))
                {
                    level.deleteWave(i);
                    continue;
                }
                if (GUILayout.Button("Insert", GUILayout.ExpandWidth(false)))
                {
                    level.insertWave(i);
                }
                GUILayout.EndHorizontal();
                if (!level.eventList[i].show)
                {
                    EditorGUILayout.EndVertical();
                    continue;
                }
                level.eventList[i].time = EditorGUILayout.FloatField("Seconds for the Wave", level.eventList[i].time);

                GUILayout.BeginHorizontal();
                GUILayout.Space(5);
                if (GUILayout.Button("Add Dialog", GUILayout.ExpandWidth(false)))
                {
                    level.eventList[i].addDialog();
                }
                GUILayout.EndHorizontal();

                for (int j = 0; j < level.eventList[i].dialogs.Count; j++)
                {
                    Rect rect = EditorGUILayout.BeginVertical();
                    rect.x += 10;
                    GUI.Box(rect, GUIContent.none);
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(10);
                    GUILayout.Label("Dialog " + (j + 1) + " :");
                    if (GUILayout.Button("Delete Dialog", GUILayout.ExpandWidth(false)))
                    {
                        level.eventList[i].deleteDialog(j);
                        continue;
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(15);
                    level.eventList[i].dialogs[j].isFunction = (bool)EditorGUILayout.Toggle("Is a function dialog", level.eventList[i].dialogs[j].isFunction, GUILayout.ExpandWidth(false));
                    if (level.eventList[i].dialogs[j].isFunction)
                    {
                        level.eventList[i].dialogs[j].functionName = EditorGUILayout.TextField("Function's name", level.eventList[i].dialogs[j].functionName);
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(15);
                    GUILayout.Label("Content");
                    level.eventList[i].dialogs[j].content = GUILayout.TextArea(level.eventList[i].dialogs[j].content);
                    GUILayout.EndHorizontal();
                    EditorGUILayout.EndVertical();
                }
                GUILayout.BeginHorizontal();
                GUILayout.Space(5);
                if (GUILayout.Button("Add Enemy", GUILayout.ExpandWidth(false)))
                {
                    level.eventList[i].addEnemy();
                }
                GUILayout.EndHorizontal();


                for (int j = 0; j < level.eventList[i].enemies.Count; j++)
                {
                    Rect rect = EditorGUILayout.BeginVertical();
                    rect.x += 10;
                    GUI.Box(rect, GUIContent.none);
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(10);
                    GUILayout.Label("Enemy " + (j + 1) + " :");
                    if (GUILayout.Button("Delete Enemy", GUILayout.ExpandWidth(false)))
                    {
                        level.eventList[i].deleteEnemy(j);
                        continue;
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(15);
                    level.eventList[i].enemies[j].enemy = (GameObject)EditorGUILayout.ObjectField("Enemy type", level.eventList[i].enemies[j].enemy, typeof(GameObject), false);
                    GUILayout.Label("Prefab of the enemy.");
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(15);
                    level.eventList[i].enemies[j].spawnpoint = EditorGUILayout.IntField("Enemy spawnpoint", level.eventList[i].enemies[j].spawnpoint);
                    GUILayout.Label("0 : random, 1 : up, 2 : mid, 3 : bottom.");
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(15);
                    level.eventList[i].enemies[j].function = EditorGUILayout.TextField("Enemy function", level.eventList[i].enemies[j].function);
                    GUILayout.Label("Set the function of this enemy.");
                    GUILayout.EndHorizontal();
                    EditorGUILayout.EndVertical();
                }
                EditorGUILayout.EndVertical();
            }
            GUILayout.EndScrollView();
        }
        if (GUI.changed)
        {
            EditorUtility.SetDirty(level);
        }
    }
Example #23
0
 void Start()
 {
     cl   = FindObjectOfType <CreateLevel>();
     boom = Resources.Load <GameObject>("Effect/Boom/Boom"); //加载特效
     clip = Resources.Load <AudioClip>("Audio/Boom");        //加载声音
 }