1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using Sirenix.OdinInspector;
- namespace KairoEngine
- {
- public enum StillPositions
- {
- Idle1,
- Idle2,
- IdleRifle1,
- IdleRifle2,
- IdleCrouched
- }
-
- public class StillAnimator : MonoBehaviour
- {
- public Animator animator;
- public StillPositions stillPosition;
- private StillPositions previousPosition;
- void Start()
- {
- int position = System.Convert.ToInt32(stillPosition);
- //Debug.Log($"{gameObject.name} animator position: {position.ToString()}");
- animator.SetInteger("Position", position);
- previousPosition = stillPosition;
- }
- void Update()
- {
- if(stillPosition != previousPosition)
- {
- previousPosition = stillPosition;
- int position = System.Convert.ToInt32(stillPosition);
- animator.SetInteger("Position", position);
- //Debug.Log($"{gameObject.name} animator position: {position.ToString()}");
- }
- }
- }
- }
|