Example #1
0
	// Use this for initialization
	void Start () 
	{
		_levelGridComponent = LevelGridComponent.Instance;
		_currentCellPosition = _levelGridComponent.GetCellIndexes(CachedTransform.position);
		ChangeControllerState(ControllerStates.Stand);


	}
Example #2
0
	TextAsset SerializeGridData(LevelGridComponent.SCellValue[,] GridData, string path)
	{



		GridDataSerilizetion sr = new GridDataSerilizetion();
		sr.Height = GridData.GetLength(0);
		sr.Widht = GridData.GetLength(1);

		for(int i=0; i<GridData.GetLength(0); i++)
		{
			for(int j=0; j<GridData.GetLength(1); j++)
			{
				GridDataSerilizetion.Cell cell = new GridDataSerilizetion.Cell();
				cell.ConerListVertexIndexes = new int[4];
				cell.X=i;
				cell.Y=j;
				cell.CellContainValue = GridData[i,j].CellContainValue;
				for(int q=0; q<4; q++)
					cell.ConerListVertexIndexes[q] = GridData[i,j].ConerListVertexIndexes[q];
				sr.Cells.Add(cell);
			}
		}

		XmlSerializer serializer = new XmlSerializer(typeof(GridDataSerilizetion));
		StringWriter textWriter = new StringWriter();

		StreamWriter fileWriter = new StreamWriter(path);

		serializer.Serialize(fileWriter, sr);
		string xml = textWriter.ToString();

		AssetDatabase.Refresh();
		TextAsset result = (TextAsset) AssetDatabase.LoadAssetAtPath(path,typeof(TextAsset));
		fileWriter.Close();
//		result. = xml;

		return result;
	}
Example #3
0
	void OnEnable ()
	{
		s_target = (LevelGridComponent)target;
	}
Example #4
0
	protected override void Awake()
	{
		base.Awake();
		_instance = this;
		InitComponents ();
	}