Skip to content

Instantly share code, notes, and snippets.

@GT3000
Created November 23, 2021 06:30
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/128af41f3a9966b62c7631fb9d148f9e to your computer and use it in GitHub Desktop.
Save GT3000/128af41f3a9966b62c7631fb9d148f9e to your computer and use it in GitHub Desktop.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//Derives from Gold Distribution
public class Soldier : GoldDistribution
{
[SerializeField] private int unitSalary = 5000;
//Overrides the base class of Gold Distribution's CalculateUnitSalary to say how much this unit gets paid
public override void CalculateUnitSalary()
{
Debug.Log("Payroll: " + unitSalary);
}
//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