예제 #1
0
        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;
            }
        }
예제 #2
0
 public void AnimateAction(AnimationDNA animationDna, BaseAction animationAction)
 {
     _animationDNA          = animationDna;
     CurrentAnimationAction = animationAction;
     _stopOnFinalFrame      = animationAction.StopOnLastFrame;
     _playing                = true;
     _currentFrameNumber     = 1; // starting on frame 1 makes the animation more snappy
     _totalAnimTimeInSeconds = 2f;
 }