Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.46 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class TimeScript : MonoBehaviour
  6. {
  7.     public float TimeToAction = 3f;
  8.     void Update()
  9.     {
  10.         if (TimeToAction <= 0)
  11.         {
  12.             DoAction();
  13.         }
  14.  
  15.         else
  16.         {
  17.             TimeToAction -= Time.deltaTime;
  18.         }
  19.     }
  20.     void DoAction()
  21.     {
  22.         Debug.Log("You did the action!");
  23.         TimeToAction = 3f;
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement