public static void UpdateDNAForAction(CharacterDNA characterDNA, AnimationDNA animationDNA, BaseAction actionAnimation, string newDirection) { foreach (var blockType in DNABlockType.TypeList) { CharacterDNABlock characterDnaBlock = characterDNA.DNABlocks[blockType]; if (characterDnaBlock.Enabled) { animationDNA.DNABlocks[blockType] = GetAnimation(characterDnaBlock.ModelKey, actionAnimation, newDirection); AnimationDNABlock animationDnaBlock = animationDNA.DNABlocks[blockType]; if (animationDnaBlock == null) { Debug.Log($"Block not found: {blockType}"); continue; } animationDnaBlock.UpdateSpriteColor(characterDnaBlock.ItemColor); animationDnaBlock.Enabled = true; } else { // Disable the animation slot if the character slot isnt enabled animationDNA.DNABlocks[blockType].Enabled = false; } characterDnaBlock.IsDirty = false; } }
public void UpdateDNAForAction(CharacterDNA characterDNA, AnimationDNA animationDNA, BaseAction actionAnimation, string newDirection) { /* * Uses the characterDNA to fetch the proper animations and update the animationDNA. */ foreach (string blockType in DNABlockType.GetTypeList()) { CharacterDNABlock characterDNABlock = characterDNA.DNABlocks[blockType]; if (characterDNABlock.Enabled) { animationDNA.DNABlocks[blockType] = getAnimation(characterDNABlock.ModelKey, actionAnimation, newDirection); AnimationDNABlock animationDNABlock = animationDNA.DNABlocks[blockType]; animationDNABlock.UpdateSpriteColor(characterDNABlock.ItemColor); animationDNABlock.Enabled = true; } else { // Disable the animation slot if the character slot isnt enabled animationDNA.DNABlocks[blockType].Enabled = false; } characterDNABlock.IsDirty = false; } }