public override void Upgrade(SpecialComponent component) { var reduceArmor = component as ReduceArmorComponent; if (reduceArmor == null) { Debug.LogWarning("Invalid Component"); return; } reduceArmor.Amount.Value = PowerIncreaseType.Increase(reduceArmor.Amount.Value, PowerByAmount); float newChance = ChanceIncreaseType.Increase(reduceArmor.Chance, ChanceByAmount); if (reduceArmor.ChanceHasUpperLimit) { reduceArmor.Chance = Math.Min( newChance, reduceArmor.ChanceUpperLimit ); } else { reduceArmor.Chance = newChance; } }
private SpecialButton FindButton(SpecialComponent component) { foreach (SpecialButton button in buttons) { if (button.IsEqualTo(component.GetSpecialType())) { return(button); } } return(null); }
void Start() { meshAgent = GetComponent <NavMeshAgent>(); attackComponent = GetComponent <AttackComponent>(); movementComponent = GetComponent <MovementComponent>(); playerIdComponent = GetComponent <PlayerIdComponent>(); specialComponent = GetComponent <SpecialComponent>(); orientator = GetComponentInChildren <AnimatorOrientatorPlayer>(); if (playerIdComponent == null) { throw new ArgumentNullException("PlayerIdComponent is not assigned to player"); } }
public override void CopyDataToTargetComponent(SpecialComponent targetComponent) { var target = targetComponent as PoisonComponent; if (target == null) { Debug.LogError("Invalid component"); return; } target.Dps = Dps; target.Duration = Duration; }
public override void CopyDataToTargetComponent(SpecialComponent targetComponent) { var target = targetComponent as ReduceSpeedComponent; if (target == null) { Debug.LogError("Invalid component"); return; } target.Amount = Amount; target.AmountType = AmountType; target.Duration = Duration; }
public override void CopyDataToTargetComponent(SpecialComponent targetComponent) { var target = targetComponent as ReduceArmorComponent; if (target == null) { Debug.LogError("Invalid component"); return; } target.Amount = Amount; target.Chance = Chance; target.ChanceHasUpperLimit = ChanceHasUpperLimit; target.ChanceUpperLimit = ChanceUpperLimit; }
public override void CopyDataToTargetComponent(SpecialComponent targetComponent) { var target = targetComponent as SplashDamageComponent; if (target == null) { Debug.LogError("Invalid component"); return; } target.Damage = Damage; target.SplashRadius = SplashRadius; target.HasUpperLimit = HasUpperLimit; target.UpperLimit = UpperLimit; target.DamageCurve = DamageCurve; target.Enemies = Enemies; }
public List <SpecialComponent> GetPropertyList() { List <SpecialComponent> components = new List <SpecialComponent>(); SpecialComponent currentComponent = itemProperties; if (currentComponent == null) { return(null); } components.Add(currentComponent); while (currentComponent.BaseComponent() != null) { currentComponent = currentComponent.BaseComponent(); components.Add(currentComponent); } return(components); }
public override void Upgrade(SpecialComponent component) { var splashComponent = component as SplashDamageComponent; if (splashComponent == null) { Debug.LogWarning("Invalid component"); return; } float newRadius = RadiusIncrease.Increase(splashComponent.SplashRadius, ValueToUse); if (splashComponent.HasUpperLimit) { splashComponent.SplashRadius = Math.Min( newRadius, splashComponent.UpperLimit); } else { splashComponent.SplashRadius = newRadius; } }
public SpecialComponent Decorate(SpecialComponent special) { SpecialComponent s; switch (type) { case SpecialType.ExtraHot: s = new SpecialExtraHot(special); return(s); case SpecialType.LittleOil: s = new SpecialLittleOil(special); return(s); case SpecialType.LittleSalt: s = new SpecialLittleSalt(special); return(s); case SpecialType.NoBeanSprouts: s = new SpecialNoBeansprouts(special); return(s); case SpecialType.NoChilli: s = new SpecialNoChilli(special); return(s); case SpecialType.NoMSG: s = new SpecialNoMSG(special); return(s); case SpecialType.NoOnions: s = new SpecialNoOnions(special); return(s); case SpecialType.NoPeanuts: s = new SpecialNoPeanuts(special); return(s); case SpecialType.NoPeas: s = new SpecialNoPeas(special); return(s); case SpecialType.NoPork: s = new SpecialNoPork(special); return(s); case SpecialType.NoShrimps: s = new SpecialNoShrimps(special); return(s); case SpecialType.LittleChilli: s = new SpecialLittleChilli(special); return(s); case SpecialType.NoVegetables: s = new SpecialNoVegetables(special); return(s); case SpecialType.NoWaterChestnuts: s = new SpecialNoWaterChestnuts(special); return(s); case SpecialType.SauceSeperate: s = new SpecialSauceSeperate(special); return(s); case SpecialType.Spicy: s = new SpecialSpicy(special); return(s); case SpecialType.ExtraPancakes: s = new SpecialExtraPancakes(special); return(s); case SpecialType.NoSalt: s = new SpecialNoSalt(special); return(s); default: return(special); } }
public void UpdateText(SpecialComponent special) { _text.color = special.SpecialType.UiColor; _text.text = special.GetUiText(); }