public string GetAnimation(string type) { string code = GameDataActionKeys.idle; if (items == null) { code = GameDataActionKeys.idle; } else if (items.ContainsKey(type)) { GamePlayerAnimationDataItem animationItem = items.Get <GamePlayerAnimationDataItem>(type); if (animationItem.last_update + 5 < Time.time) { animationItem.last_update = Time.time; code = GetDataAnimation(type); } else { code = animationItem.code; } } else { //Debug.LogWarning("GetAnimation:WARNING:" + // " aniType not found" + " type:" + type + " uid:" + // gamePlayerController.uniqueId); } return(code); }
// LOADING ANIMATION DATA public void LoadGamePlayerAnimationData() { if (items == null) { items = new Dictionary <string, GamePlayerAnimationDataItem>(); } else { items.Clear(); } foreach (GameDataAnimation item in gamePlayerController.gameCharacter.data.animations) { GamePlayerAnimationDataItem itemData = new GamePlayerAnimationDataItem(); itemData.code = GetDataAnimation(item.type); itemData.type = item.type; itemData.last_update = Time.time; itemData.layer = item.layer; itemData.play_type = item.play_type; items.Set(item.type, itemData); } }