Esempio n. 1
0
    public void AddNewAnimation()
    {
        var anim = new Animations.EditAnimation();

        anim.Reset();
        AddAnimation(anim);
    }
Esempio n. 2
0
    public bool LoadFromJson(DiceType diceType)
    {
        string path = GetJsonFilePathname(diceType);
        bool   ret  = File.Exists(path);

        if (ret)
        {
            string jsonText = File.ReadAllText(path);
            animationSet = JsonUtility.FromJson <Animations.EditAnimationSet>(jsonText);
            animationSet.FixupLedIndices();
            timeline.SetAnimations(diceType, animationSet);
            Debug.Log($"Loaded {diceType} animations from {path}");
        }
        else
        {
            animationSet            = new Animations.EditAnimationSet();
            animationSet.animations = new List <Animations.EditAnimation>();
            var anim = new Animations.EditAnimation();
            anim.Reset();
            animationSet.animations.Add(anim);
            timeline.SetAnimations(diceType, animationSet);
            Debug.Log($"Loaded empty {diceType} animation");
        }
        return(ret);
    }