Difference between revisions of "LevelEditor"

From Project Wiki
Jump to navigation Jump to search
Line 50: Line 50:
 
# Use a binary formatter to decrypt the data into a LevelData
 
# Use a binary formatter to decrypt the data into a LevelData
 
# Clearing the level by destroying all objects of the "Parent" tagged object
 
# Clearing the level by destroying all objects of the "Parent" tagged object
# Building the level by instantiating every object from LevelData as child of the "Parent" tagged object
+
# Building the level by instantiating every object from LevelData as child of the "Parent" tagged object according to the list of prefabs given by the ObjectTemplate
  
 
[[Category:InProgress]]
 
[[Category:InProgress]]

Revision as of 12:47, 6 May 2021

How to use the Level Editor?

Placing Objects:

  1. Aim the cursor at the place you want to place the object
  2. Check that the outline is green
  3. Click the left mouse button

Removing Objects:

  1. Aim the cursor at the place you want to remove the object
  2. Check that the outline is red
  3. Click the right mouse button

Saving Levels:

  1. Click the 'Save Level' button

Loading Levels:

  1. Click the 'Load Level' button

How does the Level Editor work?

Placing Objects:

  1. Checking the world position of the cursor
  2. Checking if the grid is empty or not
  3. Instantiating the selected object as child of the "Parent" tagged object

Removing Objects:

  1. Checking the world position of the cursor
  2. Checking if the grid is empty or not
  3. Destroy object in selected grid

Saving Levels:

  1. Find all categorised objects using tags (Wall, Sentry, etc.)
  2. Convert them all into a stripped down serializable datatype
  3. Insert the stripped down data into an array
  4. Create a LevelData from all of the data arrays
  5. Use a binary formatter to encrypt the level data
  6. Save the encrypted data to file

Loadng Levels:

  1. Read the data from file
  2. Use a binary formatter to decrypt the data into a LevelData
  3. Clearing the level by destroying all objects of the "Parent" tagged object
  4. Building the level by instantiating every object from LevelData as child of the "Parent" tagged object according to the list of prefabs given by the ObjectTemplate