Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Test : MonoBehaviour
  6. {
  7.     [SerializeField] private AnimationCurve spawnCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
  8.     private int hour;
  9.     private float spawnMultiplier;
  10.  
  11.     private void Start()
  12.     {
  13.         InvokeRepeating(nameof(UpdateTime), 1f, 1f);
  14.     }
  15.  
  16.     private void UpdateTime()
  17.     {
  18.         hour = (int)Mathf.Repeat(hour + 1, 24);
  19.         spawnMultiplier = spawnCurve.Evaluate(hour / 24f);
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement