1234567891011121314151617181920212223242526272829303132 |
- using System;
- using UnityEngine;
- using Random = UnityEngine.Random;
- namespace Comp
- {
- public class AudienceActionComp : MonoBehaviour
- {
- private Animator _animator;
- private const float MinY = -0.9f;
- private void Start()
- {
- _animator = GetComponent<Animator>();
- InvokeRepeating("Cheer", Random.Range(3f, 5f), Random.Range(3f, 5f));
- }
- private void Cheer()
- {
- _animator.ResetTrigger("cheer");
- _animator.SetTrigger("cheer");
- }
- private void FixedUpdate()
- {
- var position = transform.position;
- position = new Vector3(position.x, MinY, position.z);
- transform.position = position;
- }
- }
- }
|