Beispiel #1
0
	static Example.MapArea ExportMapArea(List<Example.MapArea> areas,MapArea mapArea){
		Example.MapArea area = new Example.MapArea ();
		area.type = (Example.MapArea.Type)(mapArea.areaType); 
		area.Center = MapUtil.ToVector3f(mapArea.transform.position);
		area.Rotation =  MapUtil.ToVector3f(mapArea.transform.rotation.eulerAngles);
		area.Audio = mapArea.audioPath;

		var scale = mapArea.transform.localScale;

		if (mapArea.GetComponent<SphereCollider> () != null) {
			area.shape = Example.MapArea.Shape.CIRCLE;
			area.Radius = mapArea.GetComponent<SphereCollider> ().radius * Mathf.Max(scale.x,Mathf.Max(scale.y,scale.z)); 
		}
		if (mapArea.GetComponent<BoxCollider> () != null) { 
			var size = mapArea.GetComponent<BoxCollider> ().size;
			area.shape = Example.MapArea.Shape.BOX;
			area.Size = MapUtil.ToVector3f( new Vector3(size.x * scale.x,size.y*scale.y,size.z*scale.z)); 
		} 
		 
		areas.Add (area); 
		area.Id = areas.Count;
		mapArea.areaId = area.Id;

		return area;
	}