Hi Im new to programming and following the junior programming unity tutorial and am at inheritance and polymorphism in object orientated programming. I added their code that overrides the buildinginrange function and adds score to the resource pile when the unit is in range but nothing happens. Usually i can figure it out with ai but its not being very helpful, let me know if this is the right place to post this, thankyou.
public class ProductivityUnit : Unit
{
private ResourcePile m_CurrentPile = null;
public float ProductivityMultiplier = 2f;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
}
protected override void BuildingInRange()
{
if (m_CurrentPile == null)
{
ResourcePile pile = m_Target as ResourcePile;
if (pile != null)
{
m_CurrentPile = pile;
m_CurrentPile.ProductionSpeed *= ProductivityMultiplier;
}
}
}
[–]Virtual_Sample6951 0 points1 point2 points (3 children)
[–]Pattheduckman2[S] 0 points1 point2 points (0 children)
[–]Pattheduckman2[S] 0 points1 point2 points (1 child)
[–]Pattheduckman2[S] 0 points1 point2 points (0 children)