public void Setup() { action = new DeployArtifactAction(); action.TestConfigurer = new ArtifactoryConfigurer(); var cred = File.ReadAllText(@"c:\temp\art.txt").Split('|'); action.TestConfigurer.Username = cred[0]; action.TestConfigurer.Password = cred[1]; action.TestConfigurer.Server = @"http://artifactory.local:8081/artifactory"; del = new DeleteItemAction(); del.TestConfigurer = new ArtifactoryConfigurer(); del.TestConfigurer.Username = cred[0]; del.TestConfigurer.Password = cred[1]; del.TestConfigurer.Server = @"http://artifactory.local:8081/artifactory"; ret = new RetrieveArtifactAction(); ret.TestConfigurer = new ArtifactoryConfigurer(); ret.TestConfigurer.Username = cred[0]; ret.TestConfigurer.Password = cred[1]; ret.TestConfigurer.Server = @"http://artifactory.local:8081/artifactory"; set = new SetItemPropertiesAction(); set.TestConfigurer = new ArtifactoryConfigurer(); set.TestConfigurer.Username = cred[0]; set.TestConfigurer.Password = cred[1]; set.TestConfigurer.Server = @"http://artifactory.local:8081/artifactory"; }
private static float GetMultiplier(SetItemPropertiesAction action) { float multiplier = 1.0f; switch (action) { case SetItemPropertiesAction.Use: multiplier = 1.0f; break; case SetItemPropertiesAction.UnUse: multiplier = -1f; break; default: Debug.LogWarning("Action " + action + " not found (Going with default use)"); break; } return(multiplier); }
public static void SetItemProperties(InventoryPlayer player, InventoryItemProperty[] properties, SetItemPropertiesAction action) { float multiplier = 1.0f; switch (action) { case SetItemPropertiesAction.Use: multiplier = 1.0f; break; case SetItemPropertiesAction.UnUse: multiplier = -1f; break; default: Debug.LogWarning("Action " + action + " not found (Going with default use)"); break; } // Use the item's properties. if (player != null) { foreach (var property in properties) { var stat = player.characterCollection.GetStat(property.category, property.name); if (stat != null) { switch (property.actionEffect) { case InventoryItemProperty.ActionEffect.Add: if (property.isFactor) { //if (property.increaseMax) // stat.ChangeFactorMax((property.floatValue - 1.0f) * multiplier, true); //else stat.ChangeFactorMax((property.floatValue - 1.0f) * multiplier, true); } else { //if(property.increaseMax) // stat.ChangeMaxValueRaw(property.floatValue * multiplier, true); //else stat.ChangeMaxValueRaw(property.floatValue * multiplier, true); } break; case InventoryItemProperty.ActionEffect.Restore: if (property.isFactor) stat.ChangeCurrentValueRaw((stat.currentValue * (property.floatValue - 1.0f)) * multiplier); else stat.ChangeCurrentValueRaw(property.floatValue * multiplier); break; default: Debug.LogWarning("Action effect" + property.actionEffect + " not found."); break; } //player.characterCollection.NotifyStatChanged(stat); // Done by the stat itself. } else { Debug.LogWarning("Stat based on property: " + property.name + " not found on player."); } } } }
public static void SetItemProperty(IEquippableCharacter character, StatDecorator stat, SetItemPropertiesAction action, bool fireEvents = true) { Assert.IsNotNull(character, "Null player object passed, make sure the InventoryPlayerManager.instance.currentPlayer is set!"); float multiplier = GetMultiplier(action); character.stats.Set(stat, multiplier); }
public static void SetItemProperties(IEquippableCharacter character, StatDecorator[] stats, SetItemPropertiesAction action, bool fireEvents = true) { // Use the item's properties. if (character != null) { foreach (var property in stats) { SetItemProperty(character, property, action, fireEvents); } } }