private IEnumerator CreateAfflictionCardRemovedEffect(StateDataSO stateData, Action action) { // Create Card object GameObject newStateCardGO = Instantiate(stateCardEffectPrefab, cardParent); StateCardRewardOverlay newStateCard = newStateCardGO.GetComponent <StateCardRewardOverlay>(); // Set up card properties BuildStateCardRewardOverlayFromData(stateData, newStateCard); // Scale down card SetParentScale(newStateCard.stateCardScaleParent, new Vector3(0.005f, 0.005f, 0.005f)); // Insert Delay, break up multiple simoltaenous reveals yield return(new WaitForSeconds(CalculateCardRevealDelay())); // Get next available slot position CardRewardScreenSlot mySlot = GetNextAvailableSlotPosition(); // dont proceed unless a slot is available if (mySlot == null) { action.actionResolved = true; yield break; } // Move to starting slot position newStateCard.masterLocationParent.position = mySlot.parentTransform.position; // Start scaling card back to normal size Action scaleEffect = ScaleUpCard(newStateCard.stateCardScaleParent, 1); yield return(new WaitUntil(() => scaleEffect.actionResolved == true)); // Brief pause, so player can read the card yield return(new WaitForSeconds(0.5f)); // Free up slot mySlot.occupied = false; // Start Card Fade out FadeOutStateCard(newStateCard); // Start card burn VFX newStateCard.fireDestroyParticleEffectParent.SetActive(true); // Destroy Destroy(newStateCard, 2); // Resolve action.actionResolved = true; }
private IEnumerator CreateAbilityCardRewardEffectCoroutine(AbilityDataSO abilityData, Action action) { // Create Card object GameObject newAbilityCardGO = Instantiate(abilityCardEffectPrefab, cardParent); AbilityCardRewardOverlay newAbilityCard = newAbilityCardGO.GetComponent <AbilityCardRewardOverlay>(); // Set up card properties BuildAbilityCardRewardOverlayFromData(abilityData, newAbilityCard); // Scale down card SetParentScale(newAbilityCard.abilityCardScaleParent, new Vector3(0.005f, 0.005f, 0.005f)); // Insert Delay, break up multiple simoltaenous reveals yield return(new WaitForSeconds(CalculateCardRevealDelay())); // Get next available slot position CardRewardScreenSlot mySlot = GetNextAvailableSlotPosition(); // dont proceed unless a slot is available if (mySlot == null) { action.actionResolved = true; yield break; } // Move to starting slot position newAbilityCard.masterLocationParent.position = mySlot.parentTransform.position; // Start scaling card back to normal size Action scaleEffect = ScaleUpCard(newAbilityCard.abilityCardScaleParent, 1); yield return(new WaitUntil(() => scaleEffect.actionResolved == true)); // Brief pause, so player can read the card yield return(new WaitForSeconds(1)); // Free up slot mySlot.occupied = false; // Start scaling card back down ScaleDownCard(newAbilityCard.abilityCardScaleParent, 0.01f); // Start card rotation towards destination RotateCardZAxis(newAbilityCard.abilityCardScaleParent, -45); // Enable Sparkle Effect newAbilityCard.sparkleParticleEffectParent.SetActive(true); // Move character panel button position Action moveEffect = MoveCardToDestination(newAbilityCard.masterLocationParent, charRosterButtonEndPosition.position); yield return(new WaitUntil(() => moveEffect.actionResolved == true)); // Create mini explosion on char roster button GameObject newPE = Instantiate(lootExplosionEffectPrefab, cardParent); newPE.transform.position = charRosterButtonEndPosition.position; // Destroy item card Destroy(newAbilityCardGO); // Resolve action.actionResolved = true; }