public void SetSlidersOnOpen() { Slider slider; StatPack.StatType type; type = StatPack.StatType.Acceleration; slider = PickSlider(type); slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), GarageStats.CurrentStatValue(type)); type = StatPack.StatType.Armor; slider = PickSlider(type); slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), GarageStats.CurrentStatValue(type)); type = StatPack.StatType.Grip; slider = PickSlider(type); slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), GarageStats.CurrentStatValue(type)); type = StatPack.StatType.Health; slider = PickSlider(type); slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), GarageStats.CurrentStatValue(type)); type = StatPack.StatType.Nitro; slider = PickSlider(type); slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), GarageStats.CurrentStatValue(type)); type = StatPack.StatType.TopSpeed; slider = PickSlider(type); slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), GarageStats.CurrentStatValue(type)); type = StatPack.StatType.Weight; slider = PickSlider(type); slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), GarageStats.CurrentStatValue(type)); damageSliders.SetSliders(); }
private void SendStats(StatPack stats, PowerupAttachable attachable) { if (attachable.isWeapon) { GarageStats.TryUpdate(stats, attachable.weaponLocation, attachable.baseDamage); } else { GarageStats.TryUpdate(stats, attachable.modLocation); } }
public void ReApplyStats(StatPack powerups) { StatPack newStats = StatPack.ApplyToBase(baseStats, powerups); maxHealth = newStats.GetAdd(StatPack.StatType.Health); maxNO2 = newStats.GetAdd(StatPack.StatType.Nitro); currentArmor = newStats.GetAdd(StatPack.StatType.Armor); controller.GetCar().GetComponent <Rigidbody2D>().mass = newStats.GetAdd(StatPack.StatType.Weight); controller.GetCar().GetComponent <Driving>().topSpeed = newStats.GetAdd(StatPack.StatType.TopSpeed); controller.GetCar().GetComponent <Driving>().staticCoefficientOfFriction = newStats.GetAdd(StatPack.StatType.Grip); controller.GetCar().GetComponent <Driving>().acceleration = newStats.GetAdd(StatPack.StatType.Acceleration); GarageStats.SetCurrentStats(newStats); }
public void SetupPlayer() { baseStats = new StatPack(); baseStats.SetAdd(StatPack.StatType.Health, 100); baseStats.SetAdd(StatPack.StatType.Nitro, 100); baseStats.SetAdd(StatPack.StatType.Weight, controller.GetCar().GetComponent <Rigidbody2D>().mass); baseStats.SetAdd(StatPack.StatType.TopSpeed, controller.GetCar().GetComponent <Driving>().topSpeed); baseStats.SetAdd(StatPack.StatType.Grip, controller.GetCar().GetComponent <Driving>().staticCoefficientOfFriction); baseStats.SetAdd(StatPack.StatType.Acceleration, controller.GetCar().GetComponent <Driving>().acceleration); GarageStats.SetBaseStats(baseStats); GarageStats.SetCurrentStats(baseStats); }
public void SetSlidersOnNewEquip() { Slider slider; StatPack.StatType type; type = StatPack.StatType.Acceleration; slider = PickSlider(type); slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), GarageStats.CurrentStatValue(type)); slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(1, 0, 1, 0.3f); type = StatPack.StatType.Armor; slider = PickSlider(type); slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), GarageStats.CurrentStatValue(type)); slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(1, 0, 1, 0.3f); type = StatPack.StatType.Grip; slider = PickSlider(type); slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), GarageStats.CurrentStatValue(type)); slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(1, 0, 1, 0.3f); type = StatPack.StatType.Health; slider = PickSlider(type); slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), GarageStats.CurrentStatValue(type)); slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(1, 0, 1, 0.3f); type = StatPack.StatType.Nitro; slider = PickSlider(type); slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), GarageStats.CurrentStatValue(type)); slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(1, 0, 1, 0.3f); type = StatPack.StatType.TopSpeed; slider = PickSlider(type); slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), GarageStats.CurrentStatValue(type)); slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(1, 0, 1, 0.3f); type = StatPack.StatType.Weight; slider = PickSlider(type); slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), GarageStats.CurrentStatValue(type)); slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(1, 0, 1, 0.3f); damageSliders.SetSliders(); }
public void ShowStatBars(StatPack pack, StatPack otherPack) { Slider slider; StatPack newStats; StatPack.StatType type; StatPack currentStats = GarageStats.currentStats; newStats = StatPack.Instead(GarageStats.currentStats, otherPack, pack); type = StatPack.StatType.Acceleration; slider = PickSlider(type); if (newStats.GetAdd(type) > currentStats.GetAdd(type) + 0.00001f) { slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(0, 1, 0, 0.3f); } if (newStats.GetAdd(type) < currentStats.GetAdd(type) - 0.00001f) { slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(1, 0, 0, 0.3f); } slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), newStats.GetAdd(type)); type = StatPack.StatType.Armor; slider = PickSlider(type); if (newStats.GetAdd(type) > currentStats.GetAdd(type) + 0.00001f) { slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(0, 1, 0, 0.3f); } if (newStats.GetAdd(type) < currentStats.GetAdd(type) - 0.00001f) { slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(1, 0, 0, 0.3f); } slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), newStats.GetAdd(type)); type = StatPack.StatType.Grip; slider = PickSlider(type); if (newStats.GetAdd(type) > currentStats.GetAdd(type) + 0.00001f) { slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(0, 1, 0, 0.3f); } if (newStats.GetAdd(type) < currentStats.GetAdd(type) - 0.00001f) { slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(1, 0, 0, 0.3f); } slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), newStats.GetAdd(type)); type = StatPack.StatType.Health; slider = PickSlider(type); if (newStats.GetAdd(type) > currentStats.GetAdd(type) + 0.00001f) { slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(0, 1, 0, 0.3f); } if (newStats.GetAdd(type) < currentStats.GetAdd(type) - 0.00001f) { slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(1, 0, 0, 0.3f); } slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), newStats.GetAdd(type)); type = StatPack.StatType.Nitro; slider = PickSlider(type); if (newStats.GetAdd(type) > currentStats.GetAdd(type) + 0.00001f) { slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(0, 1, 0, 0.3f); } if (newStats.GetAdd(type) < currentStats.GetAdd(type) - 0.00001f) { slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(1, 0, 0, 0.3f); } slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), newStats.GetAdd(type)); type = StatPack.StatType.TopSpeed; slider = PickSlider(type); if (newStats.GetAdd(type) > currentStats.GetAdd(type) + 0.00001f) { slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(0, 1, 0, 0.3f); } if (newStats.GetAdd(type) < currentStats.GetAdd(type) - 0.00001f) { slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(1, 0, 0, 0.3f); } slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), newStats.GetAdd(type)); type = StatPack.StatType.Weight; slider = PickSlider(type); if (newStats.GetAdd(type) > currentStats.GetAdd(type) + 0.00001f) { slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(0, 1, 0, 0.3f); } if (newStats.GetAdd(type) < currentStats.GetAdd(type) - 0.00001f) { slider.transform.Find("Fill Area").Find("Fill").GetComponent <Image>().color = new Color(1, 0, 0, 0.3f); } slider.value = SliderPosition(GarageStats.MinStatValue(type), GarageStats.MaxStatValue(type), newStats.GetAdd(type)); }