예제 #1
0
    void OnMouseDown()
    {
        if (_scriptPlayer.move)
        {
            return;
        }

        int[] connections = _scriptWaypoints.GetAvailbleConnections(_scriptPlayer.location);
        int   max         = connections.Length;

        for (int i = 1; i < max; i += 1)
        {
            if (_id == connections[i])
            {
                _scriptVisual.ShowMove(_id);
                _scriptPlayer.Move(_location, _id);
            }
        }
    }
    public void ShowAvailbleConnections(int waypoint)
    {
        // Debug.Log(waypoint);
        int[] connections = _waypoints.GetAvailbleConnections(waypoint);

        int maxWaypoints = _matirials.Length;

        for (int i = 0; i < maxWaypoints; i += 1)
        {
            _matirials[i].color = _closed;
        }

        int maxConnections = connections.Length;

        for (int i = 1; i < maxConnections; i += 1)
        {
            _matirials[connections[i]].color = _open;
        }

        _matirials[connections[0]].color = _current;
    }