Ejemplo n.º 1
0
    void Update()
    {
        thisRigidbody.velocity = SoccerPhysics.ApplyPhysics(thisRigidbody.velocity, mass);

        if (isAiming)
        {
            if (nonPlayable)
            {
                SetAiming(false);
                return;
            }

            Vector3 mousePos = General.GetMousePosition();
            float   distance = Vector2.Distance(transform.position, mousePos);
            if (distance > padding)
            {
                selection.SetSelected();
            }
            else
            {
                selection.SetCanceled();
            }

            float ang = General.AngleBetweenPosition(transform.position, mousePos);
            transform.eulerAngles = new Vector3(0f, 0f, ang);
        }
    }
Ejemplo n.º 2
0
    public static Vector3 GetDirectionBetweenPosition(Vector3 current, Vector3 target)
    {
        float ang    = General.AngleBetweenPosition(current, target) + 90f;
        float angRad = ang * Mathf.Deg2Rad;

        Vector3 dir = new Vector3(Mathf.Cos(angRad), Mathf.Sin(angRad));

        return(dir);
    }