Esempio n. 1
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        if (script.movement != null)
        {
            GUI.enabled = false;
            EditorGUILayout.FloatField("movement.moveSpeed", script.movement.moveSpeed);

            string points = "";
            script.points.ForEach(p => {
                points += p.name + (p == script.point ? " (current)" : "") + "\n";
            });

            if (points.Length == 0)
            {
                points = "(none)";
            }

            EditorGUILayout.LabelField("points", points);


            // Find the closest one
            Closest <PushingPoint> closest = PushingPoint.GetClosest(script.points, script.controller.characterCenter, script.interaction.ignoreYAxis);

            if (closest.valid)
            {
                EditorGUILayout.LabelField("closest", closest.obj.name);
            }

            GUI.enabled = true;
        }
    }
Esempio n. 2
0
    PushingPoint GetClosestPoint()
    {
        if (hasPoint)
        {
            return(null);
        }
        if (inventory && inventory.equipped)
        {
            return(null);
        }
        if (interaction && interaction.hover)
        {
            return(null);
        }

        // Remove all invalid points. If for some reason they occur.
        points.RemoveAll(p => p == null);
        // Find the closest one
        Closest <PushingPoint> closest = PushingPoint.GetClosest(points, transform.position, interaction.ignoreYAxis);

        return(closest.obj);
    }