Exemplo n.º 1
0
    void Update()
    {
        keyPressed();
        RFIB.statesUpdate();



        if (Time.time > 3 && autoRun)
        {
            print("StartToBuild...");
            RFIB.startToBuild();
            RFIB.printNoiseIDs();

            autoRun = false;
        }

        if (Flag_Draw3DSpace)
        {
            DrawBlock();
        }

        // 從 Resources 下載入 Cube 物件
        if (Input.GetKeyDown(KeyCode.A))
        {
            UnityEngine.Object obj  = Resources.Load("Cube");
            GameObject         gobj = Instantiate(obj) as GameObject;
            gobj.transform.localScale = new Vector3(2.0f, 2.0f, 2.0f);
        }
    }
Exemplo n.º 2
0
    readonly int delayForReceivingTime = 200;            // 清空之後停多久才收id

    #endregion

    void Start()
    {
        #region Set RFIB Parameter
        RFIB = new RFIBricks_Cores(ReaderIP, ReaderPower, Sensitive, EnableAntenna, Flag_ToConnectTheReade);
        RFIB.setShowSysMesg(showSysMesg);
        RFIB.setShowReceiveTag(showReceiveTag);
        RFIB.setShowDebugMesg(showDebugMesg);

        RFIB.setSysTagBased(sysTagBased);
        RFIB.setAllowBlockType(RFIBParameter.AllowBlockType);

        RFIB.setRefreshTime(refreshTime);
        RFIB.setDisappearTime(disappearTime);
        RFIB.setDelayForReceivingTime(delayForReceivingTime);

        // 開始接收ID前要將地板配對
        BoardMapping();

        RFIB.startReceive();
        RFIB.startToBuild();
        RFIB.printNoiseIDs();

        #endregion

        tagSensing  = new Dictionary <string, bool>();
        tagMissTime = new Dictionary <string, int>();

        foreach (var dic in gameParameter.characterDic)
        {
            tagSensing.Add(dic.Key, false);
            tagMissTime.Add(dic.Key, 0);
        }
    }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        model = GameModel.GetInstance();
        InitPlantTable();

        RFIB = new RFIBricks_Cores(ReaderIP, ReaderPower, Sensitive, EnableAntenna, Flag_ToConnectTheReade);
        //RFIB.setSerialcomPort("COM3"); //arduino connect
        RFIB.setShowSysMesg(true);
        RFIB.setShowReceiveTag(true);
        RFIB.setShowDebugMesg(true);

        RFIB.setSysTagBased("8940 0000");
        RFIB.setAllowBlockType(AllowBlockType);

        RFIB.setRefreshTime(1000);          //clear beffer
        RFIB.setDisappearTime(600);         //id 消失多久才會的消失
        RFIB.setDelayForReceivingTime(400); //清空之後停多久才收id

        BoardMapping();                     // 開始接收ID前要將地板配對

        RFIB.startReceive();

        RFIB.startToBuild();
        RFIB.printNoiseIDs();

        updateFlag = new bool[5, 9];
        errorMap   = new bool[5, 9];
        for (int i = 0; i < 5; i++)
        {
            for (int j = 0; j < 9; j++)
            {
                updateFlag[i, j] = false;
                errorMap[i, j]   = false;
            }
        }

        lastIdStack   = new string[5, 9, 3];
        lastDirection = new string[5, 9, 3];
        lastPlant     = new int[5, 9, 3];
        for (int i = 0; i < 5; i++)
        {
            for (int j = 0; j < 9; j++)
            {
                for (int k = 0; k < 3; k++)
                {
                    lastIdStack[i, j, k]   = "0000";
                    lastDirection[i, j, k] = "000000";
                    lastPlant[i, j, k]     = 0;
                }
            }
        }
    }
Exemplo n.º 4
0
    void Start()
    {
        #region Set RFIB Parameter
        RFIB = new RFIBricks_Cores(ReaderIP, ReaderPower, Sensitive, EnableAntenna, Flag_ToConnectTheReade);
        RFIB.setShowSysMesg(showSysMesg);
        RFIB.setShowReceiveTag(showReceiveTag);
        RFIB.setShowDebugMesg(showDebugMesg);

        RFIB.setSysTagBased(sysTagBased);
        RFIB.setAllowBlockType(RFIBParameter.AllowBlockType);

        RFIB.setRefreshTime(refreshTime);
        RFIB.setDisappearTime(disappearTime);
        RFIB.setDelayForReceivingTime(delayForReceivingTime);

        // 開始接收ID前要將地板配對
        BoardMapping();

        RFIB.startReceive();
        RFIB.startToBuild();
        RFIB.printNoiseIDs();

        #endregion

        blockId    = new string[RFIBParameter.stageCol, RFIBParameter.stageRow, RFIBParameter.maxHight];
        touchBlock = new bool[RFIBParameter.touchCol, RFIBParameter.touchRow];

        for (int i = 0; i < RFIBParameter.stageCol; i++)
        {
            for (int j = 0; j < RFIBParameter.stageRow; j++)
            {
                for (int k = 0; k < RFIBParameter.maxHight; k++)
                {
                    blockId[i, j, k] = "0000";
                }
            }
        }
        for (int i = 0; i < RFIBParameter.touchCol; i++)
        {
            for (int j = 0; j < RFIBParameter.touchRow; j++)
            {
                touchBlock[i, j] = false;
            }
        }
    }