Noticias

¡RECUERDA QUE SI ERES UN NUEVO USUARIO, DEBES PRESENTARTE PARA PODER PUBLICAR MENSAJES! | TENEMOS CANAL OFICIAL DE TELEGRAM: t.me/unity3dspain

AYUDA TIEMPO EN C#

Iniciado por neiro, Julio 16, 2015, 03:19:26 PM

Tema anterior - Siguiente tema
Hola a todos, verán tengo un problema y es que quiero hacer un script en c# que consiste en que al hacer click con el botón del ratón básicamente se active un contador en el que la puntuación aumente por ejemplo 100 por segundo.
Se que puede ser muy sencillo pero no me sale.
 
Ej: Click + 100 + 100 ...
 
 
Gracias

Mira esto no consiste en decir no me sale y esperar que alguien te postee un script, sube lo que has hecho y vemos como se puede arreglar...

A ver si puedo colaborar con algo

public float Score;
bool ActCont = false;
float Cont = 0;
void update(){
if(input.getkeydown(keycode.mouse0)){
 
ActCont = !ActCont;
}
if(ActCont == true){
Cont+=0.5f*Time.deltatime;
 
}
if(Cont >= 1){
 
Score = Score+100;
Cont = 0;
}
 
}
 

Multiplica 100 por Time.Deltatime. Hazlo directamente sobre score."Incrementar score en 100 por segundo"Score += 100f * Time.Deltatime; 
If you add or subtract to a value every frame chances are you should multiply with Time.deltaTime. When you multiply with Time.deltaTime you essentially express: I want to move this object 10 meters per second instead of 10 meters per frame.[/quote]http://docs.unity3d.com/ScriptReference/Time-deltaTime.html" rel="external nofollow">http://docs.unity3d.com/ScriptReference/Time-deltaTime.html 


Etiquetas: