Exemplo n.º 1
0
    void Start()
    {
        m_fiducial          = belongingMarker.GetComponent <FiducialController>();
        m_settings          = Settings.Instance;
        m_tokenPosition     = TokenPosition.Instance;
        m_lastComeLastServe = GameObject.FindObjectOfType <LastComeLastServe>();

        m_sRend = belongingMarker.GetComponent <SpriteRenderer>();
        childrenSpriteRenderer = GetComponentsInChildren <SpriteRenderer>();

        spriteWidthMultiplier = m_settings.GetMarkerWidthMultiplier(m_fiducial.MarkerID);
        scaleFactorTopBottomX = belongingMarker.transform.localScale.x * m_settings.thickenFactorTopBottomX;;
        scaleFactorLefRightX  = m_settings.scaleFactorLefRightX;
        scaleFactorY          = m_settings.scaleFactorY;

        if (lineTop == null)
        {
            lineTop = transform.Find("Line_Top");
        }
        if (lineBottom == null)
        {
            lineBottom = transform.Find("Line_Bottom");
        }
        if (lineLeft == null)
        {
            lineLeft = transform.Find("Line_Left");
        }
        if (lineRight == null)
        {
            lineRight = transform.Find("Line_Right");
        }

        startLoopBar = GameObject.Find(m_settings.startBarLoop).transform;
        endLoopBar   = GameObject.Find(m_settings.endtBarLoop).transform;

        bm_spriteRenderer     = belongingMarker.GetComponent <SpriteRenderer>();
        left_spriteRenderer   = lineLeft.GetComponent <SpriteRenderer>();
        right_spriteRenderer  = lineRight.GetComponent <SpriteRenderer>();
        top_spriteRenderer    = lineTop.GetComponent <SpriteRenderer>();
        bottom_spriteRenderer = lineBottom.GetComponent <SpriteRenderer>();

        bottomOffset = Camera.main.ScreenToWorldPoint(new Vector3(0, Camera.main.pixelHeight / 2 + m_settings.heightOffSetInPx_bottom, 0)).y;

        maxSpeedToShowOtherLinesForOrientation = m_settings.maxSpeedToShowOtherLinesForOrientation;

        inActiveColor = m_settings.linesForOrientationInactiveColor;
        this.SetColorOfLines(inActiveColor, 1, true);
        otherMarkersOnSameBeat = new List <LinesForOrientation>();
        oldBeat = 0;
    }
Exemplo n.º 2
0
    void Start()
    {
        fiducial = GetComponent <FiducialController>();
        rend     = GetComponent <SpriteRenderer>();

        Settings m_settings = Settings.Instance;

        red = m_settings.red;
        redMaterial.color = red;
        blue = m_settings.blue;
        blueMaterial.color = blue;
        green = m_settings.green;
        greenMaterial.color = green;

        m_lastComeLastServe = Object.FindObjectOfType <LastComeLastServe>();
    }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        m_settings          = Settings.Instance;
        m_locationBar       = Component.FindObjectOfType <LocationBar>().transform;
        m_lastComeLastServe = Component.FindObjectOfType <LastComeLastServe>();
        m_tokenposition     = TokenPosition.Instance;

        serialBaudrate  = m_settings.serialBaudrate;
        serialPortNames = m_settings.serialPortNames;

        tunesPerString = m_settings.tunesPerString;
        enableChords   = m_lastComeLastServe.enableChords;
        oldTactPos     = -1;

        // Get loop controllers
        var x = Component.FindObjectsOfType <LoopController>();

        startController = x[0].startMarker ? x[0] : x[1];
        endController   = x[0].startMarker ? x[1] : x[0];

        Boolean serialConnected = false;

        for (int i = 0; i < serialPortNames.Length && !serialConnected; i++)
        {
            try
            {
                Debug.Log("Trying to open serial connection on port: " + serialPortNames[i]);
                serialPort = new SerialPort(serialPortNames[i], serialBaudrate);
                serialPort.WriteTimeout = 100; // ms
                serialPort.Open();
                Debug.Log("Opened serial connection on port: " + serialPortNames[i]);
                serialConnected = true;
            }
            catch (IOException)
            {
                Debug.Log("Failed to open serial connection on port: " + serialPortNames[i]);
            }
        }
        if (!serialConnected)
        {
            Debug.LogWarning("No serial connection established, no music will be played");
        }
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        oldPosition            = Vector3.back;
        childrenSpriteRenderer = GetComponentsInChildren <SpriteRenderer>();
        m_sRend = GetComponent <SpriteRenderer>();

        m_settings          = Settings.Instance;
        numberOfTunes       = m_settings.tunes;
        cellHeightInPx      = m_settings.cellHeightInPx;
        heightOffSet_bottom = m_settings.heightOffSetInPx_bottom;

        m_lastComeLastServe = GameObject.FindObjectOfType <LastComeLastServe>();
        pentatonicTunes     = m_settings.pentatonicTunes;
        m_tokenPosition     = TokenPosition.Instance;

        float     markerWidthMultiplier = m_settings.GetMarkerWidthMultiplier(GetComponent <FiducialController>().MarkerID);
        Transform jokerIcon             = transform.GetChild(1);

        jokerIcon.localScale = new Vector3(jokerIcon.localScale.x / (markerWidthMultiplier * 2), jokerIcon.localScale.y, jokerIcon.localScale.z);
    }
    public TokenPosition()
    {
        if (m_Instance != null)
        {
            Debug.LogError("Trying to create two instances of singleton.");
            return;
        }

        m_Instance = this;

        //init variables
        m_tuioManager       = TuioManager.Instance;
        m_settings          = Settings.Instance;
        m_lastComeLastServe = GameObject.FindObjectOfType <LastComeLastServe>();
        m_MainCamera        = GameObject.FindGameObjectWithTag(m_settings.mainCameraTag).GetComponent <Camera>();

        beats = m_settings.beats;
        tunes = m_settings.tunes;

        //variables in world coordinates
        widthOffsetInPx         = m_settings.widthOffSetInPx;
        heightOffsetInPx_top    = m_settings.heightOffSetInPx_top;
        heightOffsetInPx_bottom = m_settings.heightOffSetInPx_bottom;
        minWorldCoords          = m_settings.minWorldCoords;
        maxWorldCoords          = m_settings.maxWorldCoords;
        worldDiff = m_settings.worldDiff;

        //calculate snapping grid
        gridHeightInPx = m_settings.gridHeightInPx;
        gridWidthInPx  = m_settings.gridWidthInPx;
        cellHeightInPx = m_settings.cellHeightInPx;
        cellWidthInPx  = m_settings.cellWidthInPx;
        cellSizeWorld  = m_settings.cellSizeWorld;

        movementThreshold = m_settings.movementThreshold;
    }