static void InteractionTrap1Interaction(Furnishing furnishing, Actor actor) { var trapLevel = int.Parse(furnishing.GetOtherAttributeValue("TrapLevel")); if (actor.HasTrait(Trait.Player)) { MainGraphicDisplay.TextConsole.AddOutputText(string.Format("Trap hits you for {0} damage", trapLevel)); } }
static void SetupExtraParameters(Furnishing furnishing, Dictionary <string, string> otherParameters) { if (otherParameters.ContainsKey("LevelTransition")) { SetupLevelTransitionObject(furnishing, otherParameters); } if (otherParameters.ContainsKey("InteractionTrap")) { SetupInteractionTrap(furnishing, otherParameters); } }
static void LevelTransitionInteraction(Furnishing furnishing, Actor actor) { if (actor.HasTrait(Trait.Player)) { var destinationLevel = (Levels.LevelId)Enum.Parse(typeof(Levels.LevelId), furnishing.GetOtherAttributeValue("DestinationLevel")); var destinationXLoc = int.Parse(furnishing.GetOtherAttributeValue("DestinationXLoc")); var destinationYLoc = int.Parse(furnishing.GetOtherAttributeValue("DestinationYLoc")); MainProgram.LevelTransition(destinationLevel, destinationXLoc, destinationYLoc); } }
static void SetupInteractionTrap(Furnishing furnishing, Dictionary <string, string> otherParameters) { if (otherParameters.ContainsKey("TrapType") && otherParameters.ContainsKey("TrapLevel")) { furnishing.SetOtherAttribute("TrapType", otherParameters["TrapType"]); furnishing.SetOtherAttribute("TrapLevel", otherParameters["TrapLevel"]); furnishing.InteractionTrapName = otherParameters["TrapType"] + "Interaction"; } else { ErrorLogger.AddDebugText(string.Format("Incorrect Interaction Trap Specification at: {0}, {1}", furnishing.XLoc, furnishing.YLoc)); } }
// General setup functions or "Add-ons" static void SetupLevelTransitionObject(Furnishing furnishing, Dictionary <string, string> otherParameters) { if (otherParameters.ContainsKey("DestinationLevel") && otherParameters.ContainsKey("DestinationXLoc") && otherParameters.ContainsKey("DestinationYLoc")) { furnishing.SetOtherAttribute("DestinationLevel", otherParameters["DestinationLevel"]); furnishing.SetOtherAttribute("DestinationXLoc", otherParameters["DestinationXLoc"]); furnishing.SetOtherAttribute("DestinationYLoc", otherParameters["DestinationYLoc"]); furnishing.InteractionFunctionName = "LevelTransitionInteraction"; } else { ErrorLogger.AddDebugText(string.Format("Incorrect Level Transition Object Specification at: {0}, {1}", furnishing.XLoc, furnishing.YLoc)); } }