Exemplo n.º 1
0
	static Example.MapEvent ExportMapEvent(List<Example.MapEvent> events,MapEvent sceneEvent){

		Example.MapEvent mapEvent = new Example.MapEvent (); 
		mapEvent.EventType = (int)sceneEvent.eventType;  

		List<Example.MapEventCondition> conditions = new List<Example.MapEventCondition> (); 
		foreach (var condition in sceneEvent.Conditions) {
			Example.MapEventCondition cond = new Example.MapEventCondition ();

			var value =  new Example.ContentValue ();
			value.IntValue = condition.intValue;
			value.StrValue = condition.strValue;
			value.FloatValue = condition.floatValue;
			value.Vector3Value = MapUtil.ToVector3f(condition.posValue); 

			cond.Arg2 = value;
			conditions.Add (cond);
		}

		List<Example.MapEventAction> actions = new List<Example.MapEventAction> ();

		var mapActions = sceneEvent.GetComponentsInChildren<MapEventAction> ();
		foreach (var mapAction in mapActions) {
			var action = ExportMapEventAction (mapAction);
			actions.Add (action);
		}
		mapEvent.ExecuteCount = sceneEvent.executeCount;
		mapEvent.Interception = sceneEvent.interception;
		mapEvent.Conditions = conditions;
		mapEvent.Actions = actions;
		events.Add (mapEvent);
		mapEvent.Id = events.Count;
		sceneEvent.eventId = mapEvent.Id;

		return mapEvent;
	}