public void RandomBlockType() { // 인덱스를 랜덤으로 생성한다. int RandomIndex = newRandom.Next((int)BLOCKTYPE.BT_I, (int)BLOCKTYPE.BT_MAX); curBlockType = (BLOCKTYPE)RandomIndex; }
public virtual void UseBlock(Vector2 pos, int hp, float movedownpos, BLOCKTYPE blocktype) { base.Init(pos); ChangeBlockType(blocktype, hp); _MoveDownPos = movedownpos; }
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); }
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(); }
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); }
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(); }
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(); } }
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); }
// 블록 모양을 결정한다. private void SettingBlock(BLOCKTYPE _eBlockType, BLOCK_DIRECTION _eBlockDirection) { blockShape = AllBlock[(int)_eBlockType][(int)_eBlockDirection]; }
private void SettingBlock(BLOCKTYPE _Type, BLOCKDIR _Dir) { Arr = AllBlock[(int)_Type][(int)_Dir]; }