Hello,
I need and example similar to the Roll-a-ball tutorial (https://unity3d.com/learn/tutorials/projects/roll-ball-tutorial) on your website but when the player hits the balls, the game stops and as feedback an animation will be shown for instance points go up (shown to player). Then the player continue the game.
I was wondering if you guys can help me with this?
Thank you
Here is a rough script that slows down time when the player hits an object and then calls a coroutine that plays an animation for 1 second and then reverts time back to normal.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class SlowTimeScript : MonoBehaviour {
public GameObject animationImage;
void OnTriggerEnter(Collider coll)
{
if (coll.tag == "Player")
{
Time.timeScale = 0.2f;
StartCoroutine(WaitForAnimation());
}
}
IEnumerator WaitForAnimation()
{
animationImage.GetComponent<Animator>().SetBool("Animate", true);
yield return new WaitForSeconds(1f);
animationImage.GetComponent<Animator>().SetBool("Animate", false);
Time.timeScale = 1f;
}
}