private void ExecuteMove(int _newX, int _newY) { AudioManager.PlayMoveSound(); SetPosition(_newX, _newY); MoveToAction moveToPos = new MoveToAction(this.transform, Graph.InverseExponential, DungeonManager.Instance.GridPosToWorldPos(_newX, _newY), 0.5f); moveToPos.OnActionFinish = () => { mTurnStatus = PlayerTurnStatus.Waiting; mSpriteRen.sortingOrder = mnDefaultSpriteOrderInLayer; // Check if reached the dungeonExit. if (DungeonManager.Instance.IsExitCell(PosX, PosY)) { RepeatPanelControls.ClearRepeats(); DeckManager.Instance.ReorganiseCards(); GameManager.Instance.ReachedFloorExit(); } // Repeat if needed. if (RepeatPanelControls.NumRepeatsLeft > 0) { if (RepeatPanelControls.NumRepeatsLeft > 0) { ControlAreaManager.ExecutedCard.Execute(); } } }; ActionHandler.RunAction(moveToPos); }
public void Use() { AudioManager.PlayButtonClickSound(); PlayerPiece player = GameManager.Instance.Player; // Focus onto player and animate player. BoardScroller.Instance.FocusCameraToPos( DungeonManager.Instance.GridPosToWorldPos(player.PosX, player.PosY), 0.2f, Graph.InverseExponential); ScaleToAction scaleUp = new ScaleToAction(player.transform, Graph.SmoothStep, Vector3.one * DungeonManager.Instance.ScaleMultiplier * 1.75f, 0.5f); ScaleToAction scaleDownHit = new ScaleToAction(player.transform, Graph.Dipper, Vector3.one * DungeonManager.Instance.ScaleMultiplier * 1.1f, 0.25f); ActionSequence smashSeq = new ActionSequence(scaleUp, scaleDownHit); smashSeq.OnActionFinish += () => { // Dramatic shake. ShakeAction2D camShake = new ShakeAction2D(Camera.main.transform, 10, 1.85f, Graph.InverseLinear); camShake.SetShakeByDuration(0.6f, 35); ActionHandler.RunAction(camShake); // Make all things take damage. for (int i = 0; i < mArrAffectedPositions.Length; i++) { DungeonBlock block = DungeonManager.Instance.DungeonBlocks[(int)mArrAffectedPositions[i].x, (int)mArrAffectedPositions[i].y]; switch (block.State) { case BlockState.EnemyPiece: if (RepeatPanelControls.NumRepeatsLeft > 0) { block.Enemy.TakeDamage(1 * RepeatPanelControls.NumRepeatsLeft); } else { block.Enemy.TakeDamage(1); } break; case BlockState.Obstacle: DungeonManager.Instance.DestroyBlock(block.PosX, block.PosY); break; } } RepeatPanelControls.ClearRepeats(); }; ActionHandler.RunAction(smashSeq); // Dismiss panel. ControlAreaManager.SetCardPanelVisibility(CardType.Smash, false); // Organise the cards. DeckManager.Instance.ReorganiseCards(); }
// For the button to call. public void Use() { AudioManager.PlayButtonClickSound(); int numCards = 0; switch (sDrawTier) { case CardTier.Bronze: numCards = 1; break; case CardTier.Silver: numCards = 3; break; case CardTier.Gold: numCards = 5; break; } if (RepeatPanelControls.NumRepeatsLeft > 0) { numCards *= RepeatPanelControls.NumRepeatsLeft; // Cap at 5, no point going more than that, just wastes processing power. if (numCards > 5) { numCards = 5; } // Clear the repeats. RepeatPanelControls.ClearRepeats(); } // Organise the cards. DeckManager.Instance.ReorganiseCards(); // Draw cards. DelayAction draw = new DelayAction(0.3f); draw.OnActionFinish += () => { DeckManager.Instance.DrawCard(); }; ActionRepeat repeatedDraw = new ActionRepeat(draw, numCards); ActionHandler.RunAction(repeatedDraw); // Dismiss panel. ControlAreaManager.SetCardPanelVisibility(CardType.DrawCard, false); }
public void SelectCard(int _id) { AudioManager.PlayButtonClickSound(); RepeatPanelControls.UseRepeat(); if (RepeatPanelControls.NumRepeatsLeft > 0) { if (DeckManager.Instance.GetNumCardsInHand() < DeckManager.knMaxCardsInHand - 1) { mCancelButton.interactable = false; DelayAction nextDrawDelay = new DelayAction(1.6f); nextDrawDelay.OnActionStart += () => { EventAnimationController.Instance.SetIsAnimating(true); ControlAreaManager.Instance.SetControlBlockerEnabled(true); }; nextDrawDelay.OnActionFinish += () => { EventAnimationController.Instance.SetIsAnimating(false); ControlAreaManager.SetCardPanelVisibility(CardType.MovementJoker, true); }; ActionHandler.RunAction(nextDrawDelay); } else { ControlAreaManager.Instance.SetControlBlockerEnabled(false); RepeatPanelControls.ClearRepeats(); mCancelButton.interactable = true; } GridType _movementType = (GridType)_id; DeckManager.Instance.DrawCard(_movementType); } else { GridType _movementType = (GridType)_id; DeckManager.Instance.DrawCard(_movementType); ControlAreaManager.Instance.SetControlBlockerEnabled(false); RepeatPanelControls.ClearRepeats(); mCancelButton.interactable = true; } // Dismiss panel. ControlAreaManager.SetCardPanelVisibility(CardType.MovementJoker, false); // Organise the cards. DeckManager.Instance.ReorganiseCards(); }
// For the button to call. public void Use() { AudioManager.PlayButtonClickSound(); int shieldPoints = 0; switch (sShieldTier) { case CardTier.Bronze: shieldPoints = 1; break; case CardTier.Silver: shieldPoints = 3; break; case CardTier.Gold: shieldPoints = 5; break; } // Repeat if any. if (RepeatPanelControls.NumRepeatsLeft > 0) { // Apply multiple times. GameManager.Instance.Player.AddShieldPoints(shieldPoints * RepeatPanelControls.NumRepeatsLeft); RepeatPanelControls.ClearRepeats(); } else { GameManager.Instance.Player.AddShieldPoints(shieldPoints); } // Dismiss panel. ControlAreaManager.SetCardPanelVisibility(CardType.TempShield, false); // Organise the cards. DeckManager.Instance.ReorganiseCards(); }
private void ExitPlayerPhase() { RepeatPanelControls.ClearRepeats(); ControlAreaManager.Instance.SetControlBlockerEnabled(true); }
public void Use() { AudioManager.PlayButtonClickSound(); switch (sJokerTier) { case CardTier.Bronze: if (RepeatPanelControls.NumRepeatsLeft > 0) { // Cap it at 5. Won't draw more than 5 cards (due to slot limit). int numRepeats = RepeatPanelControls.NumRepeatsLeft; if (numRepeats > 5) { numRepeats = 5; } for (int i = 0; i < numRepeats; i++) { GridType _randBronzeType = (GridType)Random.Range(0, 3); DeckManager.Instance.DrawCard(_randBronzeType); } RepeatPanelControls.ClearRepeats(); } else { GridType _randBronzeType = (GridType)Random.Range(0, 3); DeckManager.Instance.DrawCard(_randBronzeType); } break; case CardTier.Silver: if (RepeatPanelControls.NumRepeatsLeft > 0) { // Cap it at 5. Won't draw more than 5 cards (due to slot limit). int numRepeats = RepeatPanelControls.NumRepeatsLeft; if (numRepeats > 5) { numRepeats = 5; } for (int i = 0; i < numRepeats; i++) { GridType _randSilverType = (GridType)(Random.Range(0, 2) + 3); DeckManager.Instance.DrawCard(_randSilverType); } RepeatPanelControls.ClearRepeats(); } else { GridType _randSilverType = (GridType)(Random.Range(0, 2) + 3); DeckManager.Instance.DrawCard(_randSilverType); } break; } // Dismiss panel. ControlAreaManager.SetCardPanelVisibility(CardType.MovementJoker, false); // Organise the cards. DeckManager.Instance.ReorganiseCards(); }