Hi everybody !
First i’m french guy and my english is not perfect, sorry for mistakes
I’m a begginer on Unity and i try to understand how programming. Currently, i try to make a Clicker Game for fun
but i have a problem : For my Clicker Game i don’t want add value on mouse click but when you drag the mouse on a sprite. Now my script is like that :
using UnityEngine;
using System.Collections;
public class Click : MonoBehaviour
{
public UnityEngine.UI.Text GpC;
public UnityEngine.UI.Text GoldDisplay;
public float Gold = 0.00f;
public int GoldPerClick = 1;
public var drag: float;
void Update ()
{
GoldDisplay.text = “Gold : " + Gold.ToString(“F0”);
GpC.text = GoldPerClick + " Gold / Click”;
}
public void MouseDrag ()
{
Gold += GoldPerClick ;
}
}
I have others scripts for buy Gold per Sec and Gold buy Click but i think it’s not necessary for my problem
After i add on a sprite a component event trigger/drag/ and i add my script.
It’s work (yes ! ) but problem is my gold per sec is 1 but when i drag on my sprite, Unity add with the speed of the mouse so you add 50-100 gold each sec.
I want (in begin of game) add 1 gold each sec whatever your move speed with mouse
I try to understand how WaitForSecond and StartCoroutines works but i don’t understand, or maybe another option more simpliest probably exist
Thanks you in advance everybody