-
Notifications
You must be signed in to change notification settings - Fork 461
Expand file tree
/
Copy pathAnimationUserInput.cs
More file actions
42 lines (38 loc) · 1.13 KB
/
AnimationUserInput.cs
File metadata and controls
42 lines (38 loc) · 1.13 KB
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.Generic;
using System.Linq;
using UnityEngine;
using Unity.Netcode;
namespace Tests.Manual.NetworkAnimatorTests
{
public class AnimationUserInput : NetworkBehaviour
{
private List<AnimatedCubeController> m_Controllers = new List<AnimatedCubeController>();
// Start is called before the first frame update
private void Start()
{
m_Controllers = GetComponentsInChildren<AnimatedCubeController>().ToList();
}
// Update is called once per frame
private void LateUpdate()
{
if (!IsSpawned || !IsOwner && !IsServer)
{
return;
}
if (Input.GetKeyDown(KeyCode.C))
{
foreach (var controller in m_Controllers)
{
controller.ToggleRotateAnimation();
}
}
if (Input.GetKeyDown(KeyCode.Space))
{
foreach (var controller in m_Controllers)
{
controller.PlayPulseAnimation();
}
}
}
}
}