Skip to content

Instantly share code, notes, and snippets.

@GT3000
Created November 23, 2021 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GT3000/f78763375d25e9963443979ac2fe5297 to your computer and use it in GitHub Desktop.
Save GT3000/f78763375d25e9963443979ac2fe5297 to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//Derives from Gold Distribution
public class Mercenary : GoldDistribution
{
[SerializeField] private int contractLength = 1;
[SerializeField] private int contractRate = 10000;
//Overrides the base class of Gold Distribution's CalculateUnitSalary to say how much this unit gets paid
public override void CalculateUnitSalary()
{
Debug.Log("Payroll: " + (contractLength * contractRate));
Debug.Log("Contract Length: " + contractLength);
}
//Calls UnitIdentification in the base GoldDistribution class and the runs the overrides CalculateUnit Salary from GoldDistribution
private void Start()
{
UnitIdentification();
CalculateUnitSalary();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment