private void WaitForCheckAction(float time, StateDo _do)
 {
     if (time > 0)
     {
         //等待动画播放完执行下一步判断
         TimeTool.SetWaitTime(time, gameObject, () =>
         {
             if (animation_index >= _do.ActionList.Length)
             {
                 GetLevelManager().SetLevelState(LevelManager.LevelStateType.Common);
                 CheckAction(_do.NextDo, jumpnum);
             }
             else
             {
                 DoAnimationNext(_do);
             }
         });
     }
     else
     {
         if (animation_index >= _do.ActionList.Length)
         {
             CheckAction(_do.NextDo, jumpnum);
         }
         else
         {
             DoAnimationNext(_do);
         }
     }
 }
Beispiel #2
0
 void DoNextStory(StateDo _do)
 {
     if (_do.talks.Length - 1 > nowindex)
     {
         EventTriggerListener.Get(Mask).onClick = null;
         nowindex++;
         GameObject hideText = Instantiate(WordsText.gameObject, WordsText.transform.parent);
         WordsText.text = "";
         LeanTween.moveLocalY(hideText, 200, 0.5f).setOnComplete(() =>
         {
             Destroy(hideText);
             ShowStory();
         });
     }
     else
     {
         GameObject hideText = Instantiate(WordsText.gameObject, WordsText.transform.parent);
         WordsText.text = "";
         LeanTween.moveLocalY(hideText, 200, 0.5f).setOnComplete(() =>
         {
             Destroy(UsingStoryLayer);
             resetState();
             CheckAction(_do.NextDo, jumpnum);
         });
         StopAllCharacterEffect();
         StopHideCharacterEffect();
     }
 }
Beispiel #3
0
    //查找动作列表中对应的动作
    private StateDo GetStateDo(int stateID)
    {
        StateDo common = new StateDo();

        common.StateID = -1;

        //查找对应ID的动作
        foreach (StateDo _s in DoList)
        {
            if (_s.StateID == 0)
            {
                common = _s;
            }
            if (_s.StateID == stateID)
            {
                return(_s);
            }
        }
        //如果找到默认动作,则返回默认动作,否则返回空
        if (common.StateID == 0)
        {
            return(common);
        }
        else
        {
            return(common);
        }
    }
Beispiel #4
0
 void resetState()
 {
     islast          = false;
     nowindex        = 0;
     Usingdo         = new StateDo();
     UsingStoryLayer = null;
 }
    //查找动作列表中对应的动作
    private StateDo GetStateDo(int stateID)
    {
        StateDo common = new StateDo();

        common.StateID = -1;

        //查找对应ID的动作
        foreach (StateDo _s in DoList)
        {
            if (_s.StateID == 0)
            {
                common = _s;
            }
            if (_s.StateID == stateID)
            {
                return(_s);
            }
        }
        //如果找到默认动作,则返回默认动作,否则返回空
        if (common.StateID == 0)
        {
            return(common);
        }
        else
        {
            //Debug.LogFormat("<color=red> {0} </color>的ActionList中找不到<color=red> {1}阶段 </color>的动作!", transform.name, stateID);
            return(common);
        }
    }
    //执行点击动作
    private void CheckOnClick(GameObject go)
    {
        //如果正在播放动画则不响应点击
        if (!GetLevelManager().isCommonState())
        {
            return;
        }

        int     stateID = GetLevelManager().GetNowState();
        StateDo _do     = GetStateDo(stateID);

        //如果找不到动作,则什么都不做
        if (_do.StateID == -1)
        {
            return;
        }

        //执行动作
        float maxTime = -1;

        //执行这个State下的多个动作
        foreach (AnimationClip action in _do.ActionList)
        {
            if (action != null)
            {
                maxTime = Mathf.Max(maxTime, action.length);
            }

            PlayAnimation(action);
        }
        WaitForCheckAction(maxTime, _do);
    }
Beispiel #7
0
    public bool CheckDoList()
    {
        int     stateID = GetLevelManager().GetNowState();
        StateDo _do     = GetStateDo(stateID);

        //如果找不到动作,则什么都不做
        if (_do.StateID == -1)
        {
            return(false);
        }

        //播放故事
        GetLevelManager().SetLevelState(LevelManager.LevelStateType.PlayStory);
        if (manager != null)
        {
            manager.StartStory(_do.Story, () =>
            {
                GetLevelManager().SetLevelState(LevelManager.LevelStateType.Common);
                CheckAction(_do.NextDo, jumpnum);
            });
            return(true);
        }
        else
        {
            Debug.Log("找不到故事管理器,请检查!");
            return(false);
        }
    }
Beispiel #8
0
    //执行点击动作
    private void CheckOnClick(GameObject go)
    {
        //如果正在播放动画则不响应点击
        if (!GetLevelManager().isCommonState())
        {
            return;
        }

        int     stateID = GetLevelManager().GetNowState();
        StateDo _do     = GetStateDo(stateID);

        //如果找不到动作,则什么都不做
        if (_do.StateID == -1)
        {
            return;
        }

        //执行动作
        float maxTime = -1;

        animation_index = 0;
        //执行这个State下的多个动作
        maxTime = CheckAnimationList(_do);
        WaitForCheckAction(maxTime, _do);
    }
    private void DoAnimationNext(StateDo _do)
    {
        //执行动作
        float maxTime = -1;

        //执行这个State下的多个动作
        maxTime = CheckAnimationList(_do);
        WaitForCheckAction(maxTime, _do);
    }
 public Animator GetAnimator(int index, StateDo _do)
 {
     if (_do.AnimatorList.Length > index)
     {
         return(_do.AnimatorList[index]);
     }
     else
     {
         return(null);
     }
 }
Beispiel #11
0
    public bool CheckDoList()
    {
        int stateID = GetLevelManager().GetNowState();

        Usingdo = GetStateDo(stateID);

        //如果找不到动作,则什么都不做
        if (Usingdo.StateID == -1)
        {
            return(false);
        }

        //播放故事
        ShowStory();
        return(true);
    }
 private void WaitForCheckAction(float time, StateDo _do)
 {
     if (time > 0)
     {
         //等待动画播放完执行下一步判断
         TimeTool.SetWaitTime(time, gameObject, () =>
         {
             GetLevelManager().SetLevelState(LevelManager.LevelStateType.Common);
             CheckAction(_do.NextDo, jumpnum);
         });
     }
     else
     {
         CheckAction(_do.NextDo, jumpnum);
     }
 }
    float CheckAnimationList(StateDo _do)
    {
        float maxTime = -1;

        for (int i = animation_index; i < _do.ActionList.Length; i++)
        {
            AnimationClip action = _do.ActionList[i];
            if (action != null)
            {
                maxTime = Mathf.Max(maxTime, action.length);
            }

            PlayAnimation(action, GetAnimator(animation_index, _do));
            animation_index++;

            //如果是顺序执行则先等待动画播放完
            if (_do.AnimationAction[animation_index - 1] == AnimationType.Next)
            {
                break;
            }
        }
        return(maxTime);
    }