So far i have this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using MoreMountains.Tools;
namespace MoreMountains.CorgiEngine
{
public class UpgradeMenu : MonoBehaviour
{
[SerializeField]
private Text healthText;
[SerializeField]
private Text damageText;
private Health health;
private DamageOnTouch damage;
protected HealthBar _healthBar;
public int DamageCaused;
[SerializeField]
private float healthMultiplier = 1.3f;
private float damageMultiplier = 1.3f;
void OnEnable()
{
health = Health.Instance;
damage = DamageOnTouch.Instance;
UpdateValues();
}
void UpdateValues()
{
_healthBar = "Health + " + health.MaximumHealth.ToString();
damage = "Damage + " + damage.DamageCaused.ToString();
}
public void UpgradeHealth()
{
health.MaximumHealth = (int)(health.MaximumHealth *healthMultiplier);
UpdateValues ();
}
public void UpgradeDamage()
{
damage.DamageCaused = (int)(damage.DamageCaused * damageMultiplier);
UpdateValues ();
}
}
}
You didn’t tell us anything. What do you need help with? You didn’t even ask a question…
yeah, thought so, sorry XD i was flicking back and forth… So basically my idea atm is this:
The 2 icons next to the gun are the HP upgrade and gun upgrade (the words disappeared as i was trying to capture it)
The guns on the right are what you purchase…
So, i was wondering as i haven’t done upgrading systems before how would i do a basic upgrade system and how would i be able to use the guns in game and have the guns using different values of damage while upgrading the damage?
(Just a quick one, i have these errors:
-
Assets/Resource/Scripts/UpgradeMenu.cs(37,13): error CS0029: Cannot implicitly convert type string' to
MoreMountains.CorgiEngine.DamageOnTouch’
-
Assets/Resource/Scripts/UpgradeMenu.cs(36,17): error CS0029: Cannot implicitly convert type string' to
MoreMountains.CorgiEngine.HealthBar’
-
Assets/Resource/Scripts/UpgradeMenu.cs(29,27): error CS0117: MoreMountains.CorgiEngine.DamageOnTouch' does not contain a definition for
Instance’
-
Assets/Resource/Scripts/UpgradeMenu.cs(28,20): error CS0117: MoreMountains.CorgiEngine.Health' does not contain a definition for
Instance’
i am not sure what to do with this XD)
I can answer your errors real quick, the rest requires more than I can type right now and honestly isn’t a simple answer.
The cannot convert errors are simple. You are trying to set a type = to a string. HealthBar is a class and yet you want to set it equal to a string. Chances are it has a method in it that takes a string or an int or something to setup the healthbar. Same applies to damageOnTouch. You need to see what methods these two classes have to interact with them.
The other two errors mean that those classes don’t have anything defining what Instance is. Which means within those classes there isn’t a field or property named “Instance”.
I don’t use the CorgiEngine, so the best I can say is double check those classes if you have access to them to make sure you are accessing the right static field/property.
ah right okay, yeah i’m not sure what i am looking for XD.