/// <summary> /// Gem bonus state change processing /// </summary> /// <param name="gemBonus">Who executing</param> /// <param name="currentState">Current state</param> private void BonusOnChangeGemBonusState(GemBonusBase gemBonus, GemBonusState currentState) { if (currentState == GemBonusState.Finish) { gemBonus.ChangeGemBonusState -= BonusOnChangeGemBonusState; RemoveBonuses.Add(gemBonus); } }
protected GemBonusBase(Board board, Texture2D texture2D, Rectangle gemBox, int xPosition, int yPosition) { Board = board; Texture2D = texture2D; ChangePosition(gemBox); Box.Width = (int)(gemBox.Width * 0.5); Box.Height = (int)(gemBox.Height * 0.5); XPosition = xPosition; YPosition = yPosition; State = GemBonusState.Idle; }
protected virtual void OnChangeGemBonusState(GemBonusBase gemBonus, GemBonusState currentState) { ChangeGemBonusState?.Invoke(gemBonus, currentState); }
/// <summary> /// Change of state /// </summary> /// <param name="state">State</param> protected void ChangeState(GemBonusState state) { State = state; OnChangeGemBonusState(this, State); }