コード例 #1
0
    public IEnumerator ChaseTarget()
    {
        Vector2 targetPos = target.transform.position;
        Vector2 youPos    = transform.position;
        float   xInputNew = 0.0f;

        while (true)
        {
            targetPos = target.transform.position;
            youPos    = transform.position;

            if (targetPos.x > youPos.x)
            {
                xInputNew = 1;
            }
            else if (targetPos.x < youPos.x)
            {
                xInputNew = -1;
            }
            if (xInputCurrent != xInputNew)
            {
                cns.SetxInput(xInputNew);
                xInputCurrent = xInputNew;
            }
            yield return(null);
        }
    }
コード例 #2
0
ファイル: HumanInput.cs プロジェクト: viannone/NewRepo
 public IEnumerator InputListen()
 {
     while (true)
     {
         cns.SetxInput(Input.GetAxisRaw("Horizontal"));
         cns.SetyInput(Input.GetAxisRaw("Vertical"));
         if (Input.GetAxisRaw("Platform") > 0)
         {
             if (!cns.grounded && Prush.prush.jumpsThusFar < Prush.prush.maxPlatforms)
             {
                 Prush.prush.Platform();
                 yield return(new WaitForSeconds(.3f));
             }
             else if (cns.grounded && Prush.prush.jumpsThusFar != 0)
             {
                 Prush.prush.CancelPlatform();
             }
         }
         yield return(null);
     }
 }
コード例 #3
0
 public IEnumerator InputListen()
 {
     while (true)
     {
         cns.SetxInput(Input.GetAxisRaw("Horizontal"));
         cns.SetyInput(Input.GetAxisRaw("Vertical"));
         if (Input.GetAxisRaw("Platform") > 0)
         {
             if (!cns.grounded && platformPrimed)
             {
                 platformPrimed = false;
                 Prush.prush.Platform();
             }
             else if (cns.grounded && !platformPrimed)
             {
                 Prush.prush.CancelPlatform();
                 platformPrimed = true;
             }
         }
         yield return(null);
     }
 }