0.03 - BaseClass and Interface


After getting the supersimple Click to Move and the triggerColliders up and running, i really went onto an adventure on this next part. Since everything was hardcoded directly into the playerscript. Since i want to be having 4 different heroes being controlled by the player, i need to come up with a way to make that possible.

Since i am supernew on programming (Been doing it on and off for about 6 months) i had to get into some research. And what did my little eye spot, but if not programming in an OOP (ObjectOrientedProgramming) and the use of BaseClasses and Interfaces.


    [Header("References")]

    public DamageSkillSO damageSkill; // Skada färdighet för att hålla din enda färdighet.

    public PlayerSkillBar playerSkillBar;

    public Material lineMaterial;

    private EnemyBase targetEnemy;

    private bool isEnemyInsideTrigger = false;

    private LineRendererController lineRendererController;

    private float skillCooldown = 0f;

    private bool isCooldownCoroutineRunning = false;

 private bool isDelayOver = true;

private float lastSkillTime;

So getting from a DamageDealerRole-skript, i created a BaseClass-script as follows.

    [Header("References")]

    public PlayerSkillBar playerSkillBar;

    public Material lineMaterial;

    protected LineRendererController lineRendererController;

    protected float skillCooldown = 0f;

    protected bool isCooldownCoroutineRunning = false;

    protected bool isDelayOver = true;

    protected float lastSkillTime;

    // Common methods and properties can go here.

    protected void Start()

    {

        lineRendererController = GetComponent<LineRendererController>();

    }

So from this, i could create four different kind of CharacterRoles such as a Tank, Healer, Support and Damage Dealer, with their own implementations of the variables.


Get FourFold Heroes

Leave a comment

Log in with itch.io to leave a comment.