public void ReturnCardToHand(BoardUnit unit) { Player unitOwner = unit.OwnerPlayer; WorkingCard returningCard = unit.Card; returningCard.InitialCost = returningCard.LibraryCard.Cost; returningCard.RealCost = returningCard.InitialCost; Vector3 unitPosition = unit.Transform.position; _timerManager.AddTimer( x => { // STEP 1 - REMOVE UNIT FROM BOARD unitOwner.BoardCards.Remove(unit); // STEP 2 - DESTROY UNIT ON THE BOARD OR ANIMATE unit.Die(true); Object.Destroy(unit.GameObject); // STEP 3 - REMOVE WORKING CARD FROM BOARD unitOwner.RemoveCardFromBoard(returningCard); // STEP 4 - RETURN CARD TO HAND ReturnToHandBoardUnit(returningCard, unitOwner, unitPosition); // STEP 4 - REARRANGE HANDS _gameplayManager.RearrangeHands(); }, null, 2f); }
private void PushAction(Player owner, BoardSkill boardSkill, HeroSkill skill, object target) { BoardUnit targetUnit = target as BoardUnit; Player unitOwner = targetUnit.OwnerPlayer; WorkingCard returningCard = targetUnit.Card; returningCard.InitialCost = returningCard.LibraryCard.Cost; returningCard.RealCost = returningCard.InitialCost; Vector3 unitPosition = targetUnit.Transform.position; _vfxController.CreateVfx(_loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/VFX/Skills/PushVFX"), targetUnit); _soundManager.PlaySound(Enumerators.SoundType.OVERLORD_ABILITIES, skill.Skill.Trim().ToLower(), Constants.OverlordAbilitySoundVolume, Enumerators.CardSoundType.NONE); _timerManager.AddTimer( x => { // STEP 1 - REMOVE UNIT FROM BOARD unitOwner.BoardCards.Remove(targetUnit); // STEP 2 - DESTROY UNIT ON THE BOARD OR ANIMATE; targetUnit.Die(true); Object.Destroy(targetUnit.GameObject); // STEP 3 - REMOVE WORKING CARD FROM BOARD unitOwner.RemoveCardFromBoard(returningCard); // STEP 4 - RETURN CARD TO HAND _cardsController.ReturnToHandBoardUnit(returningCard, unitOwner, unitPosition); // STEP 4 - REARRANGE HANDS _gameplayManager.RearrangeHands(); _actionsQueueController.PostGameActionReport(_actionsQueueController.FormatGameActionReport( Enumerators.ActionType.RETURN_TO_HAND_CARD_SKILL, new object[] { owner, skill, targetUnit })); // _gameplayManager.GetController<RanksController>().UpdateRanksBuffs(unitOwner); }, null, 2f); }