예제 #1
0
        public static void UpdateDNAForAction(CharacterDNA characterDNA, AnimationDNA animationDNA, BaseAction actionAnimation, string newDirection)
        {
            // Uses the characterDNA to fetch the proper animations and update the animationDNA.
            foreach (var blockType in DNABlockType.TypeList)
            {
                var characterDNABlock = characterDNA.DNABlocks[blockType];

                if (characterDNABlock.Enabled)
                {
                    animationDNA.DNABlocks[blockType] = GetAnimation(characterDNABlock.ModelKey, actionAnimation, newDirection);
                    var 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 AnimateAction(AnimationDNA animationDNA, BaseAction animationAction)
 {
     _animationDNA           = animationDNA;
     _currentAnimationAction = animationAction;
     _stopOnFinalFrame       = animationAction.GetStopOnLastFrame();
     _playing                = true;
     _currentFrameNumber     = 0;
     _totalAnimTimeInSeconds = 2f;
 }
예제 #3
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;
 }
        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;
            }
        }