PowerUp

PowerUp Overview

PowerUp acts as the foundation for all power-ups, inheriting from Trigger.cs and offering essential tools such as PowerUp Trigger regeneration. Refer to PowerUp Examples for implementation guidance.

PROPERTIES

  • regenerate: Set to true if the power up should appear again after being triggered.

  • regenerateTime: Time to regenerate in seconds.

ADDING CUSTOM POWER UPS

Below is a sample code for adding a custom Power-Up implementation.

using UnityEngine;
using cowsins2D;

public class MyCustomPowerUp : PowerUp
    {
        // this method gets called when the power up is triggered
        // call anything you need in here.
        // You have access to the player gameObject ( target ). You can access its components
        // through GetComponent<ComponentName>()
        public override void TriggerAction(GameObject target)
        {
            // Write your custom behaviour here
            base.TriggerAction(target);
        }
    }

Last updated