<aside> <img src="/icons/reorder_gray.svg" alt="/icons/reorder_gray.svg" width="40px" />

Navigation

</aside>

🏠 Home Page

Getting Started

Architecture

Level System

Characters & Vehicles

Run Mechanics

World Objects

Boosters & Modifiers

Progression & Economy

UI

Save & Debugging

Modules

Publishing

Reference

💰 Monetization (Ads & IAP)

<aside> 💡 Every Character has three permanent upgrades, one for each role: launcher power, vehicle efficiency and income multiplier. The player buys the next stage on the start screen.

</aside>

Subsystems

upgrade-asset.png

page-start.png

Roles

Role Asset type Read by Effect
LauncherPower LauncherPowerUpgrade Launchers through ProgressionController.LauncherPowerMultiplier Multiplies the launch force. A stage can carry a new launcher model.
VehicleEfficiency VehicleEfficiencyUpgrade, CarUpgrade, WheelUpgrade, PlaneUpgrade VehicleData.CreateBehavior() Improves the vehicle. A stage can carry a new vehicle model.
IncomeMultiplier IncomeMultiplierUpgrade GameController through ProgressionController.IncomeMultiplier Multiplies the money earned for the distance.

Each multiplier is 1 + bonus percent / 100, plus the bonus of the active pre-run modifier. The value is read at the moment of use, so a purchase is included in the next launch and run.

Upgrade asset

Menu: Create → Data → Upgrades. The assets of the template are stored in Assets/Project Files/Data/Progression/Level N/Upgrades.

Field Description
Upgrade Type The role.
Upgrade Id Unique id, generated from the asset GUID. The save uses it as a key.
Title Name shown on the slot.
Upgrades The list of stages. Stage 0 is the base state.

Test buttons in the Inspector: Upgrade, Max and Reset.

Stage fields

Every stage has the fields of BaseUpgradeStage:

Field Description
Price Price of the stage.
Currency Type Currency of the price.
Preview Sprite Image shown on the slot.

Stages of each upgrade type add their own values:

Upgrade Stage values
LauncherPowerUpgrade Bonus Percent, Visual Prefab
VehicleEfficiencyUpgrade Bonus Percent, Visual Prefab
IncomeMultiplierUpgrade Bonus Percent
CarUpgrade Grip, Rolling Resistance, Drag, Visual Prefab
WheelUpgrade Rolling Resistance, Min Stable Speed, Visual Prefab
PlaneUpgrade Drag, Stall Speed, Lift Response, Fuel, Visual Prefab

Saving

UpgradesController.LoadUpgrades is called by ProgressionController.LoadLevel in GameController.Awake. It binds every upgrade to a save object with the key upgrades:{UpgradeId}.

Two Characters that link the same upgrade asset share the progress. Separate assets keep the progress apart.

Visual stages

A stage that implements IVisualUpgradeStage can carry a Visual Prefab. On purchase, UpgradeVisualSequence plays: the UI hides, the camera zooms to the target, the target bounces with particles and the model is replaced. A stage without a prefab keeps the model of the previous stage. A stage of a role without IVisualUpgradeStage (IncomeMultiplier) plays only a small bounce.

The target of the sequence implements IUpgradeVisualTarget:

Member Description
FocusPoint Camera focus.
UpgradeFxPoints Points of the charge and burst particles.
UpgradeScaleTargets Objects that the bounce scales.
UpgradeFocusPadding Multiplier of the camera padding.
SetPermanentVisual(prefab) Replaces the model.

PlayerController and Launcher implement the interface.

UpgradeSlot

The slot reads the upgrade of its Upgrade Type and shows the title, the price, the preview, the level and the stage cells.

Field Description
Upgrade Type The role of the slot.
Visual Target, Target Character, Target Launcher The object that receives the visual stage. The character and the launcher are spawned per level, so the slot resolves them at the moment of the purchase. Leave empty for the income slot.
Stage Images, Stage Active Color, Stage Inactive Color One cell for each purchasable stage.

How to add a new upgrade type for a vehicle

  1. Create the upgrade class. Inherit from Upgrade<T> with a nested stage class.

    using UnityEngine;
    
    namespace Watermelon
    {
        using Upgrades;
    
        [CreateAssetMenu(menuName = "Data/Upgrades/Hover Upgrade", fileName = "Hover Upgrade")]
        public class HoverUpgrade : Upgrade<HoverUpgrade.Stage>
        {
            public override void Init() { }
    
            [System.Serializable]
            public class Stage : BaseUpgradeStage, IVisualUpgradeStage
            {
                [SerializeField] private float turnRate = 40f;
                public float TurnRate => turnRate;
    
                [SerializeField] private GameObject visualPrefab;
                public GameObject VisualPrefab => visualPrefab;
            }
        }
    }
    
  2. Read the stage. In the VehicleData class, read the stage with UpgradesController.GetUpgrade<HoverUpgrade>(UpgradeType.VehicleEfficiency) and fall back to the asset values when it is null.

  3. Create the asset. Fill the stages: price, currency, preview, values and visual prefab.

  4. Link it. Assign the asset to Vehicle Efficiency Upgrade of the Character. The field accepts any BaseUpgrade.

How to add stages

Add elements to the Upgrades list of the asset. The Stage Images list of the slot must have a cell for each purchasable stage. Longer tracks wrap around.

Balance

Use the Balance Tool to calculate the prices and the bonuses of the sled stages. See Balance Tool.