public RandomEffectEditor() { this.effect = new RandomEffect(); removeTexture = Resources.Load <Texture2D>("EAdventureData/img/icons/deleteContent"); addTexture = Resources.Load <Texture2D>("EAdventureData/img/icons/addNode"); }
public static void appendEffects(XmlDocument doc, XmlNode effectsNode, Effects effects) { // Add every effect foreach (AbstractEffect effect in effects.getEffects()) { XmlElement effectElement = null; if (effect.getType() == EffectType.CUSTOM_EFFECT) { DOMWriterUtility.DOMWrite(effectsNode, effect); } else { if (effect.getType() != EffectType.RANDOM_EFFECT) { effectElement = buildEffectNode(effect, doc); } else { RandomEffect randomEffect = (RandomEffect)effect; effectElement = doc.CreateElement("random-effect"); effectElement.SetAttribute("probability", randomEffect.getProbability().ToString()); XmlElement posEfElement = null; XmlElement negEfElement = null; if (randomEffect.getPositiveEffect() != null) { posEfElement = buildEffectNode(randomEffect.getPositiveEffect(), doc); effectElement.AppendChild(posEfElement); if (randomEffect.getNegativeEffect() != null) { negEfElement = buildEffectNode(randomEffect.getNegativeEffect(), doc); effectElement.AppendChild(negEfElement); } } } // Add the effect effectsNode.AppendChild(effectElement); } // Add conditions associated to that effect // Create conditions for current effect DOMWriterUtility.DOMWrite(effectsNode, effect.getConditions()); } }
/** * Updates the varFlag summary (the references to flags and variables if the * effect given as argument has any) * * @param effect */ protected void updateVarFlagSummary(IEffect effect) { if (effect.getType() == EffectType.ACTIVATE) { ActivateEffect activateEffect = (ActivateEffect)effect; controller.VarFlagSummary.deleteReference(activateEffect.getTargetId()); } else if (effect.getType() == EffectType.DEACTIVATE) { DeactivateEffect deactivateEffect = (DeactivateEffect)effect; controller.VarFlagSummary.deleteReference(deactivateEffect.getTargetId()); } else if (effect.getType() == EffectType.SET_VALUE) { SetValueEffect setValueEffect = (SetValueEffect)effect; controller.VarFlagSummary.deleteReference(setValueEffect.getTargetId()); } else if (effect.getType() == EffectType.INCREMENT_VAR) { IncrementVarEffect setValueEffect = (IncrementVarEffect)effect; controller.VarFlagSummary.deleteReference(setValueEffect.getTargetId()); } else if (effect.getType() == EffectType.DECREMENT_VAR) { DecrementVarEffect setValueEffect = (DecrementVarEffect)effect; controller.VarFlagSummary.deleteReference(setValueEffect.getTargetId()); } else if (effect.getType() == EffectType.RANDOM_EFFECT) { RandomEffect randomEffect = (RandomEffect)effect; if (randomEffect.getPositiveEffect() != null) { updateVarFlagSummary(randomEffect.getPositiveEffect()); } if (randomEffect.getNegativeEffect() != null) { updateVarFlagSummary(randomEffect.getNegativeEffect()); } } }
/* * (non-Javadoc) * * @see es.eucm.eadventure.engine.loader.subparsers.SubParser#endElement(java.lang.string, java.lang.string, * java.lang.string) */ public override void endElement(string namespaceURI, string sName, string qName) { // Debug.Log("END: " + sName + " " + qName ); // If no element is being subparsed if (subParsing == SUBPARSING_NONE) { newEffect = null; // If it is a speak-player if (qName.Equals("speak-player")) { // Add the effect and clear the current string newEffect = new SpeakPlayerEffect(currentstring.ToString().Trim()); ((SpeakPlayerEffect)newEffect).setAudioPath(audioPath); } // If it is a speak-char else if (qName.Equals("speak-char")) { // Add the effect and clear the current string newEffect = new SpeakCharEffect(currentCharIdTarget, currentstring.ToString().Trim()); ((SpeakCharEffect)newEffect).setAudioPath(audioPath); }// If it is a show-text else if (qName.Equals("show-text")) { // Add the new ShowTextEffect newEffect = new ShowTextEffect(currentstring.ToString().Trim(), x, y, frontColor, borderColor); ((ShowTextEffect)newEffect).setAudioPath(audioPath); } // Not reading Random effect: Add the new Effect if not null if (!readingRandomEffect && newEffect != null) { effects.add(newEffect); // Store current effect currentEffect = newEffect; } // Reading random effect if (readingRandomEffect) { // When we have just created the effect, add it if (newEffect != null && newEffect == randomEffect) { effects.add(newEffect); } // Otherwise, determine if it is positive or negative effect else if (newEffect != null && !positiveBlockRead) { randomEffect.setPositiveEffect(newEffect); positiveBlockRead = true; } // Negative effect else if (newEffect != null && positiveBlockRead) { randomEffect.setNegativeEffect(newEffect); positiveBlockRead = false; readingRandomEffect = false; newEffect = randomEffect; randomEffect = null; } // Store current effect currentEffect = newEffect; } // Reset the current string currentstring = string.Empty; } // If a condition is being subparsed else if (subParsing == SUBPARSING_CONDITION) { // Spread the call subParser.endElement(namespaceURI, sName, qName); // If the condition tag is being closed if (qName.Equals("condition")) { //Debug.Log(currentEffect); //Debug.Log(currentConditions); // Store the conditions in the effect currentEffect.setConditions(currentConditions); // Switch state subParsing = SUBPARSING_NONE; } } }
/* * (non-Javadoc) * * @see es.eucm.eadventure.engine.loader.subparsers.SubParser#startElement(java.lang.string, java.lang.string, * java.lang.string, org.xml.sax.Attributes) */ public override void startElement(string namespaceURI, string sName, string qName, Dictionary <string, string> attrs) { //Debug.Log("Start: " + sName + " " + qName + "\nAttr: \n " +CollectionPrinter.PrintCollection(attrs)); newEffect = null; audioPath = string.Empty; //Debug.Log(sName + " " + qName + "\nAttrs: \n" + CollectionPrinter.PrintCollection(attrs)); // If it is a cancel-action tag if (qName.Equals("cancel-action")) { newEffect = new CancelActionEffect(); } // If it is a activate tag else if (qName.Equals("activate")) { foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("flag")) { newEffect = new ActivateEffect(entry.Value.ToString()); chapter.addFlag(entry.Value.ToString()); } } } // If it is a deactivate tag else if (qName.Equals("deactivate")) { foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("flag")) { newEffect = new DeactivateEffect(entry.Value.ToString()); chapter.addFlag(entry.Value.ToString()); } } } // If it is a set-value tag else if (qName.Equals("set-value")) { string var = null; int value = 0; foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("var")) { var = entry.Value.ToString(); } else if (entry.Key.Equals("value")) { value = int.Parse(entry.Value.ToString()); } } newEffect = new SetValueEffect(var, value); chapter.addVar(var); } // If it is a set-value tag else if (qName.Equals("increment")) { string var = null; int value = 0; foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("var")) { var = entry.Value.ToString(); } else if (entry.Key.Equals("value")) { value = int.Parse(entry.Value.ToString()); } } newEffect = new IncrementVarEffect(var, value); chapter.addVar(var); } // If it is a decrement tag else if (qName.Equals("decrement")) { string var = null; int value = 0; foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("var")) { var = entry.Value.ToString(); } else if (entry.Key.Equals("value")) { value = int.Parse(entry.Value.ToString()); } } newEffect = new DecrementVarEffect(var, value); chapter.addVar(var); } // If it is a macro-reference tag else if (qName.Equals("macro-ref")) { // Id string id = null; foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("id")) { id = entry.Value.ToString(); } } // Store the inactive flag in the conditions or either conditions newEffect = new MacroReferenceEffect(id); } // If it is a consume-object tag else if (qName.Equals("consume-object")) { foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("idTarget")) { newEffect = new ConsumeObjectEffect(entry.Value.ToString()); } } } // If it is a generate-object tag else if (qName.Equals("generate-object")) { foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("idTarget")) { newEffect = new GenerateObjectEffect(entry.Value.ToString()); } } } // If it is a speak-char tag else if (qName.Equals("speak-char")) { audioPath = ""; // Store the idTarget, to store the effect when the tag is closed currentCharIdTarget = null; foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("idTarget")) { currentCharIdTarget = entry.Value.ToString(); } // If there is a "uri" attribute, store it as audio path if (entry.Key.Equals("uri")) { audioPath = entry.Value.ToString(); } } } // If it is a trigger-book tag else if (qName.Equals("trigger-book")) { foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("idTarget")) { newEffect = new TriggerBookEffect(entry.Value.ToString()); } } } // If it is a trigger-last-scene tag else if (qName.Equals("trigger-last-scene")) { newEffect = new TriggerLastSceneEffect(); } // If it is a play-sound tag else if (qName.Equals("play-sound")) { // Store the path and background string path = ""; bool background = true; foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("background")) { background = entry.Value.ToString().Equals("yes"); } else if (entry.Key.Equals("uri")) { path = entry.Value.ToString(); } } // Add the new play sound effect newEffect = new PlaySoundEffect(background, path); } // If it is a trigger-conversation tag else if (qName.Equals("trigger-conversation")) { foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("idTarget")) { newEffect = new TriggerConversationEffect(entry.Value.ToString()); } } } // If it is a trigger-cutscene tag else if (qName.Equals("trigger-cutscene")) { foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("idTarget")) { newEffect = new TriggerCutsceneEffect(entry.Value.ToString()); } } } // If it is a trigger-scene tag else if (qName.Equals("trigger-scene")) { string scene = ""; int x = 0; int y = 0; foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("idTarget")) { scene = entry.Value.ToString(); } else if (entry.Key.Equals("x")) { x = int.Parse(entry.Value.ToString()); } else if (entry.Key.Equals("y")) { y = int.Parse(entry.Value.ToString()); } } newEffect = new TriggerSceneEffect(scene, x, y); } // If it is a play-animation tag else if (qName.Equals("play-animation")) { string path = ""; int x = 0; int y = 0; foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("uri")) { path = entry.Value.ToString(); } else if (entry.Key.Equals("x")) { x = int.Parse(entry.Value.ToString()); } else if (entry.Key.Equals("y")) { y = int.Parse(entry.Value.ToString()); } } // Add the new play sound effect newEffect = new PlayAnimationEffect(path, x, y); } // If it is a move-player tag else if (qName.Equals("move-player")) { int x = 0; int y = 0; foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("x")) { x = int.Parse(entry.Value.ToString()); } else if (entry.Key.Equals("y")) { y = int.Parse(entry.Value.ToString()); } } // Add the new move player effect newEffect = new MovePlayerEffect(x, y); } // If it is a move-npc tag else if (qName.Equals("move-npc")) { string npcTarget = ""; int x = 0; int y = 0; foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("idTarget")) { npcTarget = entry.Value.ToString(); } else if (entry.Key.Equals("x")) { x = int.Parse(entry.Value.ToString()); } else if (entry.Key.Equals("y")) { y = int.Parse(entry.Value.ToString()); } } // Add the new move NPC effect newEffect = new MoveNPCEffect(npcTarget, x, y); } // Random effect tag else if (qName.Equals("random-effect")) { int probability = 0; foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("probability")) { probability = int.Parse(entry.Value.ToString()); } } // Add the new random effect randomEffect = new RandomEffect(probability); newEffect = randomEffect; readingRandomEffect = true; positiveBlockRead = false; } // wait-time effect else if (qName.Equals("wait-time")) { int time = 0; foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("time")) { time = int.Parse(entry.Value.ToString()); } } // Add the new move NPC effect newEffect = new WaitTimeEffect(time); } // show-text effect else if (qName.Equals("show-text")) { x = 0; y = 0; frontColor = 0; borderColor = 0; audioPath = ""; foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("x")) { x = int.Parse(entry.Value.ToString()); } else if (entry.Key.Equals("y")) { y = int.Parse(entry.Value.ToString()); } else if (entry.Key.Equals("frontColor")) { frontColor = int.Parse(entry.Value.ToString()); } else if (entry.Key.Equals("borderColor")) { borderColor = int.Parse(entry.Value.ToString()); } // If there is a "uri" attribute, store it as audio path else if (entry.Key.Equals("uri")) { audioPath = entry.Value.ToString(); } } } else if (qName.Equals("highlight-item")) { int type = 0; bool animated = false; string id = ""; foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("idTarget")) { id = entry.Value.ToString(); } if (entry.Key.Equals("animated")) { animated = (entry.Value.ToString().Equals("yes") ? true : false); } if (entry.Key.Equals("type")) { if (entry.Value.ToString().Equals("none")) { type = HighlightItemEffect.NO_HIGHLIGHT; } if (entry.Value.ToString().Equals("green")) { type = HighlightItemEffect.HIGHLIGHT_GREEN; } if (entry.Value.ToString().Equals("red")) { type = HighlightItemEffect.HIGHLIGHT_RED; } if (entry.Value.ToString().Equals("blue")) { type = HighlightItemEffect.HIGHLIGHT_BLUE; } if (entry.Value.ToString().Equals("border")) { type = HighlightItemEffect.HIGHLIGHT_BORDER; } } } newEffect = new HighlightItemEffect(id, type, animated); } else if (qName.Equals("move-object")) { bool animated = false; string id = ""; int x = 0; int y = 0; float scale = 1.0f; int translateSpeed = 20; int scaleSpeed = 20; foreach (KeyValuePair <string, string> entry in attrs) { if (entry.Key.Equals("idTarget")) { id = entry.Value.ToString(); } if (entry.Key.Equals("animated")) { animated = (entry.Value.ToString().Equals("yes") ? true : false); } if (entry.Key.Equals("x")) { x = int.Parse(entry.Value.ToString()); } if (entry.Key.Equals("y")) { y = int.Parse(entry.Value.ToString()); } if (entry.Key.Equals("scale")) { scale = float.Parse(entry.Value.ToString(), CultureInfo.InvariantCulture); } if (entry.Key.Equals("translateSpeed")) { translateSpeed = int.Parse(entry.Value.ToString()); } if (entry.Key.Equals("scaleSpeed")) { scaleSpeed = int.Parse(entry.Value.ToString()); } } newEffect = new MoveObjectEffect(id, x, y, scale, animated, translateSpeed, scaleSpeed); } else if (qName.Equals("speak-player")) { audioPath = ""; foreach (KeyValuePair <string, string> entry in attrs) { // If there is a "uri" attribute, store it as audio path if (entry.Key.Equals("uri")) { audioPath = entry.Value.ToString(); } } } // If it is a condition tag, create new conditions and switch the state else if (qName.Equals("condition")) { currentConditions = new Conditions(); subParser = new ConditionSubParser(currentConditions, chapter); subParsing = SUBPARSING_CONDITION; } // Not reading Random effect: Add the new Effect if not null if (!readingRandomEffect && newEffect != null) { effects.add(newEffect); // Store current effect currentEffect = newEffect; } // Reading random effect if (readingRandomEffect) { // When we have just created the effect, add it if (newEffect != null && newEffect == randomEffect) { effects.add(newEffect); } // Otherwise, determine if it is positive or negative effect else if (newEffect != null && !positiveBlockRead) { randomEffect.setPositiveEffect(newEffect); positiveBlockRead = true; } // Negative effect else if (newEffect != null && positiveBlockRead) { randomEffect.setNegativeEffect(newEffect); positiveBlockRead = false; readingRandomEffect = false; newEffect = randomEffect; randomEffect = null; } // Store current effect currentEffect = newEffect; } // If it is reading an effect or a condition, spread the call if (subParsing != SUBPARSING_NONE) { subParser.startElement(namespaceURI, sName, qName, attrs); endElement(namespaceURI, sName, qName); } }
public bool execute() { var forceWait = false; if (effect != null && (!runsOnce || timesRun == 0 || waitForLoadPulse)) { if (!validated) { isValid = conditions == null || ConditionChecker.check(conditions); validated = true; } if (isValid) { switch (effect.getType()) { case EffectType.ACTIVATE: Game.Instance.GameState.SetFlag(((ActivateEffect)effect).getTargetId(), FlagCondition.FLAG_ACTIVE); break; case EffectType.DEACTIVATE: Game.Instance.GameState.SetFlag(((DeactivateEffect)effect).getTargetId(), FlagCondition.FLAG_INACTIVE); break; case EffectType.SHOW_TEXT: var showTextEffect = (ShowTextEffect)effect; Game.Instance.Talk(showTextEffect.getText(), showTextEffect.getX(), showTextEffect.getY(), showTextEffect.getRgbFrontColor(), showTextEffect.getRgbBorderColor()); forceWait = true; break; case EffectType.SPEAK_PLAYER: Game.Instance.Talk(((SpeakPlayerEffect)effect).getLine(), Player.IDENTIFIER); forceWait = true; break; case EffectType.SPEAK_CHAR: Game.Instance.Talk(((SpeakCharEffect)effect).getLine(), ((SpeakCharEffect)effect).getTargetId()); forceWait = true; break; case EffectType.TRIGGER_SCENE: if (!waitForLoadPulse) { runsOnce = false; TriggerSceneEffect tse = ((TriggerSceneEffect)effect); if (!Game.Instance.GameState.IsFirstPerson) { var playerContext = Game.Instance.GameState.PlayerContext; if (tse.getX() != int.MinValue || tse.getY() != int.MinValue) { playerContext.setPosition(tse.getX(), tse.getY()); if (tse.DestinyScale > 0) { playerContext.Scale = tse.DestinyScale; } } else { var targetScene = Game.Instance.GameState.GetChapterTarget(tse.getTargetId()) as Scene; if (targetScene != null) { if (targetScene.getTrajectory() != null) { var initial = targetScene.getTrajectory().getInitial(); playerContext.setPosition(initial.getX(), initial.getY()); playerContext.Scale = initial.getScale(); } else { playerContext.setPosition(targetScene.getPositionX(), targetScene.getPositionY()); playerContext.Scale = targetScene.getPlayerScale(); } } } } var trace = !(additionalInfo.ContainsKey("disable_trace") && (bool)additionalInfo["disable_trace"]); Game.Instance.RunTarget(tse.getTargetId(), tse.getTransitionTime(), tse.getTransitionType(), null, trace); waitForLoadPulse = true; forceWait = true; } else { waitForLoadPulse = false; } // DODO make something to wait until the target is ready to prevent undesired effect advance break; case EffectType.TRIGGER_CUTSCENE: runsOnce = false; TriggerCutsceneEffect tce = (TriggerCutsceneEffect)effect; if (timesRun > 1) // The first interaction is the run target callback { if (additionalInfo.ContainsKey("sub_effects_wait")) { forceWait = false; } else { InteractuableResult res = ((Interactuable)additionalInfo["scene"]).Interacted(); if (res == InteractuableResult.REQUIRES_MORE_INTERACTION) { forceWait = true; } else if (res == InteractuableResult.DOES_SOMETHING) { additionalInfo["sub_effects_wait"] = true; forceWait = true; } } } else if (timesRun == 1) { forceWait = true; } else if (timesRun == 0) { var trace = !(additionalInfo.ContainsKey("disable_trace") && (bool)additionalInfo["disable_trace"]); additionalInfo.Add("lastscene", Game.Instance.GameState.CurrentTarget); additionalInfo.Add("scene", Game.Instance.RunTarget(tce.getTargetId(), null, trace)); forceWait = true; } if (!forceWait && ((Cutscene)((IRunnerChapterTarget)additionalInfo["scene"]).Data).getNext() == Cutscene.GOBACK) { string last = (string)additionalInfo["lastscene"]; Game.Instance.RunTarget(last); } break; case EffectType.TRIGGER_LAST_SCENE: runsOnce = false; Game.Instance.SwitchToLastTarget(); break; case EffectType.TRIGGER_CONVERSATION: runsOnce = false; runsOnce = false; if (timesRun == 0) { var tcoe = (TriggerConversationEffect)effect; this.additionalInfo.Add("conversation", new GraphConversationHolder(Game.Instance.GameState.GetConversation(tcoe.getTargetId()))); } forceWait = ((GraphConversationHolder)this.additionalInfo["conversation"]).execute(); break; case EffectType.RANDOM_EFFECT: RandomEffect re = (RandomEffect)effect; if (timesRun == 0) { int pro = re.getProbability(), now = Random.Range(0, 100); if (pro <= now) { if (re.getPositiveEffect() != null) { additionalInfo.Add("current", new EffectHolderNode(re.getPositiveEffect())); runsOnce = false; } } else if (re.getNegativeEffect() != null) { additionalInfo.Add("current", new EffectHolderNode(re.getNegativeEffect())); runsOnce = false; } } if (additionalInfo.ContainsKey("current")) { var subEffectHolder = (EffectHolderNode)additionalInfo["current"]; forceWait = subEffectHolder.execute(); runsOnce = subEffectHolder.runsOnce; } break; case EffectType.SET_VALUE: SetValueEffect sve = (SetValueEffect)effect; Game.Instance.GameState.SetVariable(sve.getTargetId(), sve.getValue()); break; case EffectType.INCREMENT_VAR: IncrementVarEffect ive = (IncrementVarEffect)effect; Game.Instance.GameState.SetVariable(ive.getTargetId(), Game.Instance.GameState.GetVariable(ive.getTargetId()) + ive.getIncrement()); break; case EffectType.DECREMENT_VAR: DecrementVarEffect dve = (DecrementVarEffect)effect; Game.Instance.GameState.SetVariable(dve.getTargetId(), Game.Instance.GameState.GetVariable(dve.getTargetId()) - dve.getDecrement()); break; case EffectType.MACRO_REF: runsOnce = false; if (timesRun == 0) { MacroReferenceEffect mre = (MacroReferenceEffect)effect; this.additionalInfo.Add("macro", new EffectHolder(Game.Instance.GameState.GetMacro(mre.getTargetId()))); } forceWait = ((EffectHolder)this.additionalInfo["macro"]).execute(); break; case EffectType.MOVE_OBJECT: MoveObjectEffect moe = (MoveObjectEffect)effect; runsOnce = !moe.isAnimated(); if (timesRun == 0) { if (moe.isAnimated()) { Game.Instance.GameState.Move(moe.getTargetId(), new Vector2(moe.getX(), moe.getY()), moe.getTranslateSpeed(), this); } else { Game.Instance.GameState.Move(moe.getTargetId(), new Vector2(moe.getX(), moe.getY())); } } if (!runsOnce && !pulsed) { forceWait = true; } break; case EffectType.MOVE_NPC: MoveNPCEffect mne = (MoveNPCEffect)effect; runsOnce = true; if (timesRun == 0) { Game.Instance.GameState.Move(mne.getTargetId(), new Vector2(mne.getX(), mne.getY()), 1, this); } if (!runsOnce && !pulsed) { forceWait = true; } break; case EffectType.GENERATE_OBJECT: GenerateObjectEffect gen = (GenerateObjectEffect)effect; var toAdd = Game.Instance.GameState.FindElement <Item>(gen.getTargetId()); InventoryManager.Instance.AddElement(toAdd); break; case EffectType.CONSUME_OBJECT: ConsumeObjectEffect con = (ConsumeObjectEffect)effect; var toRemove = Game.Instance.GameState.FindElement <Item>(con.getTargetId()); InventoryManager.Instance.RemoveElement(toRemove); break; case EffectType.TRIGGER_BOOK: if (timesRun == 0) { if (InventoryManager.Instance.Opened) { InventoryManager.Instance.Close(); } TriggerBookEffect triggerBookEffect = (TriggerBookEffect)effect; Game.Instance.ShowBook(triggerBookEffect.getTargetId()); } runsOnce = false; forceWait = Game.Instance.ShowingBook; break; case EffectType.PLAY_SOUND: PlaySoundEffect pse = (PlaySoundEffect)effect; AudioClip audioClip = Game.Instance.ResourceManager.getAudio(pse.getPath()); PlayMusicOn(audioClip, Game.Instance); break; case EffectType.WAIT_TIME: WaitTimeEffect wte = (WaitTimeEffect)effect; runsOnce = false; if (timesRun == 0) { Game.Instance.PulseOnTime(this, wte.getTime()); } if (!pulsed) { forceWait = true; } break; case EffectType.CUSTOM_EFFECT: runsOnce = false; if (timesRun == 0) { this.additionalInfo["custom_effect_runner"] = CustomEffectRunnerFactory.Instance.CreateRunnerFor(effect); } forceWait = ((CustomEffectRunner)this.additionalInfo["custom_effect_runner"]).execute(); break; } } } if (!forceWait) { timesRun = 0; } else { timesRun++; } return(forceWait); }
public override void ParseElement(XmlElement element) { string tmpArgVal; int x = 0; int y = 0; string path = ""; string id = ""; bool animated = false, addeffect = true; List <AbstractEffect> effectlist; foreach (XmlElement effect in element.ChildNodes) { addeffect = true; switch (effect.Name) { case "cancel-action": currentEffect = new CancelActionEffect(); break; case "activate": case "deactivate": tmpArgVal = effect.GetAttribute("flag"); if (!string.IsNullOrEmpty(tmpArgVal)) { chapter.addFlag(tmpArgVal); } if (effect.Name == "activate") { currentEffect = new ActivateEffect(tmpArgVal); } else { currentEffect = new DeactivateEffect(tmpArgVal); } break; case "set-value": case "increment": case "decrement": string var = null; int value = 0; tmpArgVal = effect.GetAttribute("var"); if (!string.IsNullOrEmpty(tmpArgVal)) { var = tmpArgVal; } tmpArgVal = effect.GetAttribute("value"); if (!string.IsNullOrEmpty(tmpArgVal)) { value = int.Parse(tmpArgVal); } if (effect.Name == "set-value") { currentEffect = new SetValueEffect(var, value); } else if (effect.Name == "increment") { currentEffect = new IncrementVarEffect(var, value); } else { currentEffect = new DecrementVarEffect(var, value); } chapter.addVar(var); break; case "macro-ref": id = ""; tmpArgVal = effect.GetAttribute("id"); if (!string.IsNullOrEmpty(tmpArgVal)) { id = tmpArgVal; } currentEffect = new MacroReferenceEffect(id); break; case "speak-char": audioPath = ""; currentCharIdTarget = null; tmpArgVal = effect.GetAttribute("idTarget"); if (!string.IsNullOrEmpty(tmpArgVal)) { currentCharIdTarget = tmpArgVal; } tmpArgVal = effect.GetAttribute("uri"); if (!string.IsNullOrEmpty(tmpArgVal)) { audioPath = tmpArgVal; } // Add the effect and clear the current string currentEffect = new SpeakCharEffect(currentCharIdTarget, effect.InnerText.ToString().Trim()); ((SpeakCharEffect)currentEffect).setAudioPath(audioPath); break; case "trigger-last-scene": currentEffect = new TriggerLastSceneEffect(); break; case "play-sound": // Store the path and background bool background = true; path = ""; tmpArgVal = effect.GetAttribute("background"); if (!string.IsNullOrEmpty(tmpArgVal)) { background = tmpArgVal.Equals("yes"); } tmpArgVal = effect.GetAttribute("uri"); if (!string.IsNullOrEmpty(tmpArgVal)) { path = tmpArgVal; } // Add the new play sound effect currentEffect = new PlaySoundEffect(background, path); break; case "consume-object": case "generate-object": case "trigger-book": case "trigger-conversation": case "trigger-cutscene": tmpArgVal = effect.GetAttribute("idTarget"); if (!string.IsNullOrEmpty(tmpArgVal)) { switch (effect.Name) { case "consume-object": currentEffect = new ConsumeObjectEffect(tmpArgVal); break; case "generate-object": currentEffect = new GenerateObjectEffect(tmpArgVal); break; case "trigger-book": currentEffect = new TriggerBookEffect(tmpArgVal); break; case "trigger-conversation": currentEffect = new TriggerConversationEffect(tmpArgVal); break; case "trigger-cutscene": currentEffect = new TriggerCutsceneEffect(tmpArgVal); break; } } break; case "trigger-scene": x = 0; y = 0; string scene = ""; tmpArgVal = effect.GetAttribute("idTarget"); if (!string.IsNullOrEmpty(tmpArgVal)) { scene = tmpArgVal; } tmpArgVal = effect.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y = int.Parse(tmpArgVal); } currentEffect = new TriggerSceneEffect(scene, x, y); break; case "play-animation": x = 0; y = 0; path = ""; tmpArgVal = effect.GetAttribute("uri"); if (!string.IsNullOrEmpty(tmpArgVal)) { path = tmpArgVal; } tmpArgVal = effect.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y = int.Parse(tmpArgVal); } // Add the new play sound effect currentEffect = new PlayAnimationEffect(path, x, y); break; case "move-player": x = 0; y = 0; tmpArgVal = effect.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y = int.Parse(tmpArgVal); } // Add the new move player effect currentEffect = new MovePlayerEffect(x, y); break; case "move-npc": x = 0; y = 0; string npcTarget = ""; tmpArgVal = effect.GetAttribute("idTarget"); if (!string.IsNullOrEmpty(tmpArgVal)) { npcTarget = tmpArgVal; } tmpArgVal = effect.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y = int.Parse(tmpArgVal); } // Add the new move NPC effect currentEffect = new MoveNPCEffect(npcTarget, x, y); break; case "random-effect": int probability = 0; tmpArgVal = effect.GetAttribute("probability"); if (!string.IsNullOrEmpty(tmpArgVal)) { probability = int.Parse(tmpArgVal); } // Add the new random effect randomEffect = new RandomEffect(probability); Effects randomEffectList = new Effects(); new EffectSubParser_(randomEffectList, this.chapter).ParseElement(effect); randomEffect.setPositiveEffect(randomEffectList.getEffects() [0]); randomEffect.setNegativeEffect(randomEffectList.getEffects() [1]); currentEffect = randomEffect; break; case "wait-time": int time = 0; tmpArgVal = effect.GetAttribute("time"); if (!string.IsNullOrEmpty(tmpArgVal)) { time = int.Parse(tmpArgVal); } // Add the new move NPC effect currentEffect = new WaitTimeEffect(time); break; case "show-text": x = 0; y = 0; frontColor = 0; borderColor = 0; audioPath = ""; tmpArgVal = effect.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("frontColor"); if (!string.IsNullOrEmpty(tmpArgVal)) { frontColor = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("borderColor"); if (!string.IsNullOrEmpty(tmpArgVal)) { borderColor = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("uri"); if (!string.IsNullOrEmpty(tmpArgVal)) { audioPath = tmpArgVal; } // Add the new ShowTextEffect currentEffect = new ShowTextEffect(effect.InnerText.ToString().Trim(), x, y, frontColor.ToString(), borderColor.ToString()); ((ShowTextEffect)currentEffect).setAudioPath(audioPath); break; case "highlight-item": int type = 0; id = ""; animated = false; tmpArgVal = effect.GetAttribute("idTarget"); if (!string.IsNullOrEmpty(tmpArgVal)) { id = tmpArgVal; } tmpArgVal = effect.GetAttribute("animated"); if (!string.IsNullOrEmpty(tmpArgVal)) { animated = (tmpArgVal.Equals("yes") ? true : false); } tmpArgVal = effect.GetAttribute("type"); if (!string.IsNullOrEmpty(tmpArgVal)) { if (tmpArgVal.Equals("none")) { type = HighlightItemEffect.NO_HIGHLIGHT; } if (tmpArgVal.Equals("green")) { type = HighlightItemEffect.HIGHLIGHT_GREEN; } if (tmpArgVal.Equals("red")) { type = HighlightItemEffect.HIGHLIGHT_RED; } if (tmpArgVal.Equals("blue")) { type = HighlightItemEffect.HIGHLIGHT_BLUE; } if (tmpArgVal.Equals("border")) { type = HighlightItemEffect.HIGHLIGHT_BORDER; } } currentEffect = new HighlightItemEffect(id, type, animated); break; case "move-object": float scale = 1.0f; int translateSpeed = 20; int scaleSpeed = 20; x = 0; y = 0; id = ""; animated = false; tmpArgVal = effect.GetAttribute("idTarget"); if (!string.IsNullOrEmpty(tmpArgVal)) { id = tmpArgVal; } tmpArgVal = effect.GetAttribute("animated"); if (!string.IsNullOrEmpty(tmpArgVal)) { animated = (tmpArgVal.Equals("yes") ? true : false); } tmpArgVal = effect.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("scale"); if (!string.IsNullOrEmpty(tmpArgVal)) { scale = float.Parse(tmpArgVal, CultureInfo.InvariantCulture); } tmpArgVal = effect.GetAttribute("translateSpeed"); if (!string.IsNullOrEmpty(tmpArgVal)) { translateSpeed = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("scaleSpeed"); if (!string.IsNullOrEmpty(tmpArgVal)) { scaleSpeed = int.Parse(tmpArgVal); } currentEffect = new MoveObjectEffect(id, x, y, scale, animated, translateSpeed, scaleSpeed); break; case "speak-player": audioPath = ""; tmpArgVal = effect.GetAttribute("uri"); if (!string.IsNullOrEmpty(tmpArgVal)) { audioPath = tmpArgVal; } // Add the effect and clear the current string currentEffect = new SpeakPlayerEffect(effect.InnerText.ToString().Trim()); break; case "condition": addeffect = false; currentConditions = new Conditions(); new ConditionSubParser_(currentConditions, chapter).ParseElement(effect); currentEffect.setConditions(currentConditions); effectlist = effects.getEffects(); effectlist[effectlist.Count - 1].setConditions(currentConditions); break; case "documentation": addeffect = false; break; default: addeffect = false; Debug.LogWarning("EFFECT NOT SUPPORTED: " + effect.Name); break; } if (addeffect) { effects.add(currentEffect); } } }
public override bool doTool() { bool effectEdited = false; EffectType effectType = effect.getType(); // If a change has been made if (newProperties != null) { effectEdited = true; oldEffect = (AbstractEffect)effect; switch (effectType) { case EffectType.ACTIVATE: ActivateEffect activateEffect = (ActivateEffect)effect; activateEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]); Controller.getInstance().updateVarFlagSummary(); break; case EffectType.DEACTIVATE: DeactivateEffect deactivateEffect = (DeactivateEffect)effect; deactivateEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]); Controller.getInstance().updateVarFlagSummary(); break; case EffectType.SET_VALUE: SetValueEffect setValueEffect = (SetValueEffect)effect; setValueEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]); setValueEffect.setValue(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_VALUE])); Controller.getInstance().updateVarFlagSummary(); break; case EffectType.INCREMENT_VAR: IncrementVarEffect incrementVarEffect = (IncrementVarEffect)effect; incrementVarEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]); incrementVarEffect.setIncrement(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_VALUE])); Controller.getInstance().updateVarFlagSummary(); break; case EffectType.DECREMENT_VAR: DecrementVarEffect decrementVarEffect = (DecrementVarEffect)effect; decrementVarEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]); decrementVarEffect.setDecrement(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_VALUE])); Controller.getInstance().updateVarFlagSummary(); break; case EffectType.MACRO_REF: MacroReferenceEffect macroEffect = (MacroReferenceEffect)effect; macroEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]); break; case EffectType.CONSUME_OBJECT: ConsumeObjectEffect consumeObjectEffect = (ConsumeObjectEffect)effect; consumeObjectEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]); break; case EffectType.GENERATE_OBJECT: GenerateObjectEffect generateObjectEffect = (GenerateObjectEffect)effect; generateObjectEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]); break; case EffectType.SPEAK_PLAYER: SpeakPlayerEffect speakPlayerEffect = (SpeakPlayerEffect)effect; speakPlayerEffect.setLine((string)newProperties[EffectsController.EFFECT_PROPERTY_TEXT]); speakPlayerEffect.setAudioPath((string)newProperties[EffectsController.EFFECT_PROPERTY_PATH]); break; case EffectType.SPEAK_CHAR: SpeakCharEffect speakCharEffect = (SpeakCharEffect)effect; speakCharEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]); speakCharEffect.setLine((string)newProperties[EffectsController.EFFECT_PROPERTY_TEXT]); speakCharEffect.setAudioPath((string)newProperties[EffectsController.EFFECT_PROPERTY_PATH]); break; case EffectType.TRIGGER_BOOK: TriggerBookEffect triggerBookEffect = (TriggerBookEffect)effect; triggerBookEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]); break; case EffectType.PLAY_SOUND: PlaySoundEffect playSoundEffect = (PlaySoundEffect)effect; playSoundEffect.setPath((string)newProperties[EffectsController.EFFECT_PROPERTY_PATH]); playSoundEffect.setBackground(bool.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_BACKGROUND])); break; case EffectType.PLAY_ANIMATION: PlayAnimationEffect playAnimationEffect = (PlayAnimationEffect)effect; playAnimationEffect.setPath((string)newProperties[EffectsController.EFFECT_PROPERTY_PATH]); playAnimationEffect.setDestiny(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_X]), int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_Y])); break; case EffectType.MOVE_PLAYER: MovePlayerEffect movePlayerEffect = (MovePlayerEffect)effect; movePlayerEffect.setDestiny(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_X]), int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_Y])); break; case EffectType.MOVE_NPC: MoveNPCEffect moveNPCEffect = (MoveNPCEffect)effect; moveNPCEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]); moveNPCEffect.setDestiny(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_X]), int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_Y])); break; case EffectType.TRIGGER_CONVERSATION: TriggerConversationEffect triggerConversationEffect = (TriggerConversationEffect)effect; triggerConversationEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]); break; case EffectType.TRIGGER_CUTSCENE: TriggerCutsceneEffect triggerCutsceneEffect = (TriggerCutsceneEffect)effect; triggerCutsceneEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]); break; case EffectType.TRIGGER_SCENE: TriggerSceneEffect triggerSceneEffect = (TriggerSceneEffect)effect; triggerSceneEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]); triggerSceneEffect.setPosition(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_X]), int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_Y])); break; case EffectType.RANDOM_EFFECT: RandomEffect randomEffect = (RandomEffect)effect; randomEffect.setProbability(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_PROBABILITY])); randomEffect.setPositiveEffect(pos); randomEffect.setNegativeEffect(neg); break; case EffectType.WAIT_TIME: WaitTimeEffect waitTimeEffect = (WaitTimeEffect)effect; waitTimeEffect.setTime(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_TIME])); break; case EffectType.SHOW_TEXT: ShowTextEffect showTextEffect = (ShowTextEffect)effect; showTextEffect.setText((string)newProperties[EffectsController.EFFECT_PROPERTY_TEXT]); showTextEffect.setTextPosition(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_X]), int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_Y])); showTextEffect.setRgbFrontColor((string)newProperties[EffectsController.EFFECT_PROPERTY_FRONT_COLOR]); showTextEffect.setRgbBorderColor((string)newProperties[EffectsController.EFFECT_PROPERTY_BORDER_COLOR]); showTextEffect.setAudioPath((string)newProperties[EffectsController.EFFECT_PROPERTY_PATH]); break; case EffectType.HIGHLIGHT_ITEM: HighlightItemEffect highlightItemEffect = (HighlightItemEffect)effect; highlightItemEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]); highlightItemEffect.setHighlightAnimated((bool)newProperties[EffectsController.EFFECT_PROPERTY_ANIMATED]); highlightItemEffect.setHighlightType((int)newProperties[EffectsController.EFFECT_PROPERTY_HIGHLIGHT_TYPE]); break; case EffectType.MOVE_OBJECT: MoveObjectEffect moveObjectEffect = (MoveObjectEffect)effect; moveObjectEffect.setTargetId((string)newProperties[EffectsController.EFFECT_PROPERTY_TARGET]); moveObjectEffect.setX(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_X])); moveObjectEffect.setY(int.Parse((string)newProperties[EffectsController.EFFECT_PROPERTY_Y])); moveObjectEffect.setScale((float)newProperties[EffectsController.EFFECT_PROPERTY_SCALE]); moveObjectEffect.setAnimated((bool)newProperties[EffectsController.EFFECT_PROPERTY_ANIMATED]); moveObjectEffect.setScaleSpeed((int)newProperties[EffectsController.EFFECT_PROPERTY_SCALE_SPEED]); moveObjectEffect.setTranslateSpeed((int)newProperties[EffectsController.EFFECT_PROPERTY_TRANSLATION_SPEED]); break; } effectEdited = true; Controller.getInstance().updatePanel(); } return(effectEdited); }
// Use to process your families. protected override void onProcess(int familiesUpdateCount) { foreach (TripleEEffectFloatBool activeEffect in manager.activeEffects) { // If there is time and hasn't been activated, activate it if (activeEffect.a > 0.0f && activeEffect.b == false) { activeEffect.b = true; } // If there no more time and hasn't been deactivated, deactivate it if (activeEffect.a <= 0.0f && activeEffect.b == true) { activeEffect.b = false; } activeEffect.a -= Time.deltaTime; activeEffect.a = Mathf.Clamp(activeEffect.a, 0.0f, Mathf.Infinity); float value = 1.0f; foreach (TripleEEffectFloatFloat effectSetting in manager.effectSettings) { if (effectSetting.key == activeEffect.key) { value = effectSetting.b; break; } } if (activeEffect.key == EEffect.SPEED_DOWN) { if (activeEffect.b) { speedDown(value); } else { speedDown(1.0f); } } else if (activeEffect.key == EEffect.SPEED_UP) { if (activeEffect.b) { speedUp(value); } else { speedUp(1.0f); } } } foreach (GameObject go in _RandomGO) { RandomEffect randomEffect = go.GetComponent <RandomEffect>(); if (go.GetComponent <PointerOver>() != null && Input.GetKeyDown(KeyCode.Mouse0)) { Object.Instantiate(randomEffect.onClickGO, go.GetComponent <Collider>().bounds.center, go.transform.rotation); GameObjectManager.addComponent <Removed>(go); foreach (TripleEEffectFloatFloat effectSetting in manager.effectSettings) { foreach (TripleEEffectFloatBool activeEffect in manager.activeEffects) { if (activeEffect.key == randomEffect.effect && effectSetting.key == randomEffect.effect) { activeEffect.a = effectSetting.a; break; } } } } } }
public bool execute() { bool forcewait = false; if (!(runs_once && times_runed > 0)) { if (effect == null || effect.getConditions() == null) { Debug.Log("Asd"); } else { if (!validated) { is_valid = ConditionChecker.check(effect.getConditions()); validated = true; } if (is_valid) { switch (effect.getType()) { case EffectType.ACTIVATE: Game.Instance.GameState.setFlag(((ActivateEffect)effect).getTargetId(), FlagCondition.FLAG_ACTIVE); break; case EffectType.DEACTIVATE: Game.Instance.GameState.setFlag(((DeactivateEffect)effect).getTargetId(), FlagCondition.FLAG_INACTIVE); break; case EffectType.SPEAK_PLAYER: Game.Instance.talk(((SpeakPlayerEffect)effect).getLine(), null); forcewait = true; break; case EffectType.SPEAK_CHAR: Game.Instance.talk(((SpeakCharEffect)effect).getLine(), ((SpeakCharEffect)effect).getTargetId()); forcewait = true; break; case EffectType.TRIGGER_SCENE: runs_once = false; Game.Instance.renderScene(((TriggerSceneEffect)effect).getTargetId()); break; case EffectType.TRIGGER_CUTSCENE: runs_once = false; TriggerCutsceneEffect tce = (TriggerCutsceneEffect)effect; if (times_runed > 0) { forcewait = ((SceneMB)aditional_info ["scene"]).Interacted() == InteractuableResult.REQUIRES_MORE_INTERACTION; } else { aditional_info = new Dictionary <string, object> (); aditional_info.Add("lastscene", Game.Instance.GameState.CurrentScene); aditional_info.Add("scene", Game.Instance.renderScene(tce.getTargetId()).GetComponent <SceneMB> ()); forcewait = true; } if (!forcewait && ((Slidescene)((SceneMB)aditional_info ["scene"]).sceneData).getNext() == Slidescene.GOBACK) { string last = (string)aditional_info ["lastscene"]; Game.Instance.renderScene(last); } break; case EffectType.TRIGGER_LAST_SCENE: runs_once = false; Game.Instance.renderLastScene(); break; case EffectType.TRIGGER_CONVERSATION: runs_once = false; runs_once = false; if (times_runed == 0) { TriggerConversationEffect tcoe = (TriggerConversationEffect)effect; this.aditional_info.Add("conversation", new GraphConversationHolder(Game.Instance.GameState.getConversation(tcoe.getTargetId()))); } forcewait = ((GraphConversationHolder)this.aditional_info ["conversation"]).execute(); break; case EffectType.RANDOM_EFFECT: runs_once = false; RandomEffect re = (RandomEffect)effect; if (!aditional_info.ContainsKey("first")) { aditional_info.Add("first", new EffectHolderNode(re.getPositiveEffect())); aditional_info.Add("second", new EffectHolderNode(re.getNegativeEffect())); } if (times_runed == 0) { int pro = re.getProbability(), now = Random.Range(0, 100); if (aditional_info.ContainsKey("current")) { aditional_info.Remove("current"); } if (pro <= now) { aditional_info.Add("current", "first"); } else { aditional_info.Add("current", "second"); } forcewait = ((EffectHolderNode)aditional_info [((string)aditional_info ["current"])]).execute(); } else { forcewait = ((EffectHolderNode)aditional_info [((string)aditional_info ["current"])]).execute(); } break; case EffectType.SET_VALUE: SetValueEffect sve = (SetValueEffect)effect; Game.Instance.GameState.setVariable(sve.getTargetId(), sve.getValue()); break; case EffectType.INCREMENT_VAR: IncrementVarEffect ive = (IncrementVarEffect)effect; Game.Instance.GameState.setVariable(ive.getTargetId(), Game.Instance.GameState.getVariable(ive.getTargetId()) + ive.getIncrement()); break; case EffectType.DECREMENT_VAR: DecrementVarEffect dve = (DecrementVarEffect)effect; Game.Instance.GameState.setVariable(dve.getTargetId(), Game.Instance.GameState.getVariable(dve.getTargetId()) - dve.getDecrement()); break; case EffectType.MACRO_REF: runs_once = false; if (times_runed == 0) { MacroReferenceEffect mre = (MacroReferenceEffect)effect; this.aditional_info.Add("macro", new EffectHolder(Game.Instance.GameState.getMacro(mre.getTargetId()))); } forcewait = ((EffectHolder)this.aditional_info ["macro"]).execute(); break; case EffectType.MOVE_OBJECT: MoveObjectEffect moe = (MoveObjectEffect)effect; Game.Instance.GameState.Move(moe.getTargetId(), new Vector2(moe.getX(), 600 - moe.getY()) / 10f); break; } } } } if (!forcewait) { times_runed = 0; } else { times_runed++; } return(forcewait); }
/* * (non-Javadoc) * * @see es.eucm.eadventure.engine.loader.subparsers.SubParser#startElement(java.lang.string, java.lang.string, * java.lang.string, org.xml.sax.Attributes) */ public override void startElement(string namespaceURI, string sName, string qName, Dictionary<string, string> attrs) { //Debug.Log("Start: " + sName + " " + qName + "\nAttr: \n " +CollectionPrinter.PrintCollection(attrs)); newEffect = null; audioPath = string.Empty; //Debug.Log(sName + " " + qName + "\nAttrs: \n" + CollectionPrinter.PrintCollection(attrs)); // If it is a cancel-action tag if (qName.Equals("cancel-action")) { newEffect = new CancelActionEffect(); } // If it is a activate tag else if (qName.Equals("activate")) { foreach (KeyValuePair<string, string> entry in attrs) if (entry.Key.Equals("flag")) { newEffect = new ActivateEffect(entry.Value.ToString()); chapter.addFlag(entry.Value.ToString()); } } // If it is a deactivate tag else if (qName.Equals("deactivate")) { foreach (KeyValuePair<string, string> entry in attrs) if (entry.Key.Equals("flag")) { newEffect = new DeactivateEffect(entry.Value.ToString()); chapter.addFlag(entry.Value.ToString()); } } // If it is a set-value tag else if (qName.Equals("set-value")) { string var = null; int value = 0; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("var")) { var = entry.Value.ToString(); } else if (entry.Key.Equals("value")) { value = int.Parse(entry.Value.ToString()); } } newEffect = new SetValueEffect(var, value); chapter.addVar(var); } // If it is a set-value tag else if (qName.Equals("increment")) { string var = null; int value = 0; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("var")) { var = entry.Value.ToString(); } else if (entry.Key.Equals("value")) { value = int.Parse(entry.Value.ToString()); } } newEffect = new IncrementVarEffect(var, value); chapter.addVar(var); } // If it is a decrement tag else if (qName.Equals("decrement")) { string var = null; int value = 0; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("var")) { var = entry.Value.ToString(); } else if (entry.Key.Equals("value")) { value = int.Parse(entry.Value.ToString()); } } newEffect = new DecrementVarEffect(var, value); chapter.addVar(var); } // If it is a macro-reference tag else if (qName.Equals("macro-ref")) { // Id string id = null; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("id")) { id = entry.Value.ToString(); } } // Store the inactive flag in the conditions or either conditions newEffect = new MacroReferenceEffect(id); } // If it is a consume-object tag else if (qName.Equals("consume-object")) { foreach (KeyValuePair<string, string> entry in attrs) if (entry.Key.Equals("idTarget")) newEffect = new ConsumeObjectEffect(entry.Value.ToString()); } // If it is a generate-object tag else if (qName.Equals("generate-object")) { foreach (KeyValuePair<string, string> entry in attrs) if (entry.Key.Equals("idTarget")) newEffect = new GenerateObjectEffect(entry.Value.ToString()); } // If it is a speak-char tag else if (qName.Equals("speak-char")) { audioPath = ""; // Store the idTarget, to store the effect when the tag is closed currentCharIdTarget = null; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("idTarget")) currentCharIdTarget = entry.Value.ToString(); // If there is a "uri" attribute, store it as audio path if (entry.Key.Equals("uri")) audioPath = entry.Value.ToString(); } } // If it is a trigger-book tag else if (qName.Equals("trigger-book")) { foreach (KeyValuePair<string, string> entry in attrs) if (entry.Key.Equals("idTarget")) newEffect = new TriggerBookEffect(entry.Value.ToString()); } // If it is a trigger-last-scene tag else if (qName.Equals("trigger-last-scene")) { newEffect = new TriggerLastSceneEffect(); } // If it is a play-sound tag else if (qName.Equals("play-sound")) { // Store the path and background string path = ""; bool background = true; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("background")) background = entry.Value.ToString().Equals("yes"); else if (entry.Key.Equals("uri")) path = entry.Value.ToString(); } // Add the new play sound effect newEffect = new PlaySoundEffect(background, path); } // If it is a trigger-conversation tag else if (qName.Equals("trigger-conversation")) { foreach (KeyValuePair<string, string> entry in attrs) if (entry.Key.Equals("idTarget")) newEffect = new TriggerConversationEffect(entry.Value.ToString()); } // If it is a trigger-cutscene tag else if (qName.Equals("trigger-cutscene")) { foreach (KeyValuePair<string, string> entry in attrs) if (entry.Key.Equals("idTarget")) newEffect = new TriggerCutsceneEffect(entry.Value.ToString()); } // If it is a trigger-scene tag else if (qName.Equals("trigger-scene")) { string scene = ""; int x = 0; int y = 0; foreach (KeyValuePair<string, string> entry in attrs) if (entry.Key.Equals("idTarget")) scene = entry.Value.ToString(); else if (entry.Key.Equals("x")) x = int.Parse(entry.Value.ToString()); else if (entry.Key.Equals("y")) y = int.Parse(entry.Value.ToString()); newEffect = new TriggerSceneEffect(scene, x, y); } // If it is a play-animation tag else if (qName.Equals("play-animation")) { string path = ""; int x = 0; int y = 0; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("uri")) path = entry.Value.ToString(); else if (entry.Key.Equals("x")) x = int.Parse(entry.Value.ToString()); else if (entry.Key.Equals("y")) y = int.Parse(entry.Value.ToString()); } // Add the new play sound effect newEffect = new PlayAnimationEffect(path, x, y); } // If it is a move-player tag else if (qName.Equals("move-player")) { int x = 0; int y = 0; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("x")) x = int.Parse(entry.Value.ToString()); else if (entry.Key.Equals("y")) y = int.Parse(entry.Value.ToString()); } // Add the new move player effect newEffect = new MovePlayerEffect(x, y); } // If it is a move-npc tag else if (qName.Equals("move-npc")) { string npcTarget = ""; int x = 0; int y = 0; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("idTarget")) npcTarget = entry.Value.ToString(); else if (entry.Key.Equals("x")) x = int.Parse(entry.Value.ToString()); else if (entry.Key.Equals("y")) y = int.Parse(entry.Value.ToString()); } // Add the new move NPC effect newEffect = new MoveNPCEffect(npcTarget, x, y); } // Random effect tag else if (qName.Equals("random-effect")) { int probability = 0; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("probability")) probability = int.Parse(entry.Value.ToString()); } // Add the new random effect randomEffect = new RandomEffect(probability); newEffect = randomEffect; readingRandomEffect = true; positiveBlockRead = false; } // wait-time effect else if (qName.Equals("wait-time")) { int time = 0; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("time")) time = int.Parse(entry.Value.ToString()); } // Add the new move NPC effect newEffect = new WaitTimeEffect(time); } // show-text effect else if (qName.Equals("show-text")) { x = 0; y = 0; frontColor = 0; borderColor = 0; audioPath = ""; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("x")) x = int.Parse(entry.Value.ToString()); else if (entry.Key.Equals("y")) y = int.Parse(entry.Value.ToString()); else if (entry.Key.Equals("frontColor")) frontColor = int.Parse(entry.Value.ToString()); else if (entry.Key.Equals("borderColor")) borderColor = int.Parse(entry.Value.ToString()); // If there is a "uri" attribute, store it as audio path else if (entry.Key.Equals("uri")) audioPath = entry.Value.ToString(); } } else if (qName.Equals("highlight-item")) { int type = 0; bool animated = false; string id = ""; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("idTarget")) id = entry.Value.ToString(); if (entry.Key.Equals("animated")) animated = (entry.Value.ToString().Equals("yes") ? true : false); if (entry.Key.Equals("type")) { if (entry.Value.ToString().Equals("none")) type = HighlightItemEffect.NO_HIGHLIGHT; if (entry.Value.ToString().Equals("green")) type = HighlightItemEffect.HIGHLIGHT_GREEN; if (entry.Value.ToString().Equals("red")) type = HighlightItemEffect.HIGHLIGHT_RED; if (entry.Value.ToString().Equals("blue")) type = HighlightItemEffect.HIGHLIGHT_BLUE; if (entry.Value.ToString().Equals("border")) type = HighlightItemEffect.HIGHLIGHT_BORDER; } } newEffect = new HighlightItemEffect(id, type, animated); } else if (qName.Equals("move-object")) { bool animated = false; string id = ""; int x = 0; int y = 0; float scale = 1.0f; int translateSpeed = 20; int scaleSpeed = 20; foreach (KeyValuePair<string, string> entry in attrs) { if (entry.Key.Equals("idTarget")) id = entry.Value.ToString(); if (entry.Key.Equals("animated")) animated = (entry.Value.ToString().Equals("yes") ? true : false); if (entry.Key.Equals("x")) x = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("y")) y = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("scale")) scale = float.Parse(entry.Value.ToString(), CultureInfo.InvariantCulture); if (entry.Key.Equals("translateSpeed")) translateSpeed = int.Parse(entry.Value.ToString()); if (entry.Key.Equals("scaleSpeed")) scaleSpeed = int.Parse(entry.Value.ToString()); } newEffect = new MoveObjectEffect(id, x, y, scale, animated, translateSpeed, scaleSpeed); } else if (qName.Equals("speak-player")) { audioPath = ""; foreach (KeyValuePair<string, string> entry in attrs) { // If there is a "uri" attribute, store it as audio path if (entry.Key.Equals("uri")) audioPath = entry.Value.ToString(); } } // If it is a condition tag, create new conditions and switch the state else if (qName.Equals("condition")) { currentConditions = new Conditions(); subParser = new ConditionSubParser(currentConditions, chapter); subParsing = SUBPARSING_CONDITION; } // Not reading Random effect: Add the new Effect if not null if (!readingRandomEffect && newEffect != null) { effects.add(newEffect); // Store current effect currentEffect = newEffect; } // Reading random effect if (readingRandomEffect) { // When we have just created the effect, add it if (newEffect != null && newEffect == randomEffect) { effects.add(newEffect); } // Otherwise, determine if it is positive or negative effect else if (newEffect != null && !positiveBlockRead) { randomEffect.setPositiveEffect(newEffect); positiveBlockRead = true; } // Negative effect else if (newEffect != null && positiveBlockRead) { randomEffect.setNegativeEffect(newEffect); positiveBlockRead = false; readingRandomEffect = false; newEffect = randomEffect; randomEffect = null; } // Store current effect currentEffect = newEffect; } // If it is reading an effect or a condition, spread the call if (subParsing != SUBPARSING_NONE) { subParser.startElement(namespaceURI, sName, qName, attrs); endElement(namespaceURI, sName, qName); } }
public override void ParseElement(XmlElement element) { string tmpArgVal; int x = 0; int y = 0; string path = ""; string id = ""; bool animated = false, addeffect = true; List<AbstractEffect> effectlist; foreach (XmlElement effect in element.ChildNodes) { addeffect = true; switch (effect.Name) { case "cancel-action": currentEffect = new CancelActionEffect(); break; case "activate": case "deactivate": tmpArgVal = effect.GetAttribute ("flag"); if (!string.IsNullOrEmpty (tmpArgVal)) { chapter.addFlag (tmpArgVal); } if (effect.Name == "activate") currentEffect = new ActivateEffect (tmpArgVal); else currentEffect = new DeactivateEffect (tmpArgVal); break; case "set-value": case "increment": case "decrement": string var = null; int value = 0; tmpArgVal = effect.GetAttribute("var"); if (!string.IsNullOrEmpty(tmpArgVal)){ var = tmpArgVal; } tmpArgVal = effect.GetAttribute("value"); if (!string.IsNullOrEmpty(tmpArgVal)){ value = int.Parse(tmpArgVal); } if(effect.Name == "set-value") currentEffect = new SetValueEffect(var, value); else if(effect.Name == "increment") currentEffect = new IncrementVarEffect(var, value); else currentEffect = new DecrementVarEffect(var, value); chapter.addVar(var); break; case "macro-ref": id = ""; tmpArgVal = effect.GetAttribute("id"); if (!string.IsNullOrEmpty(tmpArgVal)){ id = tmpArgVal; } currentEffect = new MacroReferenceEffect(id); break; case "speak-char": audioPath = ""; currentCharIdTarget = null; tmpArgVal = effect.GetAttribute("idTarget"); if (!string.IsNullOrEmpty(tmpArgVal)){ currentCharIdTarget = tmpArgVal; } tmpArgVal = effect.GetAttribute("uri"); if (!string.IsNullOrEmpty(tmpArgVal)){ audioPath = tmpArgVal; } // Add the effect and clear the current string currentEffect = new SpeakCharEffect(currentCharIdTarget, effect.InnerText.ToString().Trim()); ((SpeakCharEffect) currentEffect).setAudioPath(audioPath); break; case "trigger-last-scene": currentEffect = new TriggerLastSceneEffect(); break; case "play-sound": // Store the path and background bool background = true; path = ""; tmpArgVal = effect.GetAttribute("background"); if (!string.IsNullOrEmpty(tmpArgVal)) { background = tmpArgVal.Equals("yes"); } tmpArgVal = effect.GetAttribute("uri"); if (!string.IsNullOrEmpty(tmpArgVal)) { path = tmpArgVal; } // Add the new play sound effect currentEffect = new PlaySoundEffect(background, path); break; case "consume-object": case "generate-object": case "trigger-book": case "trigger-conversation": case "trigger-cutscene": tmpArgVal = effect.GetAttribute ("idTarget"); if (!string.IsNullOrEmpty (tmpArgVal)) switch (effect.Name) { case "consume-object": currentEffect = new ConsumeObjectEffect (tmpArgVal); break; case "generate-object": currentEffect = new GenerateObjectEffect (tmpArgVal); break; case "trigger-book": currentEffect = new TriggerBookEffect (tmpArgVal); break; case "trigger-conversation": currentEffect = new TriggerConversationEffect (tmpArgVal); break; case "trigger-cutscene": currentEffect = new TriggerCutsceneEffect (tmpArgVal); break; } break; case "trigger-scene": x = 0; y = 0; string scene = ""; tmpArgVal = effect.GetAttribute("idTarget"); if (!string.IsNullOrEmpty(tmpArgVal)) { scene = tmpArgVal; } tmpArgVal = effect.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y = int.Parse(tmpArgVal); } currentEffect = new TriggerSceneEffect(scene, x, y); break; case "play-animation": x = 0; y = 0; path = ""; tmpArgVal = effect.GetAttribute("uri"); if (!string.IsNullOrEmpty(tmpArgVal)) { path = tmpArgVal; } tmpArgVal = effect.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y = int.Parse(tmpArgVal); } // Add the new play sound effect currentEffect = new PlayAnimationEffect(path, x, y); break; case "move-player": x = 0; y = 0; tmpArgVal = effect.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y = int.Parse(tmpArgVal); } // Add the new move player effect currentEffect = new MovePlayerEffect(x, y); break; case "move-npc": x = 0; y = 0; string npcTarget = ""; tmpArgVal = effect.GetAttribute("idTarget"); if (!string.IsNullOrEmpty(tmpArgVal)) { npcTarget = tmpArgVal; } tmpArgVal = effect.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y = int.Parse(tmpArgVal); } // Add the new move NPC effect currentEffect = new MoveNPCEffect(npcTarget, x, y); break; case "random-effect": int probability = 0; tmpArgVal = effect.GetAttribute ("probability"); if (!string.IsNullOrEmpty (tmpArgVal)) { probability = int.Parse (tmpArgVal); } // Add the new random effect randomEffect = new RandomEffect (probability); Effects randomEffectList = new Effects (); new EffectSubParser_ (randomEffectList, this.chapter).ParseElement (effect); randomEffect.setPositiveEffect (randomEffectList.getEffects () [0]); randomEffect.setNegativeEffect (randomEffectList.getEffects () [1]); currentEffect = randomEffect; break; case "wait-time": int time = 0; tmpArgVal = effect.GetAttribute("time"); if (!string.IsNullOrEmpty(tmpArgVal)) { time = int.Parse(tmpArgVal); } // Add the new move NPC effect currentEffect = new WaitTimeEffect(time); break; case "show-text": x = 0; y = 0; frontColor = 0; borderColor = 0; audioPath = ""; tmpArgVal = effect.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("frontColor"); if (!string.IsNullOrEmpty(tmpArgVal)) { frontColor = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("borderColor"); if (!string.IsNullOrEmpty(tmpArgVal)) { borderColor = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("uri"); if (!string.IsNullOrEmpty(tmpArgVal)) { audioPath = tmpArgVal; } // Add the new ShowTextEffect currentEffect = new ShowTextEffect(effect.InnerText.ToString().Trim(), x, y, frontColor, borderColor); ((ShowTextEffect) currentEffect).setAudioPath(audioPath); break; case "highlight-item": int type = 0; id = ""; animated = false; tmpArgVal = effect.GetAttribute("idTarget"); if (!string.IsNullOrEmpty(tmpArgVal)) { id = tmpArgVal; } tmpArgVal = effect.GetAttribute("animated"); if (!string.IsNullOrEmpty(tmpArgVal)) { animated = (tmpArgVal.Equals("yes") ? true : false); } tmpArgVal = effect.GetAttribute("type"); if (!string.IsNullOrEmpty(tmpArgVal)) { if (tmpArgVal.Equals("none")) type = HighlightItemEffect.NO_HIGHLIGHT; if (tmpArgVal.Equals("green")) type = HighlightItemEffect.HIGHLIGHT_GREEN; if (tmpArgVal.Equals("red")) type = HighlightItemEffect.HIGHLIGHT_RED; if (tmpArgVal.Equals("blue")) type = HighlightItemEffect.HIGHLIGHT_BLUE; if (tmpArgVal.Equals("border")) type = HighlightItemEffect.HIGHLIGHT_BORDER; } currentEffect = new HighlightItemEffect(id, type, animated); break; case "move-object": float scale = 1.0f; int translateSpeed = 20; int scaleSpeed = 20; x = 0; y = 0; id = ""; animated = false; tmpArgVal = effect.GetAttribute("idTarget"); if (!string.IsNullOrEmpty(tmpArgVal)) { id = tmpArgVal; } tmpArgVal = effect.GetAttribute("animated"); if (!string.IsNullOrEmpty(tmpArgVal)) { animated = (tmpArgVal.Equals("yes") ? true : false); } tmpArgVal = effect.GetAttribute("x"); if (!string.IsNullOrEmpty(tmpArgVal)) { x = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("y"); if (!string.IsNullOrEmpty(tmpArgVal)) { y = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("scale"); if (!string.IsNullOrEmpty(tmpArgVal)) { scale = float.Parse(tmpArgVal, CultureInfo.InvariantCulture); } tmpArgVal = effect.GetAttribute("translateSpeed"); if (!string.IsNullOrEmpty(tmpArgVal)) { translateSpeed = int.Parse(tmpArgVal); } tmpArgVal = effect.GetAttribute("scaleSpeed"); if (!string.IsNullOrEmpty(tmpArgVal)) { scaleSpeed = int.Parse(tmpArgVal); } currentEffect = new MoveObjectEffect(id, x, y, scale, animated, translateSpeed, scaleSpeed); break; case "speak-player": audioPath = ""; tmpArgVal = effect.GetAttribute("uri"); if (!string.IsNullOrEmpty(tmpArgVal)) { audioPath = tmpArgVal; } // Add the effect and clear the current string currentEffect = new SpeakPlayerEffect(effect.InnerText.ToString().Trim()); break; case "condition": addeffect = false; currentConditions = new Conditions (); new ConditionSubParser_ (currentConditions, chapter).ParseElement (effect); currentEffect.setConditions (currentConditions); effectlist = effects.getEffects (); effectlist[effectlist.Count-1].setConditions (currentConditions); break; case "documentation": addeffect = false; break; default: addeffect = false; Debug.LogWarning ("EFFECT NOT SUPPORTED: " + effect.Name); break; } if(addeffect) effects.add(currentEffect); } }