You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/GleyPlugins/Ads/Scripts/VisualScriptingSupport/GameFlowSupport/ShowRewardedVideo.cs

57 lines
1.4 KiB
C#

#if USE_GAMEFLOW_SUPPORT
namespace GleyMobileAds
{
using GameFlow;
using UnityEngine;
[AddComponentMenu("")]
public class ShowRewardedVideo : Function
{
private bool callbackReceived = false;
private bool executed;
public override bool finished
{
get
{
return callbackReceived;
}
}
// Code implementing any setup required by the action
protected override void OnSetup()
{
callbackReceived = false;
executed = false;
}
// Code implementing the effect of the action
protected override void OnExecute()
{
// Do something with the declared property
if (executed == false)
{
if (Advertisements.Instance.IsRewardVideoAvailable())
{
Advertisements.Instance.ShowRewardedVideo(VideoComplete);
}
else
{
callbackReceived = true;
_output.SetValue(false);
}
executed = true;
}
}
//after the video is complete this method is automatically triggered
private void VideoComplete(bool complete)
{
callbackReceived = true;
_output.SetValue(complete);
}
}
}
#endif