Jypeli  5
The simple game programming library
LevelData.cs
Siirry tämän tiedoston dokumentaatioon.
1 using System;
2 using System.Collections.Generic;
3 using System.Diagnostics;
4 using System.Reflection;
5 
6 namespace Jypeli.LevelEditor
7 {
8  [Save]
9  public class LevelData
10  {
11  [Save] public List<Template> Templates { get; private set; }
12  [Save] public List<LevelObject> Objects { get; private set; }
13 
14  public LevelData()
15  {
16  Templates = new List<Template>();
17  Objects = new List<LevelObject>();
18  }
19 
20  private int GetTemplateIndex( Template template )
21  {
22  int index = Templates.IndexOf( template );
23  if ( index >= 0 ) return index;
24 
25  Templates.Add( template );
26  return Templates.Count - 1;
27  }
28 
30  {
31  LevelObject newObj = new LevelObject( this, GetTemplateIndex( t ) );
32  Objects.Add( newObj );
33  return newObj;
34  }
35 
36  public void RemoveObject(LevelObject obj)
37  {
38  Objects.Remove( obj );
39  }
40 
41  public void Clear()
42  {
43  Templates.Clear();
44  Objects.Clear();
45  }
46  }
47 }
void RemoveObject(LevelObject obj)
Definition: LevelData.cs:36
LevelObject CreateObject(Template t)
Definition: LevelData.cs:29