У меня есть кнопка подсказки в моей игре, но она срабатывает при каждом нажатии на нее. Мне нужно чтобы он срабатывал только один раз каждые 3 клика
Я пытался добавить loadCount = 0
и оператор if
if (loadCount % 3 == 0) { }
но, похоже, не работает
изображение для справки: https://ibb.co/L9LnNDw
Вот сценарий:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteInEditMode]
public class HintScript : MonoBehaviour
{
LineRenderer line;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
line = GetComponent<LineRenderer>();
line.positionCount = transform.childCount;
for (int i = 0; i<transform.childCount; i++)
{
line.SetPosition(i, transform.GetChild(i).position);
}
}
// This is called from onClick of the Button
public void Hint()
{
FindObjectOfType<AdMobManager>().Hint = true;
FindObjectOfType<AdMobManager>().showInterstitial();
}
}