Beispiel #1
0
    /// <summary>
    /// Returns the statue that is directly infront of the player
    /// </summary>
    /// <returns></returns>
    Statue GetStatueInfront(Vector3 direction)
    {
        Statue  statue = null;
        Vector3 origin = this.rigidbody.position;

        Debug.DrawLine(origin, origin + direction * this.rayDistance, Color.green, .25f);
        Ray        ray = new Ray(origin, direction);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, this.rayDistance, this.statueLayer))
        {
            statue = hit.collider.GetComponent <Statue>();
            statue.UpdateInteractedFrom();
        }

        return(statue);
    }