SCILLBattlePassRewardIcon

public class SCILLBattlePassRewardIcon : MonoBehaviour

Overview

This component will handle a reward available for a battle pass level. Every level can have a reward and it typically is represented with an icon and some sort of state information. Often rewards can be clicked to show a nice preview of the reward.

Create a prefab with this component attached to the root Game Object and build a nice UI below it to render an icon with lock and claimed state icons. Connect that prefab to the rewardIconPrefab setting of SCILLBattlePassLevel. The level component will then instantiate this prefab automatically.

You need to create a SCILLReward asset and set the reward to the name of this reward asset in the Admin Panel. This class will load this resource (make sure its in a Resources folder in Unity) and will take the name and image from this reward asset to set the UI elements connected.

Inspector properties

rewardImage

public UnityEngine.UI.Image rewardImage;

An image field that will be used to set the image of the SCILLReward asset.

lockedIcon

public GameObject lockedIcon;

If the level of this reward has not been unlocked yet, then this GameObject will be shown. Otherwise it will be hidden.

claimedIcon

public GameObject claimedIcon;

If the reward already has been claimed for this reward, then this GameObject will be shown, otherwise it will be hidden.

Methods

UpdateUI

public void UpdateUI()

Trigger a UI update. That is done automatically whenever anything changes but you can also trigger an update manually by calling this function.

Virtual methods

OnClaimed

protected virtual void OnClaimed(bool claimed)

This functions listens on the OnBattlePassLevelRewardClaimed event of SCILLBattlePassManager and will show the claimedIcon to indicate that this levels reward has been claimed. You can override this method if you want to add animations or your own business logic.