Skip to content

BaseClass

Commander-Cat101 edited this page Apr 10, 2023 · 4 revisions

Overview

BaseClass is the framework of all the classes, this has the data for all classes. At runtime all types that inherit ClassBase are put into a list of available classes.

Properties

abstract string Name { get; } BaseClass.Name is the name used in the selection menu

abstract string Description { get; } BaseClass.Description is the description for the given class

abstract string Pros { get; } BaseClass.Pros are the pros stitched together with the cons to form the effects of the class

abstract string Cons { get; } BaseClass.Pros are the cons stitched together with the pros to form the effects of the class. The pros and cons are stitched together by "- Pros \n" + BaseClass.Pros + "\n\n- Cons \n" + BaseClass.Cons

abstract Sprite Icon { get; } BaseClass.Icon is the icon used to represent the class in the select screen, and when selected becomes the icon for the button into the select screen

abstract void EditTower(Tower tower) BaseClass.EditTower is called upon placing or upgrading a tower, it can be used to easily manipulate towers

virtual bool ShowInSelector { get; set; } = true BaseClass.ShowInSelector determines whether the class is shown in the select screen

virtual float CashMultiplier { get; } = 1f BaseClass.CashMultiplier makes it easy to change the amount of cash you get from all sources

virtual int EffectsHeight { get; } = 800 BaseClass.EffectsHeight sets the height of the text in the effects panel

Methods

bool IsSelected(BaseClass @class) Returns true if the given class is selected.

Example

An example of a class is the early version of the Giant. This class makes all towers visuals bigger

public class Giant : BaseClass
    {
        public override string Name => "Giant";
        public override string Description => "With Dr.Monkeys Giant Potion all monkeys can grow to the size of pat fusty";

        public override string Pros => "All Towers Become BIG";

        public override string Cons => "FirstLineOfCons\nSecondLineOfCons";

        public override Sprite Icon => ModContent.GetSprite<ClassesRemasteredMain>("Giant");
        public override void EditTower(Tower tower)
        {
            var Tower = tower.rootModel.Cast<TowerModel>().Duplicate();
            Tower.displayScale = 1.3f;
            tower.UpdateRootModel(Tower);
        }
    }

Clone this wiki locally