Advertisement
Guest User

Untitled

a guest
Jun 28th, 2023
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.Splines;
  3.  
  4. public class Train : MonoBehaviour
  5. {
  6.     SplineAnimate splineAnimator;
  7.     public float speedIncrement = 0.005f;
  8.  
  9.     void Awake()
  10.     {
  11.         splineAnimator = GetComponent<SplineAnimate>();
  12.     }
  13.  
  14.     void Update()
  15.     {
  16.         if (Input.GetKey(KeyCode.Space))
  17.         {
  18.             splineAnimator.MaxSpeed += speedIncrement;
  19.         }
  20.         else
  21.         {
  22.             splineAnimator.MaxSpeed = 1f;
  23.  
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement