IEnumerator RevealOtherToken(RevealChaosTokenAction revealToken) { revealToken.IsActionCanceled = true; List <ChaosTokenComponent> tokens = new List <ChaosTokenComponent>(); List <CardEffect> allTokens = new List <CardEffect>(); for (int i = 0; i < 2; i++) { ChaosTokenComponent token = AllComponents.ChaosBag.RandomChaosToken(); tokens.Add(token); allTokens.Add(new CardEffect( card: ThisCard, effect: () => ChoosingToken(token), type: EffectType.Choose, name: "Elegir este token", investigatorImageCardInfoOwner: ThisCard.VisualOwner)); yield return(AllComponents.ChaosBag.DropToken(token)); yield return(new WaitUntil(token.RigidBody.IsSleeping)); } MultiCastAction multiCast = new MultiCastAction(allTokens, isOptionalChoice: false); for (int i = 0; i < 2; i++) { CardComponent card = multiCast.ListCardsEffect[i].Card; card.CardTools.TokensBox.SetActive(false); card.CardTools.HideFrontCard(true); card.CardTools.ChangeGlowImage(AllComponents.CardBuilder.TokenGlow, Vector3.one); originalTokenPosition[i] = tokens[i].transform.position; tokens[i].transform.SetParent(card.transform); tokens[i].RigidBody.isKinematic = true; tokens[i].GetComponent <MeshCollider>().enabled = false; DOTween.Sequence().Append(tokens[i].transform.DOLocalMove(Vector3.zero, timeAnimation)) .Join(tokens[i].transform.DOScale(0.3f, timeAnimation)) .Join(tokens[i].transform.DOLocalRotate(new Vector3(180, 0, 0), timeAnimation)); tokens[i].gameObject.layer = 8; } yield return(multiCast.RunNow()); IEnumerator ChoosingToken(ChaosTokenComponent tokenSelected) { for (int i = 0; i < 2; i++) { tokens[i].AudioSource.enabled = true; tokens[i].transform.SetParent(AllComponents.ChaosBag.transform); DOTween.Sequence().Append(tokens[i].transform.DOMove(originalTokenPosition[i], timeAnimation)) .Join(tokens[i].transform.DOScale(1f, timeAnimation)).SetId("DualTokens"); tokens[i].RigidBody.isKinematic = false; tokens[i].GetComponent <MeshCollider>().enabled = true; tokens[i].gameObject.layer = 0; } yield return(new WaitWhile(() => DOTween.IsTweening("DualTokens"))); revealToken.SkillTest.TokenThrow = tokenSelected; yield return(AllComponents.ChaosBag.ReturnToken(tokens.Find(t => t != tokenSelected))); } }
IEnumerator Bonus() { List <CardEffect> cardEffects = new List <CardEffect>(); foreach (CardComponent investigator in GameControl.AllInvestigatorsInGame.FindAll(i => i.CurrentLocation == ThisCard.VisualOwner.CurrentLocation).Select(i => i.InvestigatorCardComponent)) { cardEffects.Add(new CardEffect( card: investigator, effect: () => ChooseSkill(investigator), animationEffect: ((CardInvestigator)investigator.CardLogic).ThankYouAnimation, type: EffectType.Choose, name: "Obtener bonificación para " + investigator.Info.Name, investigatorImageCardInfoOwner: investigator.Owner)); } yield return(new ChooseCardAction(cardEffects, cancelableCardEffect: ref mainCardEffect).RunNow()); IEnumerator ChooseSkill(CardComponent investigator) { investigatorAfected = investigator.Owner; List <CardEffect> cardEffects2 = new List <CardEffect>(); foreach (Skill skill in ((Skill[])Enum.GetValues(typeof(Skill))).Where(v => v != Skill.None)) { cardEffects2.Add(new CardEffect( card: investigator, effect: () => AddSkill(skill), type: EffectType.Choose, name: "+2 <sprite name=" + skill.ToString() + ">", investigatorImageCardInfoOwner: investigator.Owner) ); } MultiCastAction multiCast = new MultiCastAction(cardEffects2, isOptionalChoice: mainCardEffect.IsCancelable); yield return(multiCast.RunNow()); mainCardEffect.IsCancel = multiCast.IsCancel; IEnumerator AddSkill(Skill skill) { skillBonuses = skill; BuffActive = true; yield return(null); } } }