示例#1
0
        public static CompositeAnimation CreateCompositeAnimation()
        {
            string path = EditorUtility.SaveFilePanel(
                "New Composite Animation",
                LastSaveFolder,
                "Untitled",
                "asset"
                );

            if (!string.IsNullOrEmpty(path))
            {
                path = GetRelativePath(path, Application.dataPath);

                CompositeAnimation animation      = ScriptableObject.CreateInstance <CompositeAnimation>();
                AudioAnimation     audioAnimation = ScriptableObject.CreateInstance <AudioAnimation>();

                audioAnimation.Elements        = new AudioAnimationElement[0];
                audioAnimation.FrameCount      = 30;
                audioAnimation.FramesPerSecond = 12;

                animation.AudioAnimation = audioAnimation;

                var animationPath = path.Replace(".asset", "_comp.asset");
                AssetDatabase.CreateAsset(animation, animationPath);

                var audioAnimationPath = path.Replace(".asset", "_audio.asset");
                AssetDatabase.CreateAsset(audioAnimation, audioAnimationPath);

                AssetDatabase.SaveAssets();

                return(AssetDatabase.LoadAssetAtPath(animationPath, typeof(CompositeAnimation)) as CompositeAnimation);
            }

            return(null);
        }
        private void toolStripButtonKeyFrameCopy_Click(object sender, EventArgs e)
        {
            CompositeAnimation anim = SelectedCompositeAnimation;

            CompositeKeyFrameClipBoard = new CompositeKeyFrame();
            SelectedCompositeKeyFrame.CopyValuesTo(CompositeKeyFrameClipBoard, anim);
            toolStripButtonKeyFramePaste.Enabled = true;
        }
        private void toolStripButtonAddAnimation_Click(object sender, EventArgs e)
        {
            CompositeAnimation newAnim = new CompositeAnimation(CompositeEntity);

            newAnim.Name = GetNewAnimationName("Animation ");
            CompositeEntity.Animations.Add(newAnim);
            listViewAnimations.Items.Add(newAnim.Name);
        }
 private void CreateCompositeAnimation(TimeSpan timeSpan)
 {
     _animationOne       = new FakeTransformAnimation(new LinearInterpolator(), timeSpan);
     _animationTwo       = new FakeTransformAnimation(new LinearInterpolator(), timeSpan);
     _compositeAnimation = new CompositeAnimation(new List <Animation> {
         _animationOne, _animationTwo
     });
 }
示例#5
0
 public void DrawKeyFrame(CompositeKeyFrame keyFrame)
 {
     if (keyFrame != null)
     {
         CompositeAnimation anim = keyFrame.Parent;
         anim.ResetToKeyFrame(ParentEditor.tableKeyFrames.SelectedIndicies[0]);
         CompositeEntity.Update(1 / 60f);
         CompositeEntity.Draw(1 / 60f);
     }
 }
 private void toolStripButtonDuplicateAnim_Click(object sender, EventArgs e)
 {
     if (listViewAnimations.SelectedIndices.Count > 0)
     {
         int selectedAnim             = listViewAnimations.SelectedIndices[0];
         CompositeAnimation duplicate = new CompositeAnimation();
         this.SelectedCompositeAnimation.CopyValuesTo(duplicate, this.SelectedCompositeAnimation.Parent);
         duplicate.Name = GetNewAnimationName(duplicate.Name + " ");
         CompositeEntity.Animations.Add(duplicate);
         listViewAnimations.Items.Add(duplicate.Name);
     }
 }
        private IAnimation CreateCompositeAnimation(XElement animationElem)
        {
            IAnimation[] animations =
                animationElem.Elements().Select(elem => CreateAnimation(elem)).ToArray <IAnimation>();
            CompositeAnimation animation = new CompositeAnimation(animations);
            XAttribute         loopAttr  = animationElem.Attribute("Loop");

            if (loopAttr != null)
            {
                animation.Loop = ParseBool(loopAttr.Value);
            }
            return(animation);
        }
        private void toolStripButtonDeleteKeyFrame_Click(object sender, EventArgs e)
        {
            CompositeAnimation anim = SelectedCompositeAnimation;

            anim.KeyFrames.Remove(SelectedCompositeKeyFrame);
            anim.Reset();
            RefreshListKeyFrames();
            // update selection event when there are no items left, XPTable hack fix
            if (this.SelectedCompositeAnimation.KeyFrames.Count == 0)
            {
                tableKeyFrames_SelectionChanged(this, null);
            }
        }
    internal void OpenWorld()
    {
        World.IsOpen = true;

        var materialAnimation = Animation.Create(UpdateMaterialAnimation, Easings.Functions.Linear, 0.6f);
        var callBack          = AnimationWithCallback.Create(materialAnimation, () =>
        {
            DisableChildren();
        });

        var fullAnimation = new CompositeAnimation(callBack);

        AnimationQueue.Enqueue(fullAnimation);
    }
        private void toolStripButtonLevelDownBoneTransform_Click(object sender, EventArgs e)
        {
            CompositeAnimation     anim          = SelectedCompositeAnimation;
            CompositeKeyFrame      selectedFrame = SelectedCompositeKeyFrame;
            CompositeBoneTransform boneTransform = SelectedCompositeBoneTransform;
            int index = tableBoneTransforms.SelectedIndicies[0];

            if (index < selectedFrame.BoneTransforms.Count - 1)
            {
                selectedFrame.BoneTransforms.RemoveAt(index);
                selectedFrame.BoneTransforms.Insert(index + 1, boneTransform);
                _lastSelectedBone = boneTransform.BoneReference;
                RefreshTableCompositeBoneTransforms();
            }
        }
        private void toolStripButtonKeyFramePaste_Click(object sender, EventArgs e)
        {
            CompositeAnimation anim = SelectedCompositeAnimation;
            int insertIndex         = -1;

            int[] selectedIndicies = tableKeyFrames.SelectedIndicies;
            if (anim.KeyFrames.Count > 0 && selectedIndicies.Length > 0)
            {
                insertIndex = selectedIndicies[0];
            }
            CompositeKeyFrame newInstance = new CompositeKeyFrame();

            CompositeKeyFrameClipBoard.CopyValuesTo(newInstance, anim);
            anim.KeyFrames.Insert(insertIndex + 1, newInstance);
            RefreshListKeyFrames();
        }
        private void toolStripButtonAddKeyFrame_Click(object sender, EventArgs e)
        {
            CompositeAnimation anim     = SelectedCompositeAnimation;
            CompositeKeyFrame  newFrame = new CompositeKeyFrame(anim);

            if (SelectedCompositeKeyFrame != null)
            {
                SelectedCompositeKeyFrame.CopyValuesTo(newFrame, SelectedCompositeKeyFrame.Parent);
            }
            else
            {
                newFrame.GenerateDefaultBoneTransformsList();
            }
            anim.KeyFrames.Add(newFrame);
            RefreshListKeyFrames();
        }
        private void RefreshListKeyFrames()
        {
            tableKeyFrames.TableModel.Rows.Clear();
            CompositeAnimation selectedAnim = SelectedCompositeAnimation;

            foreach (CompositeKeyFrame keyFrame in selectedAnim.KeyFrames)
            {
                Cell[] cells = new Cell[2];
                cells[0] = new Cell(keyFrame.Name);
                cells[1] = new Cell((object)keyFrame.Duration);
                Row newRow = new Row(cells);
                tableKeyFrames.TableModel.Rows.Add(newRow);
            }
            tableBoneTransforms.TableModel.Selections.Clear();
            tableKeyFrames.TableModel.Selections.AddCell(0, 1);
            this.UpdatePreview = true;
        }
示例#14
0
 /// <summary>
 /// Hides all the elements of the fishing state.
 /// </summary>
 /// <param name="time">The elapsed time, in seconds, since the last update.</param>
 public void UpdateHide(float time)
 {
     if (_hideAnimation == null)
     {
         _hideAnimation = new CompositeAnimation(
             new ColorAnimation(_lure, Color.TransparentWhite, 1f, InterpolateColor),
             new ColorAnimation(_rod, Color.TransparentWhite, 1f, InterpolateColor),
             new ColorAnimation(_line, Color.TransparentWhite, 1f, InterpolateColor));
     }
     else
     {
         if (!_hideAnimation.Update(time))
         {
             _hideAnimation = null;
         }
     }
 }