Пример #1
0
    void UpdatePlayerLineCast()
    {
        if ((Time.time - lastPlayerRaycastTime) >= secondsBetweenPlayerRaycasts)
        {
            lastPlayerRaycastTime = Time.time;
            playerHit             = Physics2D.Linecast(gameObject.transform.position, playerPos);

            // Uncomment for debugging
            Debug.DrawLine(gameObject.transform.position, playerHit.point, Color.blue);

            hitType = TranslatePlayerLineCast(playerHit);
        }
    }
Пример #2
0
 void UpdatePlayerLineCast()
 {
     if (framesSinceLastCast < framesPerPlayerRaycast)
     {
         framesSinceLastCast += 1;
     }
     else
     {
         playerHit           = Physics2D.Linecast(gameObject.transform.position, playerPos);
         hitType             = TranslatePlayerLineCast(playerHit);
         framesSinceLastCast = 0;
     }
 }