예제 #1
0
        public void RandomBlockType()
        {
            // 인덱스를 랜덤으로 생성한다.
            int RandomIndex = newRandom.Next((int)BLOCKTYPE.BT_I, (int)BLOCKTYPE.BT_MAX);

            curBlockType = (BLOCKTYPE)RandomIndex;
        }
예제 #2
0
    public virtual void UseBlock(Vector2 pos, int hp, float movedownpos, BLOCKTYPE blocktype)
    {
        base.Init(pos);

        ChangeBlockType(blocktype, hp);
        _MoveDownPos = movedownpos;
    }
예제 #3
0
        public StBlockDscription GetBlockInfo(BLOCKTYPE type)
        {
            int posToSet = -1;

            switch (type)
            {
            case BLOCKTYPE.TEST:
                posToSet = 8;
                break;

            case BLOCKTYPE.CONFIG:
                posToSet = 16;
                break;

            case BLOCKTYPE.RESOURCE:
                posToSet = 24;
                break;
            }

            mFs.Position = posToSet;

            StBlockDscription retval = new StBlockDscription();

            retval.Begin  = ReadInt();
            retval.Length = ReadInt();

            return(retval);
        }
예제 #4
0
    public void MakeBlock()
    {
        int   temphp = _NowTurnsBlockHp;
        float base_y = 20.0f;
        float rate   = 0.9f;

        CreateNewBlockArray();

        for (int i = 0; i < _BlockArraySize; i++)
        {
            if (_IsBlockArray[i] != 0)
            {
                BLOCKTYPE nowtype = (BLOCKTYPE)_IsBlockArray[i];
                _BlockList[_UsingBlockNum].gameObject.SetActive(true);
                _BlockList[_UsingBlockNum].MakeInit();
                _BlockList[_UsingBlockNum].UseBlock(new Vector2(2.2f + i * 1.6f, base_y), temphp, rate, nowtype);
                _BlockList[_UsingBlockNum].SetChileInit();
                _UsingBlockNum++;
                if (_UsingBlockNum >= _MAXBLOCKNUM)
                {
                    _UsingBlockNum = 0;
                }
            }
        }
        NextTurn();
    }
예제 #5
0
        public static Block GetBlock(BLOCKTYPE type, Colors color, byte rotation)
        {
            Type  t = _classes[type];
            Block b = (Block)Activator.CreateInstance(t);

            b.Init(_colors[color], rotation);
            return(b);
        }
예제 #6
0
        public void ExtractFile(string path, BLOCKTYPE type)
        {
            FileStream        fso  = new FileStream(path, FileMode.Create, FileAccess.Write);
            StBlockDscription dscp = GetBlockInfo(type);

            mFs.Position = dscp.Begin;

            int red         = 0;
            int thisRed     = 0;
            int buflen      = 1024;
            int readingPlan = 0;
            int left        = 0;

            readingPlan = buflen < dscp.Length ? buflen : dscp.Length;

            byte[] buf = new byte[1024];

            bool doRead = true;

            while (doRead)
            {
                //counting
                thisRed = mFs.Read(buf, 0, readingPlan);
                fso.Write(buf, 0, thisRed);
                red += thisRed;

                //make plan
                left = dscp.Length - red;
                if (left >= buflen)
                {
                    readingPlan = buflen;
                }
                else
                {
                    readingPlan = left;
                }

                //if stop
                if (red == dscp.Length)
                {
                    doRead = false;
                }
            }

            fso.Close();
        }
예제 #7
0
    public void ChangeBlockType(BLOCKTYPE type, int hp)
    {
        if (_BlockType != type)
        {
            DestroyImmediate(_TypePerent, true);//붙어있는 컴포넌트를 제거하기 위함

            _BlockType = type;
            _BlockBodySprite.sprite = _BlockAtlas.GetSprite(type.ToString());

            //BLOCKADD : case 추가
            switch (_BlockType)
            {
            case BLOCKTYPE.Normal:
                _TypePerent = gameObject.AddComponent <Block_Normal>();
                break;
            }
        }
        if (_TypePerent)
        {
            _TypePerent.Init_Common(hp, _Shaker, _HPMesh, _HitEffect);
            _TypePerent.Init_Independent();
        }
    }
예제 #8
0
 String[] getBlockString(BLOCKTYPE type)
 {
     if (type == BLOCKTYPE.BAR)
     {
         return(Bar);
     }
     else if (type == BLOCKTYPE.L)
     {
         return(L);
     }
     else if (type == BLOCKTYPE.Z)
     {
         return(Z);
     }
     else if (type == BLOCKTYPE.T)
     {
         return(T);
     }
     else if (type == BLOCKTYPE.SQUARE)
     {
         return(Square);
     }
     return(null);
 }
예제 #9
0
 // 블록 모양을 결정한다.
 private void SettingBlock(BLOCKTYPE _eBlockType, BLOCK_DIRECTION _eBlockDirection)
 {
     blockShape = AllBlock[(int)_eBlockType][(int)_eBlockDirection];
 }
예제 #10
0
 private void SettingBlock(BLOCKTYPE _Type, BLOCKDIR _Dir)
 {
     Arr = AllBlock[(int)_Type][(int)_Dir];
 }