コード例 #1
0
ファイル: BadLuckSpell.cs プロジェクト: crassSandwich/witchos
        public override bool ConditionsAreMet(IList <string> incantation)
        {
            string ourChant = getChant(incantation), theirChant = Seance.TrueChant(getName(incantation));

            return
                (NumBrokenMirrors.Value >= 1 &&
                 ourChant.Equals(theirChant, StringComparison.InvariantCultureIgnoreCase));
            // getChant(incantation).Equals(Seance.TrueChant(getName(incantation)), StringComparison.InvariantCultureIgnoreCase);
        }
コード例 #2
0
        public override IEnumerator Evaluate(ITerminal term, string[] arguments)
        {
            if (arguments.Length == 1)
            {
                printUsage(term);
                yield break;
            }

            if (!MagicSource.Instance.On)
            {
                term.PrintSingleLine("cannot connect to the spirit world while magic is off");
                yield break;
            }

            string name = String.Join(" ", arguments.Skip(1));

            term.PrintSingleLine("connecting to spirit world...");
            yield return(new WaitForSeconds(3));

            term.PrintSingleLine("connection succeeded.");
            term.PrintEmptyLine();
            term.PrintSingleLine("now echoing the laments of the dead. press escape to stop.");
            term.PrintEmptyLine();

            var laments = Seance.GetChants(name);

            yield return(new WaitForSeconds(3));

            while (!term.WasInterrupted && laments.MoveNext())
            {
                term.PrintSingleLine(laments.Current);

                // roll our own weird WaitForSeconds so that we can immediately break if escape key is pressed
                float timer = UnityEngine.Random.Range(.5f, 3);
                while (!term.WasInterrupted && timer >= 0)
                {
                    yield return(null);

                    timer -= Time.deltaTime;
                }
            }

            term.PrintEmptyLine();
        }