private Actions.Sound BMLSoundToAction(GBML.Sound sound) { Actions.Sound.PlaybackMode mode = Actions.Sound.PlaybackMode.Regular; if (sound.ModeSpecified) mode = BMLSoundPlayModeToSoundPlayMode(sound.Mode); if (sound.end != null && sound.end != "") { if (sound.start != null && sound.start != "") { if (sound.id != null && sound.id != "") { //all params* return new Actions.Sound(sound.id, sound.SoundName, new Actions.SyncPoint(sound.start), new Actions.SyncPoint(sound.end), mode); } else { //all except id* return new Actions.Sound(sound.SoundName, new Actions.SyncPoint(sound.start), new Actions.SyncPoint(sound.end), mode); } } else { if (sound.id != null && sound.id != "") { //all except start return new Actions.Sound(sound.id, sound.SoundName, Actions.SyncPoint.Null, new Actions.SyncPoint(sound.end), mode); } else { //only end return new Actions.Sound(sound.SoundName, Actions.SyncPoint.Null, new Actions.SyncPoint(sound.end), mode); } } } else { if (sound.start != null && sound.start != "") { if (sound.id != null && sound.id != "") { //all except end* return new Actions.Sound(sound.id, sound.SoundName, new Actions.SyncPoint(sound.start), mode); } else { //only start* return new Actions.Sound(sound.SoundName, new Actions.SyncPoint(sound.start), mode); } } else { if (sound.id != null && sound.id != "") { //only id return new Actions.Sound(sound.id, sound.SoundName, mode); } else { //no params return new Actions.Sound(sound.SoundName, mode); } } } }
private Actions.Animation BMLAnimationToAction(GBML.Animation a) { Actions.Animation.AnimationInfluence influence = Actions.Animation.AnimationInfluence.FullBody; if (a.InfluenceSpecified) influence = BMLAnimationInfluenceToAnimationInfluence(a.Influence); if (a.end != null && a.end != "") { if (a.start != null && a.start != "") { if (a.id != null && a.id != "") { //all params* return new Actions.Animation(a.id, a.Name, new Actions.SyncPoint(a.start), new Actions.SyncPoint(a.end), influence); } else { //all except id* return new Actions.Animation(a.Name, new Actions.SyncPoint(a.start), new Actions.SyncPoint(a.end), influence); } } else { if (a.id != null && a.id != "") { //all except start return new Actions.Animation(a.id, a.Name, Actions.SyncPoint.Null, new Actions.SyncPoint(a.end), influence); } else { //only end return new Actions.Animation(a.Name, Actions.SyncPoint.Null, new Actions.SyncPoint(a.end), influence); } } } else { if (a.start != null && a.start != "") { if (a.id != null && a.id != "") { //all except end* return new Actions.Animation(a.id, a.Name, new Actions.SyncPoint(a.start), influence); } else { //only start* return new Actions.Animation(a.Name, new Actions.SyncPoint(a.start), influence); } } else { if (a.id != null && a.id != "") { //only id return new Actions.Animation(a.id, a.Name, influence); } else { //no params return new Actions.Animation(a.Name, influence); } } } }
private Actions.Sound.PlaybackMode BMLSoundPlayModeToSoundPlayMode(GBML.SoundPlayMode mode) { switch (mode) { case SoundPlayMode.LOOP: return Actions.Sound.PlaybackMode.Loop; default: return Actions.Sound.PlaybackMode.Regular; } }
private Actions.Locomotion BMLLocomotionToAction(GBML.Locomotion loco) { //try to parse target into x, y and angle string[] targetSplit = loco.target.Split(' '); bool isXY = false; float x = 0; float y = 0; float angle = 0; float f = 0f; if (targetSplit.Length > 0) { try { f = float.Parse(targetSplit[0], ifp); isXY = true; x = f; } catch { } } f = 0; if (isXY && targetSplit.Length > 1) { try { f = float.Parse(targetSplit[1], ifp); y = f; } catch { } } f = 0; if (isXY && targetSplit.Length > 2) { try { f = float.Parse(targetSplit[2], ifp); angle = f; } catch { } } if (loco.end != null && loco.end != "") { if (loco.start != null && loco.start != "") { if (loco.id != null && loco.id != "") { //all params* if (isXY) return new Actions.Locomotion(loco.id, new Actions.SyncPoint(loco.start), new Actions.SyncPoint(loco.end), x, y, angle); else return new Actions.Locomotion(loco.id, new Actions.SyncPoint(loco.start), new Actions.SyncPoint(loco.end), loco.target); }else{ //all except id* if (isXY) return new Actions.Locomotion(new Actions.SyncPoint(loco.start), new Actions.SyncPoint(loco.end), x, y, angle); else return new Actions.Locomotion(new Actions.SyncPoint(loco.start), new Actions.SyncPoint(loco.end), loco.target); } }else{ if (loco.id != null && loco.id != "") { //all except start if (isXY) return new Actions.Locomotion(loco.id, Actions.SyncPoint.Null, new Actions.SyncPoint(loco.end), x, y, angle); else return new Actions.Locomotion(loco.id, Actions.SyncPoint.Null, new Actions.SyncPoint(loco.end), loco.target); }else{ //only end if (isXY) return new Actions.Locomotion(Actions.SyncPoint.Null, new Actions.SyncPoint(loco.end), x, y, angle); else return new Actions.Locomotion(Actions.SyncPoint.Null, new Actions.SyncPoint(loco.end), loco.target); } } }else{ if (loco.start != null && loco.start != "") { if (loco.id != null && loco.id != "") { //all except end* if (isXY) return new Actions.Locomotion(loco.id, new Actions.SyncPoint(loco.start), x, y, angle); else return new Actions.Locomotion(loco.id, new Actions.SyncPoint(loco.start), loco.target); }else{ //only start* if (isXY) return new Actions.Locomotion(new Actions.SyncPoint(loco.start), x, y, angle); else return new Actions.Locomotion(new Actions.SyncPoint(loco.start), loco.target); } }else{ if (loco.id != null && loco.id != "") { //only id if (isXY) return new Actions.Locomotion(loco.id, x, y, angle); else return new Actions.Locomotion(loco.id, loco.target); }else{ //no params if (isXY) return new Actions.Locomotion(loco.target, x, y, angle); else return new Actions.Locomotion(loco.target); } } } }
private Constraint.Constraint BmlConstraintToGMBConstraint(GBML.Constraint c) { Constraint.Constraint gmbc = null; if (c.after != null) gmbc = new Constraint.After(); if (c.before != null) gmbc = new Constraint.Before(); if (c.synchronize != null) gmbc = new Constraint.Synchronize(); return gmbc; }