public static Entity Load(Level level, LevelData levelData, Vector2 offset, EntityData entityData) { Trigger trigger = new ExtendedVariantTrigger(entityData, offset); trigger.Add(new FlagToggleComponent(entityData.Attr("flag"), entityData.Bool("inverted"))); return(trigger); }
public int GetExpectedVariantValue(ExtendedVariantsModule.Variant variant) { if (overridenVariantsInRoomRevertOnLeave.ContainsKey(variant)) { // variant was replaced in current room in "revert on leave" mode: we expect this value to be set. return(overridenVariantsInRoomRevertOnLeave[variant]); } if (overridenVariantsInRoom.ContainsKey(variant)) { // variant was replaced in current room: we expect this value to be set. return(overridenVariantsInRoom[variant]); } if (ExtendedVariantsModule.Session.VariantsEnabledViaTrigger.ContainsKey(variant)) { // variant was replaced in a previous room: we expect this value to be set. return(ExtendedVariantsModule.Session.VariantsEnabledViaTrigger[variant]); } // no variant trigger has been used: we expect the default value. return(ExtendedVariantTrigger.GetDefaultValueForVariant(variant)); }