summaryrefslogtreecommitdiff
path: root/ActiveRagdoll/Assets/TABG/Scripts/Data/AnimationHandler.cs
blob: 48550e5e86ba526a9615ebcafa71f11f02c42fdd (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Rigging.Data
{

    using System;

    [Serializable]
    public class IntString
    {
        public int theInt;

        public string theString;
    }

    public class AnimationHandler : RiggingDataBase
    {
        /*
        0 Stand
        1 Run
        2 Sprint 
        3 Jump
         */
        public IntString[] animationStates;

        public int animationState; // 当前角色的动作

        public void ChangeAnimationState(byte newState)
        {
            animationState = newState;
        }
    }

    [Serializable]
    public class AnimationParam<T>
    {
        private Player player;

        [SerializeField]
        public T[] values;

        public AnimationParam()
        {
        }

        public void SetPlayer(Player p)
        {
            player = p;
        }

        public T CurrentValue()
        {
            return values[Mathf.Clamp(player.status.animation.animationState, 0, values.Length - 1)];
        }

        public T current
        {
            get
            {
                return values[Mathf.Clamp(player.status.animation.animationState, 0, values.Length - 1)];
            }
        }

    }

}