コード例 #1
0
 void Update()
 {
     if (isPaused || nowPlayingTake == null)
     {
         return;
     }
     CurrentTakePlayTime += Time.deltaTime;
     if (CurrentTakePlayTime >= takeTime)
     {
         nowPlayingTake.stopAudio();
         nowPlayingTake.NotifyEnd();
         if (isLooping)
         {
             Execute(nowPlayingTake);
         }
         else
         {
             nowPlayingTake = null;
         }
     }
     else
     {
         nowPlayingTake.NotifyUpdate();
     }
 }
コード例 #2
0
    public void Execute(AMTake take, bool isFrame = true, float value = 0f /* frame or time */)
    {
        if (nowPlayingTake != null)
        {
            AMTween.Stop();
        }

        take.rebind(rebindOption);

        // delete AMCameraFade
        float startFrame = value;
        float startTime  = value;

        if (!isFrame)
        {
            startFrame *= take.frameRate;                       // convert time to frame
        }
        if (isFrame)
        {
            startTime /= take.frameRate;                        // convert frame to time
        }
        take.executeActions(startFrame);
        elapsedTime    = startTime;
        takeTime       = (float)take.numFrames / (float)take.frameRate;
        nowPlayingTake = take;

        take.unbind(rebindOption);
    }
コード例 #3
0
    public void reloadAnimatorData()
    {
        aData = null;
        loadAnimatorData();
        AMTake take = aData.getCurrentTake();
        // update references for track and key
        bool shouldClose = true;

        foreach (AMTrack _track in take.trackValues)
        {
            if (track == _track)
            {
                track = _track;
                foreach (AMKey _key in track.keys)
                {
                    if (key == _key)
                    {
                        key         = _key;
                        shouldClose = false;
                    }
                }
            }
        }
        if (shouldClose)
        {
            this.Close();
        }
    }
コード例 #4
0
    public void makeTakeNameUnique(AMTake take)
    {
        bool loop  = false;
        int  count = 0;

        do
        {
            if (loop)
            {
                loop = false;
            }
            foreach (AMTake _take in takes)
            {
                if (_take != take && _take.name == take.name)
                {
                    if (count > 0)
                    {
                        take.name = take.name.Substring(0, take.name.Length - 3);
                    }
                    count++;
                    take.name += "(" + count + ")";
                    loop       = true;
                    break;
                }
            }
        } while (loop);
    }
コード例 #5
0
    public void addAndSaveTake(string takeName, string path)
    {
        AMTake a = ScriptableObject.CreateInstance <AMTake>();

        // set defaults
        a.name = takeName;
        makeTakeNameUnique(a);
        a.frameRate          = 30;
        a.numFrames          = 120;
        a.startFrame         = 1;
        a.selectedFrame      = 1;
        a.selectedTrack      = -1;
        a.playbackSpeedIndex = 2;
        //a.lsTracks = new List<AMTrack>();
        //a.dictTracks = new Dictionary<int,AMTrack>();
        a.trackKeys   = new List <int>();
        a.trackValues = new List <AMTrack>();
        takes.Add(a);

#if UNITY_EDITOR
        AssetDatabase.CreateAsset(a, path);
#endif

        selectTake(takes.Count - 1);
    }
コード例 #6
0
 void AnimCompleted(AnimatorData dat, AMTake _take)
 {
     if (repeat && !mStopped)
     {
         Invoke("DoPlay", repeatDelay);
     }
 }
コード例 #7
0
 void Start()
 {
     if (playOnStart)
     {
         Play(playOnStart.name, true, 0f, false);
         playOnStart = null;
     }
 }
コード例 #8
0
 public void Play(string take_name, bool isFrame, float value, bool loop)
 {
     nowPlayingTake = getTake(take_name);
     if (nowPlayingTake)
     {
         isLooping = loop;
         Execute(nowPlayingTake, isFrame, value);
     }
 }
コード例 #9
0
    public void SaveAsset(AnimatorData mb, AMTake take)
    {
        AMTakeSav.AddObjectToAsset(this, take);

        for (int i = 0; i < lsArray.Count; ++i)
        {
            var p = lsArray[i];
            p.SaveAsset(mb, take);
        }
    }
コード例 #10
0
    public void importTake(AMTake take)
    {
        if (takes.Contains(take))
        {
            return;
        }

        takes.Add(take);
        makeTakeNameUnique(take);
        selectTake(takes.Count - 1);
    }
コード例 #11
0
 public int getTakeIndex(AMTake take)
 {
     for (int i = 0; i < takes.Count; i++)
     {
         if (takes[i] == take)
         {
             return(i);
         }
     }
     return(-1);
 }
コード例 #12
0
 public override void SaveAsset(AnimatorData mb, AMTake take)
 {
     base.SaveAsset(mb, take);
     if (parameters != null)
     {
         for (int i = 0; i < parameters.Count; ++i)
         {
             var p = parameters[i];
             AMTakeSav.AddObjectToAsset(p, take);
         }
     }
 }
コード例 #13
0
    /*public bool setShowWarningForLostReferences(bool showWarningForLostReferences) {
     *      if(this.showWarningForLostReferences != showWarningForLostReferences) {
     *              this.showWarningForLostReferences = showWarningForLostReferences;
     *              return true;
     *      }
     *      return false;
     * }*/

    public void deleteAllTakesExcept(AMTake take)
    {
        for (int index = 0; index < takes.Count; index++)
        {
            if (takes[index] == take)
            {
                continue;
            }
            deleteTake(index);
            index--;
        }
    }
コード例 #14
0
 public override void SaveAsset(AnimatorData mb, AMTake take)
 {
     base.SaveAsset(mb, take);
     if (parameters != null)
     {
         for (var ie = parameters.GetEnumerator(); ie.MoveNext();)
         {
             AMEventParameter p = ie.Current;
             AMTakeSav.AddObjectToAsset(p, take);
         }
     }
 }
コード例 #15
0
    /// <summary>
    /// called by AMTake.SaveAsset,
    /// the subclasses will override this to save into the asset
    /// </summary>
#if UNITY_EDITOR
    public virtual void SaveAsset(AnimatorData mb, AMTake take)
    {
        AMTakeSav.AddObjectToAsset(this, take);

        foreach (var key in keys)
        {
            key.SaveAsset(mb, take);
        }
        foreach (var act in cache)
        {
            act.SaveAsset(mb, take);
        }
    }
コード例 #16
0
 public void StopLoop()
 {
     if (nowPlayingTake == null)
     {
         return;
     }
     nowPlayingTake.stopAudio();
     nowPlayingTake.stopAnimations();
     nowPlayingTake = null;
     isLooping      = false;
     isPaused       = false;
     AMTween.Stop();
 }
コード例 #17
0
    public void updateOrientationCache(AMTake curTake, bool restoreRotation = false)
    {
        AMUtil.recordObject(this, "update cache");
        // save rotation
        Quaternion temp = obj.rotation;

        // sort keys
        sortKeys();
        destroyCache();
        cache = new List <AMAction>();
        AMTranslationTrack translationTrack = curTake.getTranslationTrackForTransform(obj);

        for (int i = 0; i < keys.Count; i++)
        {
            // create new action and add it to cache list
            AMOrientationAction a = ScriptableObject.CreateInstance <AMOrientationAction> ();
            a.startFrame = keys[i].frame;
            if (keys.Count > (i + 1))
            {
                a.endFrame = keys[i + 1].frame;
            }
            else
            {
                a.endFrame = -1;
            }
            a.obj = obj;
            // targets
            a.startTarget = (keys[i] as AMOrientationKey).target;
            if (a.endFrame != -1)
            {
                a.endTarget = (keys[i + 1] as AMOrientationKey).target;
            }
            a.easeType   = (keys[i] as AMOrientationKey).easeType;
            a.customEase = new List <float>(keys[i].customEase);
            if (translationTrack != null && !a.isLookFollow())
            {
                a.isSetStartPosition = true;
                a.startPosition      = translationTrack.getPositionAtFrame(a.startFrame);
                a.isSetEndPosition   = true;
                a.endPosition        = translationTrack.getPositionAtFrame(a.endFrame);
            }

            // add to cache
            cache.Add(a);
        }
        // restore rotation
        if (restoreRotation)
        {
            obj.rotation = temp;
        }
    }
コード例 #18
0
 public void deleteTake(int index)
 {
     //if(shouldCheckDependencies) shouldCheckDependencies = false;
     if (playOnStart == takes[index])
     {
         playOnStart = null;
     }
     takes[index].destroy();
     takes.RemoveAt(index);
     if ((currentTake >= index) && (currentTake > 0))
     {
         currentTake--;
     }
 }
コード例 #19
0
    public List <GameObject> getDependencies(AMTake _take = null)
    {
        // if only one take
        if (_take != null)
        {
            return(_take.getDependencies().ToList());
        }

        // if all takes
        List <GameObject> ls = new List <GameObject>();

        foreach (AMTake take in takes)
        {
            ls = ls.Union(take.getDependencies()).ToList();
        }
        return(ls);
    }
コード例 #20
0
 void OnTimeWarpAnimFinish(AnimatorData animDat, AMTake take)
 {
     if (animDat == timeWarp)
     {
         if (take.name == timeWarpStartTake)
         {
             if (!IsInvoking(timeWarpEndFunc))
             {
                 Invoke(timeWarpEndFunc, timeWarpExpireDelay);
             }
         }
         else if (take.name == timeWarpEndTake)
         {
             timeWarp.gameObject.SetActive(false);
             mLastTimeWarpEndTime = Time.fixedTime;
         }
     }
 }
コード例 #21
0
ファイル: EnemyShelly.cs プロジェクト: BurritoGaiden/megagirl
    void OnShellAnimDone(AnimatorData anim, AMTake take)
    {
        if (take.name == "close")
        {
            shellAnimDat.Play("normal");
            Invoke(openFunc, openDelay);
        }
        else if (take.name == "open")
        {
            mIsOpen = true;
            SetClosedState(false);

            mLastShotTime = Time.time;
            mCurShotCount = 0;

            InvokeRepeating(orientFunc, 0, orientAcquireDelay);
        }
    }
コード例 #22
0
    private void _deleteTake_impl(int index)
    {
#if UNITY_EDITOR
        if (EditorApplication.isPlaying)
        {
            takes[index].destroy();
            takes.RemoveAt(index);
        }
        else
        {
            AMTake oneTake = takes[index];
            //AMUtil.recordObject(this, "delete take"); //delete take is not undo-able
            takes.RemoveAt(index);
            oneTake.destroy();
        }
#else
        takes[index].destroy();
        takes.RemoveAt(index);
#endif
    }
コード例 #23
0
 void Update()
 {
     if (isPaused || nowPlayingTake == null)
     {
         return;
     }
     elapsedTime += Time.deltaTime;
     if (elapsedTime >= takeTime)
     {
         nowPlayingTake.stopAudio();
         if (isLooping)
         {
             Execute(nowPlayingTake);
         }
         else
         {
             nowPlayingTake = null;
         }
     }
 }
コード例 #24
0
    public void addTake(string takeName)
    {
        AMTake a = ScriptableObject.CreateInstance <AMTake>();

        // set defaults
        a.name = takeName;
        makeTakeNameUnique(a);
        a.frameRate          = 30;
        a.numFrames          = 120;
        a.startFrame         = 1;
        a.selectedFrame      = 1;
        a.selectedTrack      = -1;
        a.playbackSpeedIndex = 2;
        //a.lsTracks = new List<AMTrack>();
        //a.dictTracks = new Dictionary<int,AMTrack>();
        a.trackKeys   = new List <int>();
        a.trackValues = new List <AMTrack>();
        takes.Add(a);
        selectTake(takes.Count - 1);
    }
コード例 #25
0
    public void deleteTake(int index)
    {
        //if(shouldCheckDependencies) shouldCheckDependencies = false;

        // event
        if (currentTake == index)
        {
            var oldTake = safeGetTake(currentTake);
            var newTake = currentTake == 0 ? safeGetTake(1) : safeGetTake(currentTake - 1);
            evtBefChangeCurTake(oldTake, newTake);
        }

        if (playOnStart == takes[index])
        {
            playOnStart = null;
        }
        _deleteTake_impl(index);
        if ((currentTake >= index) && (currentTake > 0))
        {
            currentTake--;
        }
    }
コード例 #26
0
 void Update()
 {
     if(isPaused || nowPlayingTake == null) return;
     elapsedTime += Time.deltaTime;
     if(elapsedTime >= takeTime) {
         nowPlayingTake.stopAudio();
         if(isLooping) Execute(nowPlayingTake);
         else nowPlayingTake = null;
     }
 }
コード例 #27
0
 public int getTakeIndex(AMTake take)
 {
     for(int i=0;i<takes.Count;i++) {
         if(takes[i] == take) return i;
     }
     return -1;
 }
コード例 #28
0
 /*public bool setShowWarningForLostReferences(bool showWarningForLostReferences) {
     if(this.showWarningForLostReferences != showWarningForLostReferences) {
         this.showWarningForLostReferences = showWarningForLostReferences;
         return true;
     }
     return false;
 }*/
 public void deleteAllTakesExcept(AMTake take)
 {
     for(int index=0;index<takes.Count;index++) {
         if(takes[index] == take) continue;
         deleteTake(index);
         index--;
     }
 }
コード例 #29
0
 void OnTakeSequenceDone(AMTake aTake)
 {
     if(takeCompleteCallback != null)
         takeCompleteCallback(this, aTake);
 }
コード例 #30
0
    public List<GameObject> getDependencies(AMTake _take = null)
    {
        // if only one take
        if(_take != null) return _take.getDependencies().ToList();

        // if all takes
        List<GameObject> ls = new List<GameObject>();
        foreach(AMTake take in takes) {
            ls = ls.Union(take.getDependencies()).ToList();
        }
        return ls;
    }
コード例 #31
0
 public void Execute(AMTake take, bool isFrame = true, float value = 0f /* frame or time */)
 {
     if(nowPlayingTake != null)
         AMTween.Stop();
     // delete AMCameraFade
     float startFrame = value;
     float startTime = value;
     if(!isFrame) startFrame *= take.frameRate;	// convert time to frame
     if(isFrame) startTime /= take.frameRate;	// convert frame to time
     take.executeActions(startFrame);
     elapsedTime = startTime;
     takeTime = (float)take.numFrames/(float)take.frameRate;
     nowPlayingTake = take;
 }
コード例 #32
0
    protected override AMTrack doDuplicate(AMTake newTake)
    {
        AMEventTrack ntrack = newTake.gameObject.AddComponent<AMEventTrack>();
        ntrack.enabled = false;
        ntrack.obj = obj;

        return ntrack;
    }
コード例 #33
0
ファイル: EnemyShelly.cs プロジェクト: PushoN/game-off-2013
    void OnShellAnimDone(AnimatorData anim, AMTake take) {
        if(take.name == "close") {
            shellAnimDat.Play("normal");
            Invoke(openFunc, openDelay);
        }
        else if(take.name == "open") {
            mIsOpen = true;
            stats.isInvul = false;

            mLastShotTime = Time.time;
            mCurShotCount = 0;

            InvokeRepeating(orientFunc, 0, orientAcquireDelay);
        }
    }
コード例 #34
0
    public void updateOrientationCache(AMTake curTake, bool restoreRotation = false)
    {
        // save rotation
        Quaternion temp = obj.rotation;
        // sort keys
        sortKeys();
        for(int i = 0; i < keys.Count; i++) {
            AMOrientationKey key = keys[i] as AMOrientationKey;

            key.version = version;

            if(keys.Count > (i + 1)) key.endFrame = keys[i + 1].frame;
            else key.endFrame = -1;
            key.obj = obj;
            // targets
            if(key.endFrame != -1) key.endTarget = (keys[i + 1] as AMOrientationKey).target;
        }
        // restore rotation
        if(restoreRotation) obj.rotation = temp;
    }
コード例 #35
0
ファイル: AMTimeline.cs プロジェクト: nathanfunk/MateAnimator
 static void setDirtyTracks(AMTake take)
 {
     foreach(AMTrack track in take.trackValues) {
         EditorUtility.SetDirty(track);
     }
 }
コード例 #36
0
 /// <summary>
 /// will write the transformPath
 /// </summary>
 public override void SaveAsset(AnimatorData mb, AMTake take)
 {
     base.SaveAsset(mb, take);
 }
コード例 #37
0
    public void updateOrientationCache(AMTake curTake,bool restoreRotation = false)
    {
        // save rotation
        Quaternion temp = obj.rotation;
        // sort keys
        sortKeys();
        destroyCache();
        cache = new List<AMAction>();
        AMTranslationTrack translationTrack = curTake.getTranslationTrackForTransform(obj);
        for(int i=0;i<keys.Count;i++) {
            // create new action and add it to cache list
            AMOrientationAction a = ScriptableObject.CreateInstance<AMOrientationAction> ();
            a.startFrame = keys[i].frame;
            if(keys.Count>(i+1)) a.endFrame = keys[i+1].frame;
            else a.endFrame = -1;
            a.obj = obj;
            // targets
            a.startTarget = (keys[i] as AMOrientationKey).target;
            if(a.endFrame!=-1) a.endTarget = (keys[i+1] as AMOrientationKey).target;
            a.easeType = (keys[i] as AMOrientationKey).easeType;
            a.customEase = new List<float>(keys[i].customEase);
            if(translationTrack != null && !a.isLookFollow()) {
                a.isSetStartPosition = true;
                a.startPosition = translationTrack.getPositionAtFrame(a.startFrame);
                a.isSetEndPosition = true;
                a.endPosition = translationTrack.getPositionAtFrame(a.endFrame);
            }

            // add to cache
            cache.Add (a);
        }
        // restore rotation
        if(restoreRotation) obj.rotation = temp;
    }
コード例 #38
0
 public void StopLoop()
 {
     if(nowPlayingTake == null) return;
     nowPlayingTake.stopAudio();
     nowPlayingTake.stopAnimations();
     nowPlayingTake = null;
     isLooping = false;
     isPaused = false;
     AMTween.Stop();
 }
コード例 #39
0
 public virtual void SaveAsset(AnimatorData mb, AMTake take)
 {
     AMTakeSav.AddObjectToAsset(this, take);
 }
コード例 #40
0
 public void Play(string take_name, bool isFrame, float value, bool loop)
 {
     nowPlayingTake = getTake(take_name);
     if(nowPlayingTake) {
         isLooping = loop;
         Execute (nowPlayingTake, isFrame, value);
     }
 }
コード例 #41
0
ファイル: AMTrack.cs プロジェクト: nathanfunk/MateAnimator
    public AMTrack duplicate(AMTake newTake)
    {
        AMTrack ntrack = doDuplicate(newTake);
        if(ntrack != null) {
            ntrack.id = id;
            ntrack.parentTake = newTake;
            ntrack.name = name;
        }

        return ntrack;
    }
コード例 #42
0
    /// <summary>
    /// This will only duplicate the tracks and groups
    /// </summary>
    /// <param name="take"></param>
    public List<UnityEngine.Object> duplicateTake(AMTake dupTake)
    {
        List<UnityEngine.Object> ret = new List<Object>();

        AMTake a = AMTake.NewInstance(dataHolder);

        ret.Add(a);

        a.name = dupTake.name;
        makeTakeNameUnique(a);
        a.numLoop = dupTake.numLoop;
        a.loopMode = dupTake.loopMode;
        a.frameRate = dupTake.frameRate;
        a.numFrames = dupTake.numFrames;
        a.startFrame = dupTake.startFrame;
        a.selectedFrame = 1;
        a.selectedTrack = dupTake.selectedTrack;
        a.selectedGroup = dupTake.selectedGroup;
        a.playbackSpeedIndex = 2;
        //a.lsTracks = new List<AMTrack>();
        //a.dictTracks = new Dictionary<int,AMTrack>();

        if(dupTake.rootGroup != null) {
            a.rootGroup = dupTake.rootGroup.duplicate();
        }
        else {
            a.initGroups();
        }

        a.group_count = dupTake.group_count;

        if(dupTake.groupValues != null) {
            a.groupValues = new List<AMGroup>();
            foreach(AMGroup grp in dupTake.groupValues) {
                a.groupValues.Add(grp.duplicate());
            }
        }

        a.track_count = dupTake.track_count;

        if(dupTake.trackValues != null) {
            a.trackValues = new List<AMTrack>();
            foreach(AMTrack track in dupTake.trackValues) {
                AMTrack dupTrack = track.duplicate(a);

                a.trackValues.Add(dupTrack);

                ret.Add(dupTrack);
            }
        }
        a.contextSelection = new List<int>();
        a.ghostSelection = new List<int>();
        a.contextSelectionTracks = new List<int>();

        takes.Add(a);
        selectTake(takes.Count - 1);

        return ret;
    }
コード例 #43
0
ファイル: AMTrack.cs プロジェクト: nathanfunk/MateAnimator
    public void destroy()
    {
        // destroy keys
        if(keys != null) {
            foreach(AMKey key in keys) {
                if(key)
                    key.destroy();
            }

            keys.Clear();
            keys = null;
        }

        parentTake = null;

        // destroy track
        Object.DestroyImmediate(this);
    }
コード例 #44
0
 public void makeTakeNameUnique(AMTake take)
 {
     bool loop = false;
     int count = 0;
     do {
         if(loop) loop = false;
         foreach(AMTake _take in takes) {
             if(_take != take && _take.name == take.name) {
                 if(count>0) take.name = take.name.Substring(0,take.name.Length-3);
                 count++;
                 take.name += "("+count+")";
                 loop = true;
                 break;
             }
         }
     } while (loop);
 }
コード例 #45
0
    protected override AMTrack doDuplicate(AMTake newTake)
    {
        AMAudioTrack ntrack = newTake.gameObject.AddComponent<AMAudioTrack>();
        ntrack.enabled = false;
        ntrack.audioSource = audioSource;

        return ntrack;
    }
コード例 #46
0
 void OnAnimationComplete(AnimatorData anim, AMTake take)
 {
     Release();
 }
コード例 #47
0
 public void deleteTake(int index)
 {
     //if(shouldCheckDependencies) shouldCheckDependencies = false;
     if(playOnStart == takes[index]) playOnStart = null;
     takes[index].destroy();
     takes.RemoveAt(index);
     if((currentTake>=index)&&(currentTake>0)) currentTake--;
 }
コード例 #48
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            AnimatorData mb = target as AnimatorData;

            Dbg.Assert(mb != null, "AnimatorDataEditor.OnInspectorGUI: cannot get target: {0}", target.name);

            EditorGUILayout.HelpBox("If you want to modify the takes list, do it via the Timeline editor", MessageType.Info);

            if (EUtil.Button("Open Timeline Editor", Color.green))
            {
                AMTimeline.ResetWithAnimatorData((AnimatorData)target);
            }

            string playOnStartName = (m_spPlayOnStart.objectReferenceValue != null) ? ((AMTake)m_spPlayOnStart.objectReferenceValue).name : "None";

            EditorGUILayout.LabelField("Play On Start:  " + playOnStartName);

            EUtil.DrawSplitter();

            for (int i = 0; i < m_spTakes.arraySize; ++i)
            {
                var oneTake = m_spTakes.GetArrayElementAtIndex(i);

                GUILayout.BeginHorizontal();
                {
                    if (oneTake != null && oneTake.objectReferenceValue != null)
                    {
                        AMTake takeObj = oneTake.objectReferenceValue as AMTake;
                        EditorGUILayout.LabelField(string.Format("{0}: \"{1} fr, {2} fps\"", takeObj.name, takeObj.numFrames, takeObj.frameRate));
                        if (GUILayout.Button(new GUIContent(ms_inspectTex, "inspect this take's content"), GUILayout.Height(20f), GUILayout.Width(30f)))
                        {
                            Selection.activeObject = takeObj;
                        }
                        //EUtil.PushGUIColor(EditorUtility.IsPersistent(takeObj) ? Color.yellow : Color.green);
                        //if (GUILayout.Button(new GUIContent("S", "save asset to disk"), GUILayout.Width(30f)))
                        //{
                        //    string path = null;
                        //    if (!EditorUtility.IsPersistent(takeObj))
                        //        path = EditorUtility.SaveFilePanelInProject("Save Take", takeObj.name, "asset", "Select asset path");
                        //    else
                        //        path = AssetDatabase.GetAssetPath(takeObj);

                        //    if (!string.IsNullOrEmpty(path))
                        //    {
                        //        takeObj.SaveAsset(mb, path);
                        //        EUtil.ShowNotification("Saved Take at: " + path, 3f);
                        //    }
                        //}
                        //EUtil.PopGUIColor();
                    }
                    else
                    {
                        GUILayout.Label("This slot is null reference");
                    }
                }
                GUILayout.EndHorizontal();
            }

            serializedObject.ApplyModifiedProperties();
        }
コード例 #49
0
    void Play(string take_name, bool isFrame, float value, bool loop)
    {
        AMTake newPlayTake = getTake(take_name);

        if(!newPlayTake) {
            Stop();
            return;
        }

        if(newPlayTake != nowPlayingTake && nowPlayingTake != null) {
            Pause();
        }

        nowPlayingTake = newPlayTake;

        float startTime = value;
        if(isFrame) startTime /= nowPlayingTake.frameRate;

        float startFrame = 0;//isFrame ? value : nowPlayingTake.frameRate * value;

        if(nowPlayingTake.sequence == null)
            nowPlayingTake.BuildSequence(gameObject.name, sequenceKillWhenDone, updateType, startFrame);
        else {
            //TODO: make this more efficient
            if(value == 0.0f)
                nowPlayingTake.previewFrame(0, false, true);
            /*if(startTime > nowPlayingTake.sequence.duration)
                startFrame = (startTime / nowPlayingTake.sequence.duration) * nowPlayingTake.frameRate;

            nowPlayingTake.previewFrame(startFrame, false, true);*/
        }

        if(nowPlayingTake.sequence != null) {
            if(loop) {
                nowPlayingTake.sequence.loops = -1;
            }
            else {
                nowPlayingTake.sequence.loops = nowPlayingTake.numLoop;
            }

            nowPlayingTake.sequence.GoTo(startTime);
            nowPlayingTake.sequence.Play();
            nowPlayingTake.sequence.timeScale = mAnimScale;
        }

        //isLooping = loop;

        //Execute(nowPlayingTake, isFrame, value);
    }
コード例 #50
0
ファイル: AMTrack.cs プロジェクト: nathanfunk/MateAnimator
 protected virtual AMTrack doDuplicate(AMTake newTake)
 {
     return null;
 }
コード例 #51
0
 void OnLauncherAnimComplete(AnimatorData animDat, AMTake take) {
     mTarget = null;
     InvokeRepeating("DoActiveCheck", launcherFireDelay, activateCheckDelay);
 }
コード例 #52
0
 void Start()
 {
     if(playOnStart) {
         Play (playOnStart.name,true,0f,false);
         playOnStart = null;
     }
 }
コード例 #53
0
    public void Stop()
    {
        if(nowPlayingTake == null) return;
        nowPlayingTake.stopAudio();
        nowPlayingTake.stopAnimations();

        if(nowPlayingTake.sequence != null) {
            nowPlayingTake.sequence.Pause();
            nowPlayingTake.sequence.GoTo(0);
        }

        nowPlayingTake = null;
    }
コード例 #54
0
    protected override AMTrack doDuplicate(AMTake newTake)
    {
        AMGOSetActiveTrack ntrack = newTake.gameObject.AddComponent<AMGOSetActiveTrack>();
        ntrack.enabled = false;
        ntrack.obj = obj;
        ntrack.startActive = startActive;

        return ntrack;
    }
コード例 #55
0
 void OnLauncherAnimComplete(AnimatorData animDat, AMTake take)
 {
     mTarget = null;
     InvokeRepeating("DoActiveCheck", launcherFireDelay, activateCheckDelay);
 }
コード例 #56
0
    protected override AMTrack doDuplicate(AMTake newTake)
    {
        AMPropertyTrack ntrack = newTake.gameObject.AddComponent<AMPropertyTrack>();
        ntrack.enabled = false;
        ntrack.valueType = valueType;
        ntrack.obj = obj;
        ntrack.component = component;
        ntrack.propertyName = propertyName;
        ntrack.fieldName = fieldName;
        ntrack.methodName = methodName;

        if(methodParameterTypes != null) {
            ntrack.methodParameterTypes = new string[methodParameterTypes.Length];
            Array.Copy(methodParameterTypes, ntrack.methodParameterTypes, methodParameterTypes.Length);
        }

        return ntrack;
    }
コード例 #57
0
 void OnAnimationEnd(AnimatorData dat, AMTake take) {
     StartGame();
 }
コード例 #58
0
    protected override AMTrack doDuplicate(AMTake newTake)
    {
        AMTranslationTrack ntrack = newTake.gameObject.AddComponent<AMTranslationTrack>();
        ntrack.enabled = false;
        ntrack._obj = _obj;
        ntrack._isLocal = _isLocal;
        ntrack.cachedInitialPosition = cachedInitialPosition;

        return ntrack;
    }
コード例 #59
0
ファイル: AMTimeline.cs プロジェクト: nathanfunk/MateAnimator
    public static MonoBehaviour[] getKeysAndTracks(AMTake take)
    {
        List<MonoBehaviour> behaviours = new List<MonoBehaviour>();

        if(take.trackValues != null) {
            foreach(AMTrack track in take.trackValues) {
                if(track.keys != null) {
                    foreach(AMKey key in track.keys)
                        behaviours.Add(key);
                }

                behaviours.Add(track);
            }
        }

        return behaviours.ToArray();
    }
コード例 #60
0
 void AnimCompleted(AnimatorData dat, AMTake _take) {
     if(repeat && !mStopped)
         Invoke("DoPlay", repeatDelay);
 }