Example #1
0
    static public bool Check(Activators activator)
    {
        switch (activator)
        {
        case Activators.PressKeyE:
            return(Input.GetKeyDown(KeyCode.E));

        case Activators.GoTop:
            return(Input.GetAxis("Vertical") > 0);

        case Activators.GoRight:
            return(Input.GetAxis("Horizontal") > 0);

        case Activators.GoBottom:
            return(Input.GetAxis("Vertical") < 0);

        case Activators.GoLeft:
            return(Input.GetAxis("Horizontal") < 0);

        case Activators.Enter:
            return(true);

        default:
            return(false);
        }
    }
Example #2
0
        public override void HandleSignal(Signal signal)
        {
            if (signal is Stimulation)
            {
                var stimulation = signal as Stimulation;
                var affinity    = Pattern.Affinity(stimulation.Peptide, AffinityType.Euclidean);

                if (affinity >= Globals.HelperAffinityThreashold)
                {
                    peptideAffinitySum += affinity;
                    costimulationSum   += stimulation.Concentration;
                    Activators.Add(stimulation.Sender);

                    if (!Activated && peptideAffinitySum + costimulationSum > Globals.HelperActivationThreshold)
                    {
                        Activated = true;

                        //Secrete(new Cytokine(Address, CytokineType.IL2, costimulationSum));	// TODO: X64 stimulates growth and differentiation of T cell response
                        //Secrete(new Cytokine(Address, CytokineType.IL4, costimulationSum));	// TODO: X64 stimulates proliferation and differentiation

                        string nodes = "";
                        foreach (var activator in Activators)
                        {
                            nodes += activator + ",";
                        }
                        Log("ALARM: Attack detected in node " + nodes.TrimEnd(new char[] { ',' }), LogLevel.Major);

                        // die after activation
                        Apoptosis();
                    }
                }
            }
            base.HandleSignal(signal);
        }
Example #3
0
        public static void Init()
        {
            try
            {
                if (Global.Reset.Enabled)
                {
                    Reset.Force(Global.Name, Global.Reset.MaxAge);
                }

                /*
                 * AppDomain.CurrentDomain.UnhandledException +=
                 *  delegate(object sender, UnhandledExceptionEventArgs eventArgs)
                 *  {
                 *      try
                 *      {
                 *          var ex = sender as Exception;
                 *          if (ex != null)
                 *          {
                 *              Global.Logger.AddItem(new LogItem(ex));
                 *          }
                 *      }
                 *      catch (Exception ex)
                 *      {
                 *          Console.WriteLine(ex);
                 *      }
                 *  };
                 *
                 */
                #region GameObjects

                GameObjects.Initialize();

                #endregion GameObjects

                Global.SFX = new SFXUtility();

                #region Parents

                var activators = new Activators();
                var detectors  = new Detectors();
                var drawings   = new Drawings();
                var events     = new Events();
                var others     = new Others();
                var timers     = new Timers();
                var trackers   = new Trackers();

                #endregion Parents

                Global.Features.AddRange(
                    new List <IChild>
                {
                    #region Features

                    new AntiRengar(activators),
                    new AutoJump(activators),
                    new KillSteal(activators),
                    new Potion(activators),
                    new Revealer(activators),
                    new Smite(activators),
                    new Gank(detectors),
                    new Replay(detectors),
                    new Teleport(detectors),
                    new Clock(drawings),
                    new Clone(drawings),
                    //new DamageIndicator(drawings),
                    new Health(drawings),
                    new LaneMomentum(drawings),
                    new LasthitMarker(drawings),
                    new PerfectWard(drawings),
                    new Range(drawings),
                    new WallJumpSpot(drawings),
                    new Waypoint(drawings),
                    new AutoLeveler(events),
                    new Features.Events.Game(events),
                    new Trinket(events),
                    new AntiFountain(others),
                    new AutoLantern(others),
                    new Flash(others),
                    new Humanize(others),
                    new MoveTo(others),
                    new Ping(others),
                    new TurnAround(others),
                    new Ability(timers),
                    new Altar(timers),
                    new Cooldown(timers),
                    new Inhibitor(timers),
                    new Jungle(timers),
                    new Relic(timers),
                    new Destination(trackers),
                    new LastPosition(trackers),
                    new Sidebar(trackers),
                    new Ward(trackers)

                    #endregion Features
                });
                foreach (var feature in Global.Features)
                {
                    try
                    {
                        feature.HandleEvents();
                    }
                    catch (Exception ex)
                    {
                        Global.Logger.AddItem(new LogItem(ex));
                    }
                }
                try
                {
                    Update.Check(
                        Global.Name, Assembly.GetExecutingAssembly().GetName().Version, Global.UpdatePath, 10000);
                }
                catch (Exception ex)
                {
                    Global.Logger.AddItem(new LogItem(ex));
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
    void Build()
    {
        name("Main");
        description("The Quest defining the main plot of the game.");
        startsActive(true);


        state("S_INIT")
        .onEnter(s =>
        {
            player.transform.position = initialSpawn.transform.position;
            enter("S0");
        });

        state("S0")
        .scene()
        .actor(mother)
        .act(aq => mother.SetActive(true))
        .act(aq => player.SetSpeed(0.1f))
        .wait(1.5f)
        .act(aq => player.SetSpeed(0.25f))
        .say("Come, Little Red-Cap, here is a piece of cake and a bottle of wine; take them to your grandmother, she is ill and weak, and they will do her good.")
        .say("Set out before it gets hot, and when you are going, walk nicely and quietly and do not run off the path, or you may fall and break the bottle, and then your grandmother will get nothing.")
        .say("And when you go into her room, don't forget to say, \"Good morning\", and don't peep into every corner before you do it.")
        .actor(player)
        .say("I will take great care.")
        .act(aq => mother.FadeOut(0.5f).Then(() => mother.SetActive(false)).Start(), 0.5f)
        .act(aq => {
            float t = 1f, m = 0.25f, d = (t - m);
            new Tween(3f, p => player.SetSpeed(m + d * p)).Start();
        });


        System.Action <GameObject, string> whisper = (whisperer, text) =>
        {
            SpeechBubble bubble = null;
            var          aura   = whisperer.AddComponent <TriggerExtensions.Aura>();
            aura.shouldAffect = a => a.tag == "Player";

            aura.onEnter = o =>
            {
                bubble = whisperer.Say(text, -1, whisperer.transform.position);
                bubble.transform.SetAsLastSibling();
                bubble.SetBackgroundColor(whisperBackgroundColor);
                bubble.SetTextColor(whisperForegroundColor);
            };
            aura.onExit = o => {
                if (bubble != null)
                {
                    Destroy(bubble.gameObject);
                }
                Destroy(aura);
            };
        };

        state("S0")
        .scene().actor(null).act(aq =>
        {
            whisper(whisperer1, "Do not get anyone killed!");
            whisper(whisperer2, "Or anything!");
            whisper(whisperer3, "The woods see!");
            whisper(whisperer4, "The woods remember!");
        })
        .transition("S0 Wander");


        state("S0 Wander")
        .scene()
        .activatedBy(Activators.InRange(player, wolf, 4f))
        .transition("S1");

        state("S1")
        .scene()
        .actor(wolf)
        .act(aq =>
        {
            float s = player.GetSpeed() / 2;
            wolf.SetSpeed(s);
            player.SetSpeed(s);
        })
        .follow(player)
        .wait(2f)
        .delay(3f, aq => {
            player.MultiplySpeed(2);
            wolf.MultiplySpeed(2);
        })

        .conversation().with(wolf)
        .they("Good day, Little Red-Cap")
        .player("Thank you kindly, wolf.")
        .they("Whither away so early, Little Red-Cap?")
        .player().choice()
        .option("To my grandmother's.", "S2")
        .option("To the Huntsman's.",
                c => Die("Your caution roused the wolf and he ate you.",
                         "Little Red Ridding Hood %1 Who was cautious perhaps too much."));

        state("S2")
        .conversation().with(wolf)
        .they("What have you got in that basket?")
        .player("Cake and wine; yesterday was baking-day, so poor sick grandmother is to have something good, to make her stronger.")
        .they("It does smell delicious.")
        .player().choice()
        .option("Thank you.", "S4")
        .option("Thank you! Would you like some?",
                c => { friendshipWithWolf++; enter("S3"); });

        state("S3")
        .conversation().with(wolf)
        .they().act(aq =>
        {
            var sb = wolf.Say("I would love a bite of you");
            new WaitForSeconds(0.75f)
            .Then(() => sb.text = "I would love a bite of your cake")
            .Start(aq.getQuest());
        }, 4f)
        .player("Here is some.")
        .transition("S4");

        state("S4")
        .conversation().with(wolf)
        .they("Where does your grandmother live, Little Red-Cap?")
        .player().choice()
        .option("Just past the Huntsman's house.",
                c => { friendshipWithWolf--; enter("S5"); })
        .option("A good quarter of a league farther on in the wood.", "S5")
        .option("A good quarter of a league farther on in the wood. Her house stands under the three large oak-trees, the nut-trees are just below; you surely must know it.",
                c => { friendshipWithWolf++; enter("S5"); });

        state("S5")
        .scene().onEnter(s =>
        {
            if (friendshipWithWolf < 0)
            {
                Die("Your caution roused the wolf and he ate you.",
                    "Little Red Ridding Hood %1 Who was a bit too cautious.");
            }

            if (friendshipWithWolf == 0)
            {
                enter("SAmbush");
            }

            if (friendshipWithWolf > 0)
            {
                enter("S6");
            }
        });

        state("SAmbush")
        .scene().onEnter(s =>
        {
            Debug.LogWarning("Wolf ambushes you on the way back");
            Die("The wolf ambushed you on the way back");
        });

        state("S6")
        .scene()
        .activatedBy(Activators.Enters(player, flowerPath))
        .onEnter(s =>
        {
            if (friendshipWithWolf > 1)
            {
                enter("SF8");
            }
            else
            {
                enter("S8");
            }
        });

        state("S8")
        .conversation().with(wolf)
        .they().act(a => flowerChallenge.Begin(player))         //## logically not here, but should be here
        .they("See, Little Red-Cap, how pretty the flowers are about here — why do you not look round?")
        .they("I believe, too, that you do not hear how sweetly the little birds are singing.")
        .they("You walk gravely along as if you were going to school, while everything else out here in the wood is merry.")
        .player().think("Suppose I take grandmother a fresh nosegay; that would please her too. It is so early in the day that I shall still get there in good time.")
        .scene()
        .actor(wolf)
        .unfollow()
        //.act(a => flowerChallenge.Begin(player)) //## moved up
        .act(a => wolf.SetSpeed(0.75f))
        .move(() => wolf.transform.position - new Vector3(1.5f, 0))
        .act(a => wolf.FadeOut(2f).Start())
        .move(() => wolf.transform.position - new Vector3(3, 0), 2f)
        .scene()
        .activatedBy(Activators.Enters(player, grandmasHouse))
        .onEnter(s =>
        {
            Die("<s>Your grandma</s> The wolf \n ate you!",
                "Little Red Riding Hood %1 Who naively walked through the woods.",
                "Granny %2 Who became the treat for her guest the wolf.");
        });

        state("SF8")
        .conversation().with(wolf)
        .they().act(a => flowerChallenge.Begin(player, wolf))
        .they("See, Little Red-Cap, how pretty the flowers are about here — would their freshness not please your grandmother?")
        .they("I dare say, too, that I can gather the most refreshing of them all, before you do.")
        .player().think("Suppose I take grandmother a fresh nosegay; that would please her too. It is so early in the day that I shall still get there in good time.")
        .they()
        .unfollow()
        .act(a =>
        {
            wolf.SetSpeed(1.5f);             //## rather fast
            wolf.AddComponent <WolfAI>().flowersToCollect = flowerChallengeWinScore;
        })
        .scene()
        .activatedBy(activate => flowerChallenge.AddObserver(() =>
        {
            int sp = flowerChallenge.GetScore(player);
            int sw = flowerChallenge.GetScore(wolf);

            hasReasonToThankWolf = (sp < sw);

            if (sp >= flowerChallengeWinScore || sw >= flowerChallengeWinScore)
            {
                activate();
            }
        }))
        .transition("SF9");

        state("SF9")
        .scene()     //#! the whole Huntsman scene
        .transition("SFW11");

        state("SFW11")
        .conversation().with(wolf)
        .they().follow(player)
        .they().wait(0.2f)
        .they("Let me escort you to your grandma's, dear girl.")
        .scene()
        .activatedBy(Activators.Enters(player, grandmaPath))
        .onEnter(s => enter(hasReasonToThankWolf ? "SFWT12" : "SFW12"));

        state("SFW12")
        .conversation().with(wolf)
        .they("I shall leave you now, dear. Goodbye!")
        .player("Goodbye, wolf!")
        .act(a =>
             End("Your day goes by peacefully. \n But your grandma gets eaten the next day.",
                 "Grandmother %2 Who became the treat to her new neighbour the wolf."));

        state("SFWT12")
        .conversation().with(wolf)
        .they("I shall leave you now, dear. Goodbye!")
        .player("Allow me to thank you for the aid you have given me!")
        .player("Let me treat you to some wine.")
        .they("How lovely...")
        .scene()
        .actor(wolf)
        // .unfollow() //#! uncomment when dragging the wolf is implemented
        .act(a =>
        {
            Activators.Enters(wolf, sideGlade)(() =>
            {
                return(true);
            });
        });



        state("DEAD").scene()
        .actor(null).act(aq => player.SetSpeed(0))
        .getScene().completeQuest();
    }
Example #5
0
 public static TeamInfoPage OpenTeamInfoPage()
 {
     return(Activators.Get <TeamInfoPage>());
 }
 public static MainLoggedPage OpenMainLoggedPage()
 {
     return(Activators.Get <MainLoggedPage>());
 }
 public static LoginPage OpenLoginPage()
 {
     return(Activators.Get <LoginPage>());
 }
Example #8
0
 public void AddActivator(INeuron neuron, double weigth)
 {
     Activators.Add(neuron, weigth);
     neuron.Outputs.Add(this, weigth);
 }
Example #9
0
 public static CompanyInfoForm OpenCompanyInfoForm()
 {
     return(Activators.Get <CompanyInfoForm>());
 }
Example #10
0
 public static BoardPage OpenBoardPage()
 {
     return Activators.Get<BoardPage>();
 }
Example #11
0
        public static void Init()
        {
            try
            {
                #region Upvote

                var upvoteItem = Upvote.Initialize(Global.Name, 7);

                #endregion Upvote

                AppDomain.CurrentDomain.UnhandledException +=
                    delegate(object sender, UnhandledExceptionEventArgs eventArgs)
                {
                    try
                    {
                        var ex = sender as Exception;
                        if (ex != null)
                        {
                            Global.Logger.AddItem(new LogItem(ex));
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                    }
                };

                SetupLanguage();

                #region GameObjects

                GameObjects.Initialize();

                #endregion GameObjects

                Global.SFX = new SFXUtility();

                #region Upvote

                Global.SFX.Menu.SubMenu(Global.SFX.Name + "Settings").AddItem(upvoteItem);

                #endregion Upvote

                #region Parents

                var activators = new Activators();
                var detectors  = new Detectors();
                var drawings   = new Drawings();
                var events     = new Events();
                var others     = new Others();
                var timers     = new Timers();
                var trackers   = new Trackers();

                #endregion Parents

                CustomEvents.Game.OnGameLoad += delegate
                {
                    Global.Features.AddRange(
                        new List <IChild>
                    {
                        #region Features
                        new KillSteal(activators),
                        new Potion(activators),
                        new Revealer(activators),
                        new Smite(activators),
                        new Gank(detectors),
                        new Replay(detectors),
                        new Teleport(detectors),
                        new Clock(drawings),
                        new Clone(drawings),
                        new DamageIndicator(drawings),
                        new Health(drawings),
                        new LasthitMarker(drawings),
                        new PerfectWard(drawings),
                        new Range(drawings),
                        new SafeJungleSpot(drawings),
                        new WallJumpSpot(drawings),
                        new Waypoint(drawings),
                        new AutoLeveler(events),
                        new Game(events),
                        new Trinket(events),
                        new AntiFountain(others),
                        new AutoLantern(others),
                        new Flash(others),
                        new Humanize(others),
                        new MoveTo(others),
                        new Ping(others),
                        new TurnAround(others),
                        new Ability(timers),
                        new Altar(timers),
                        new Cooldown(timers),
                        new Relic(timers),
                        new Inhibitor(timers),
                        new Jungle(timers),
                        new GoldEfficiency(trackers),
                        new Destination(trackers),
                        new LastPosition(trackers),
                        new Sidebar(trackers),
                        new Ward(trackers)
                        #endregion Features
                    });
                    foreach (var feature in Global.Features)
                    {
                        try
                        {
                            feature.HandleEvents();
                        }
                        catch (Exception ex)
                        {
                            Global.Logger.AddItem(new LogItem(ex));
                        }
                    }
                    try
                    {
                        Update.Check(
                            Global.Name, Assembly.GetExecutingAssembly().GetName().Version, Global.UpdatePath, 10000);
                    }
                    catch (Exception ex)
                    {
                        Global.Logger.AddItem(new LogItem(ex));
                    }
                };
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
 public static HomePage OpenHomePage()
 {
     return(Activators.Get <HomePage>());
 }