public void Parse(string name, out Dictionary<int, Dictionary<int, AnimatorData>> kvDic)
		{
			LoadFile(name);

			kvDic = new Dictionary<int, Dictionary<int, AnimatorData>>();
			while(!EndOfRow)
			{
				int col = 0;
				AnimatorData data = new AnimatorData();
				data.Kid = ReadInt(col++);
				data.Name = ReadString(col++);
				data.NameHash = Animator.StringToHash(data.Name);
				data.IsLoop = ReadBool(col++);
				data.Priority = ReadEnum<AnimatorPriorityEnum>(col++);
				data.NormalTime = ReadFloat(col++);
                data.ParamDic = ReadDictionary<AnimatorParamKey, string>(col++);

				if (!kvDic.ContainsKey(data.Kid))
				{
					kvDic.Add(data.Kid, new Dictionary<int, AnimatorData>());
				}
				kvDic[data.Kid].Add(data.NameHash, data);

				NextLine();
			}
		}
Beispiel #2
0
    	protected virtual void Update () 
    	{
    		if (Game.Instance.IsPause) { return; }

    		AnimatorStateInfo currentStateInfo = animator.GetCurrentAnimatorStateInfo(0);
    		if (currentNameHash != currentStateInfo.fullPathHash)
    		{
    			currentNameHash = currentStateInfo.fullPathHash;
    			currentAnimatorData = AnimatorDataDic[currentNameHash];
    			transitionEnds = true;
    		}

    		if (transitionEnds)
    		{
                if(CallbackAnimatorStarts != null)
                {
                    CallbackAnimatorStarts();
                    CallbackAnimatorStarts = null;
                }
    			if (CallbackAnimatorEffect != null && currentStateInfo.normalizedTime >= currentAnimatorData.NormalTime)
    			{
    				CallbackAnimatorEffect(currentAnimatorData.ParamDic);
    				CallbackAnimatorEffect = null;
    			}
    			if (CallbackAnimatorEnds != null && currentStateInfo.normalizedTime >= 0.9f)
    			{
    				CallbackAnimatorEnds();
    				CallbackAnimatorEnds = null;
    			}
    		}

    		if (CallbackUpdate != null)
    		{
    			CallbackUpdate();
    		}
    	}
Beispiel #3
0
 	protected virtual void Start ()
 	{
 		currentNameHash = AnimatorDataManager.Instance.IdleHash;
 		currentAnimatorData = AnimatorDataDic[currentNameHash];
 	}