-
Notifications
You must be signed in to change notification settings - Fork 0
/
ButtonScript.cs
42 lines (34 loc) · 1.02 KB
/
ButtonScript.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ButtonScript : MonoBehaviour
{
public bool goFast;
public GameObject Player;
public GameObject Campfire;
public Animator CampfireAnimator;
public Animator PlayerAnimator;
public Text GoFastToggleText;
public void GoFast()
{
PlayerAnimator = Player.GetComponent<Animator>();
CampfireAnimator = Campfire.GetComponent<Animator>();
if (goFast == false)
{
Player.GetComponent<PlayerController>().moveSpeed = 10f;
PlayerAnimator.speed = 2f;
CampfireAnimator.speed = 2f;
GoFastToggleText.text = "2x Speed";
goFast = true;
}
else
{
Player.GetComponent<PlayerController>().moveSpeed = 5f;
PlayerAnimator.speed = 1f;
CampfireAnimator.speed = 1f;
GoFastToggleText.text = "1x Speed";
goFast = false;
}
}
}