示例#1
0
 protected override IEnumerator LogicEffect()
 {
     chaosToken       = revealChaos.Token;
     oldValue         = chaosToken.Value;
     chaosToken.Value = Math.Abs((int)chaosToken.Value);
     AllComponents.PanelSkillTest.AddModifier(ThisCard, 0);
     yield return(null);
 }
        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)));
            }
        }
示例#3
0
 public IEnumerator DropToken(ChaosTokenComponent token)
 {
     tokenList.Remove(token);
     outTokenList.Add(token);
     token.gameObject.SetActive(true);
     token.RigidBody.isKinematic = false;
     token.RigidBody.AddForce(transform.up * UnityEngine.Random.Range(1f, 10f), ForceMode.Impulse);
     token.RigidBody.AddTorque(new Vector3(1, 2, 5), ForceMode.Impulse);
     yield return(null);
 }
示例#4
0
        IEnumerator ChangingTokenToFail(RevealChaosTokenAction revealChaosToken)
        {
            ChaosTokenComponent oldToken = revealChaosToken.Token;

            revealChaosToken.Token = AllComponents.ChaosBag.tokenList.Find(t => t.Type == ChaosTokenType.Fail);
            yield return(new ReturnChaosTokenAction(oldToken).RunNow());

            SkillTest skillTest = revealChaosToken.SkillTest;

            yield return(new RevealChaosTokenAction(ref skillTest, revealChaosToken.Token).RunNow());
        }
示例#5
0
        protected override void EndGameAction(GameAction gameAction)
        {
            if (gameAction is RevealChaosTokenAction revealChaos && ChangeChaosToken(revealChaos))
            {
                this.revealChaos = revealChaos;
                revealChaos.ChooseCardOptionalAction.ChosenCardEffects.Add(playFromHand = PlayFromHand);
            }

            if (gameAction is SkillTestActionComplete skillTestComplete && CheckResetChaosToken(skillTestComplete))
            {
                chaosToken.Value = chaosToken.Type == ChaosTokenType.Basic ? oldValue : null; //Autorefresh
                chaosToken       = null;
            }
        }
示例#6
0
        public IEnumerator ReturnToken(ChaosTokenComponent token)
        {
            //token.PlaySoundReturnToken2();
            outTokenList.Remove(token);
            tokenList.Add(token);
            token.RigidBody.isKinematic = true;
            yield return(DOTween.Sequence().Append(token.transform.DOMove(tokenPreview.position, GameData.ANIMATION_TIME_DEFAULT))
                         .Join(token.transform.DORotate(tokenPreview.rotation.eulerAngles, GameData.ANIMATION_TIME_DEFAULT))
                         .AppendCallback(token.PlaySoundReturnToken)
                         .Append(token.transform.DOLocalMove(Vector3.zero, GameData.ANIMATION_TIME_DEFAULT))
                         .SetId("ReturnToken").WaitForCompletion());

            token.gameObject.SetActive(false);
        }
示例#7
0
        /************************************************************************************************/
        public IEnumerator SetChaosBag(List <string> chaosBagList, bool isTestMode = false)
        {
            int i = 0;

            foreach (string token in chaosBagList)
            {
                i++;
                ChaosTokenComponent tokenComponent = Instantiate(tokenPrefab, transform.position + new Vector3(0, i, 0), transform.rotation, transform);
                SetToken(tokenComponent, token);
                tokenList.Add(tokenComponent);
            }
            if (!isTestMode)
            {
                yield return(GetAnimation(tokenList.ToArray()));
            }
        }
示例#8
0
        void SetToken(ChaosTokenComponent tokenComponent, string typeToken)
        {
            tokenComponent.MeshRenderer.sharedMaterial = Array.Find(tokenMaterials, c => c.name == typeToken);
            tokenComponent.ImageToken = Array.Find(tokenSprite, c => c.name == typeToken);

            string tokenNameWithoutPrefix = typeToken.Substring(5);

            try
            {
                if (Enum.IsDefined(typeof(ChaosTokenType), tokenNameWithoutPrefix))
                {
                    tokenComponent.Type = (ChaosTokenType)Enum.Parse(typeof(ChaosTokenType), tokenNameWithoutPrefix, true);
                }
                else
                {
                    throw new ArgumentException("Not in Enum", tokenNameWithoutPrefix);
                }
            }
            catch
            {
                tokenComponent.Type  = ChaosTokenType.Basic;
                tokenComponent.Value = int.Parse(tokenNameWithoutPrefix);
            }
        }
 /*****************************************************************************************/
 public ReturnChaosTokenAction(ChaosTokenComponent token) => this.token = token;
示例#10
0
 /*****************************************************************************************/
 public RevealChaosTokenAction(ref SkillTest skillTest, ChaosTokenComponent token = null)
 {
     Token     = token ?? AllComponents.ChaosBag.RandomChaosToken();
     SkillTest = skillTest;
 }
示例#11
0
 /*****************************************************************************************/
 public SkillTestChaosTokenEffect(ChaosTokenComponent chaosToken) => this.chaosToken = chaosToken;