private BeHitBoard CreateNewBoard() { BeHitBoard behit = new BeHitBoard(WindowID++); behit.InUse = true; return(behit); }
public void Update() { for (int i = 0; i < allBoards.Count; i++) { BeHitBoard curr = allBoards[i]; curr.Update(); if (curr.m_nLife < 0) { FreeBoard(curr); } } }
internal void AddNewBeHit(bool bDouble, string dmgText, float x, float y, ENUM_DAMAGE_TYPE dmgType, ENUM_DMG_MOVE_TYPE moveType) { if (allBoards.Count + freeBoards.Count > MaxHitCount) { return; } BeHitBoard pBeHit = GetFreeBoard(); if (pBeHit != null) { STRUCT_BEHIT_DATA PreDefine = DefineBehits[(int)moveType]; pBeHit.m_bDoubleHit = bDouble; pBeHit.m_ColorType = PreDefine.m_ColorType; pBeHit.m_BackColorType = PreDefine.m_BackColorType; //STRUCT_BEHIT_DATA* pItem = &PreDefine; pBeHit.m_nXSpeed = UnityEngine.Random.Range(-PreDefine.m_nXSpeed, PreDefine.m_nXSpeed); pBeHit.m_nYSpeed = PreDefine.m_nYSpeed + UnityEngine.Random.Range(3, 10); // Y象素级移动速度 pBeHit.m_nXAcceleration = PreDefine.m_nXAcceleration; pBeHit.m_nYAcceleration = PreDefine.m_nYAcceleration; // 两个方向的加速度 pBeHit.m_nMaxLife = PreDefine.m_nMaxLife; pBeHit.m_bAlphaMode = PreDefine.m_bAlphaMode; pBeHit.m_nMoveMode = PreDefine.m_nMoveMode; pBeHit.m_nUseTempPos = PreDefine.m_nUseTempPos; pBeHit.m_nStartX = x + PreDefine.m_fXPos; pBeHit.m_nStartY = y + PreDefine.m_fYPos; pBeHit.m_nMoveType = moveType; if (moveType == ENUM_DMG_MOVE_TYPE.MOVE_SCENE_NAME && dmgType == ENUM_DAMAGE_TYPE.DAMAGE_INVALID) { pBeHit.ResetData(dmgText); } else { pBeHit.ResetData(moveType, dmgType, dmgText); } pBeHit.Update(); allBoards.Add(pBeHit); pBeHit.InUse = true; } }
public void FreeBoard(BeHitBoard oldWindow) { freeBoards.Enqueue(oldWindow); allBoards.Remove(oldWindow); oldWindow.InUse = false; }