Пример #1
0
    IEnumerator ProjectileJump(Transform a_srcTrns, Vector3 a_dest)
    {
        m_rigidbody.isKinematic = true;

        currentMotion = CurrentMotion.ProjectileJump;


        float heightLimit = a_srcTrns.position.y + 5;
        float l_Dis       = Vector3.Distance(a_srcTrns.position, a_dest);
        int   frames      = 125;

        Vector3 l_DisVector = a_dest - a_srcTrns.position;

        l_DisVector = new Vector3(l_DisVector.x, heightLimit, l_DisVector.z);

        Vector3 l_disPerFrame    = l_DisVector / frames;
        float   l_heightPerFrame = (heightLimit - a_srcTrns.position.y) / (frames * 0.5f);

        int frameCount = 0;

        while (frameCount++ < frames * 0.5f)
        {
            a_srcTrns.position += new Vector3(l_disPerFrame.x, l_heightPerFrame, l_disPerFrame.z);
            yield return(null);
        }
        while (frameCount-- > 0)
        {
            a_srcTrns.position += new Vector3(l_disPerFrame.x, (-1) * l_heightPerFrame, l_disPerFrame.z);
            yield return(null);
        }
        m_rigidbody.isKinematic = false;
        yield return(0);
    }
Пример #2
0
 void play_Click(object sender, EventArgs e)
 {
     if (CurrentMotion != null)
     {
         CurrentMotion.Start(CurrentMotion.CurrentFrame, ActionAfterMotion.Replay);
         isPlaying = true;
     }
 }
Пример #3
0
 void stop_Click(object sender, EventArgs e)
 {
     if (CurrentMotion != null)
     {
         CurrentMotion.Stop();
         isPlaying = false;
     }
 }
Пример #4
0
 void StartAutoRun()
 {
     currentMotion = CurrentMotion.Run;
 }