コード例 #1
0
		public static LevelTriggersCause saveTriggerCause(Cause c)
		{
			LevelTriggersCause causeData = new LevelTriggersCause();
			switch (c.GetType().Name)
			{
				case "CauseAND":
					CauseAND cAND = (CauseAND)c;
					causeData.Value = cAND.Cause1.ID + "," + cAND.Cause2.ID;
					causeData.type = causeType.CauseAND;
					break;
				case "CauseButton":
					causeData.Value = ((CauseButton)c).Button.ID;
					causeData.type = causeType.CauseButton;
					break;
				case "CauseEntityDestruction":
					causeData.Value = ((CauseEntityDestruction)c).Entity.ID;
					causeData.type = causeType.CauseEntityDestruction;
					break;
				case "CauseLocation":
					CauseLocation cl = (CauseLocation)c;
					causeData.Value = cl.Player + "," + cl.MinimumX + "," + cl.MaximumX + "," + cl.MinimumY + "," + cl.MaximumY;
					causeData.type = causeType.CauseLocation;
					break;
				case "CauseNOT":
					causeData.Value = ((CauseNOT)c).Cause.ID;
					causeData.type = causeType.CauseNOT;
					break;
				case "CauseOR":
					CauseOR cOR = (CauseOR)c;
					causeData.Value = cOR.Cause1.ID + "," + cOR.Cause2.ID;
					causeData.type = causeType.CauseOR;
					break;
				case "CauseTimePassed":
					causeData.Value = ((CauseTimePassed)c).TriggerTime.ToString();
					causeData.type = causeType.CauseTimePassed;
					break;
				case "CauseXOR":
					CauseXOR cXOR = (CauseXOR)c;
					causeData.Value = cXOR.Cause1.ID + "," + cXOR.Cause2.ID;
					causeData.type = causeType.CauseXOR;
					break;
				default:
					return null;
			}
			causeData.id = c.ID;
			return causeData;
		}