Пример #1
0
    public float GetAngleToGoal()
    {
        if (curHex == goalHex)
        {
            return(0f);
        }
        Vector3 toGoal = goalHex.transform.position
                         - move.GetPosition();

        toGoal.y = 0f;
        float bearing = Vector3.SignedAngle(Vector3.forward, toGoal,
                                            Vector3.up);
        float angle = bearing - move.GetFacing();

        if (angle < -180f)
        {
            angle += 360f;
        }
        return(angle);
    }