Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        juicer   = new Juicer(this);
        startPos = this.transform.position;

        juicer.TweenPosition(this.gameObject, endPos, animationCurve, duration, tweenComplete);
    }
Esempio n. 2
0
    public IEnumerator OnUpdate()
    {
        yield return(new WaitForSeconds(1));

        bool isFinished = false;

        ScreenFader.FadeInThen(() =>
        {
            Juicer.ShakeCamera(0.5f);
            MessageController.AddMessage("yo.");
            MessageController.AddMessage("this is game peanutbutters.");
            MessageController.AddMessage("it goes great with game jams.");
            MessageController.AddMessage("you may have noticed the camera and music change. very easy to do with cinemachine and the juicer.", postAction: () =>
            {
                GameConductor.CameraStateTrigger("NextState");
            });
            MessageController.AddMessage("these bois are moving with the simplemover script. it's an easy way to get some nice motion with little effort. useful for pickups, simple enemies, etc.", postAction: () =>
            {
                GameConductor.CameraStateTrigger("NextState");
            });
            MessageController.AddMessage("this is a fun script called textjacker. it jacks up text.", postAction: () =>
            {
                GameConductor.CameraStateTrigger("NextState");
            });
            MessageController.AddMessage("after this message finishes, the game will transition to the next game state. a basic player object will be created.", postAction: () => isFinished = true);
        });
        do
        {
            yield return(new WaitForSeconds(1));
        } while (!isFinished);
    }
Esempio n. 3
0
 public override void OnPrimaryActionFinished()
 {
     Juicer.ShakeCamera(0.5f);
     Juicer.PlaySound(1);
     GameConductor.KillNPC();
     transform.parent.parent.Translate(0, -10, 0);
 }
Esempio n. 4
0
    private IEnumerator Sprout()
    {
        Juicer.ShakeCamera(1);
        yield return(new WaitForSeconds(2));

        DataDump.Set("LocalPetGrowthStage", 5);
        Juicer.ShakeCamera(3);
    }
Esempio n. 5
0
    private IEnumerator Rebirth()
    {
        Juicer.ShakeCamera(1);
        yield return(new WaitForSeconds(2));

        DataDump.Set("LocalPetGrowthStage", 0);
        DataDump.Set("LocalPetPokes", 0);
        Juicer.ShakeCamera(3);
    }
Esempio n. 6
0
    private IEnumerator Grow()
    {
        Juicer.ShakeCamera(0.5f);
        MessageController.AddMessage("it's growing!!");
        ImpulseMover.GoHomeHack();
        yield return(new WaitForSeconds(3));

        DataDump.Set("LocalPetGrowthStage", 3);
        Juicer.ShakeCamera(3);
    }
Esempio n. 7
0
 public override void OnPrimaryActionFinished()
 {
     GameConductor.IsPlayerAWarrior = true;
     Juicer.PlaySound(1);
     playerSword.SetActive(true);
     GameConductor.EnqueueReset(() =>
     {
         playerSword.SetActive(false);
         GameConductor.IsPlayerAWarrior = false;
         transform.parent.Translate(0, 10, 0);
     });
     transform.parent.Translate(0, -10, 0);
 }
Esempio n. 8
0
    public void OnInteract()
    {
        Juicer.PlaySound(2);
        GameConductor.FreezePlayer();
        List <string> selectedTexts = used
            ? secondaryTexts
            : texts;

        if (!used)
        {
            GameConductor.EnqueueReset(() =>
            {
                used    = false;
                cleared = false;
            });
        }
        for (int i = 0; i < selectedTexts.Count; ++i)
        {
            if (!string.IsNullOrWhiteSpace(cameraTrigger))
            {
                GameConductor.CameraStateTrigger(cameraTrigger);
            }
            if (i < selectedTexts.Count - 1)
            {
                MessageController.AddMessage(selectedTexts[i]);
            }
            else
            {
                MessageController.AddMessage(selectedTexts[i], postAction: () =>
                {
                    GameConductor.UnfreezePlayer();
                    if (!string.IsNullOrWhiteSpace(cameraTrigger))
                    {
                        GameConductor.CameraStateTrigger("FocusPlayer");
                    }
                    if (used)
                    {
                        OnSecondaryActionFinished();
                        cleared = true;
                    }
                    else
                    {
                        OnPrimaryActionFinished();
                        used = true;
                    }
                    Player.DeselectInteractable();
                });
            }
        }
    }
Esempio n. 9
0
        public static void Main(string[] args)
        {
            Juicer juicer = new Juicer(30);
            var    rand   = new Random();

            for (int i = 0; i < 100; i++)
            {
                bool isRotten = (rand.Next(1, 3) == 1) ? true : false;
                juicer.AddFruit(new Apple(isRotten, "Granny Smith"));
                juicer.ApplyPress();
            }
            Logger.Instance.Log($"{juicer.Bowl.Total()} of juice produced");
            Console.WriteLine($"{juicer.Bowl.Total()} of juice produced");
        }
Esempio n. 10
0
    private IEnumerator Die()
    {
        CloseFoodMenu();
        Juicer.ShakeCamera(1);
        MessageController.AddMessage("oh no...");
        ImpulseMover.GoHomeHack();
        yield return(new WaitForSeconds(3));

        int nextGrowthTime = CurrentTime + (MinutesSpentDead * 60);

        DataDump.Set("LocalPetNextGrowthTime", nextGrowthTime);
        DataDump.Set("LocalPetGrowthStage", (int)GrowthStage.Dead);
        Juicer.ShakeCamera(3);
    }
Esempio n. 11
0
    public void OnEnter()
    {
        player = GameObject.Instantiate(PlayerPrototype);
        player.transform.position = PlayerSpawnLocation;
        Juicer.CreateFx(0, PlayerSpawnLocation);
        Juicer.ShakeCamera(0.5f);
        MusicBox.ChangeMusic((int)Song.Boss);
        DataDump.Set("HP", maxHP);
        DataDump.Set("ScaledHP", 1.0f);
        var cam = GameObject.Find("CinemachineStateCamera/GameCam").GetComponent <CinemachineVirtualCamera>();

        cam.Follow = player.transform;
        cam.LookAt = player.transform;
        GameConductor.SetShowHud(true);
    }
Esempio n. 12
0
    IEnumerator DrunkSequence()
    {
        GameConductor.CameraStateTrigger("drunk");
        GameConductor.FreezePlayer();
        yield return(new WaitForSeconds(2));

        Juicer.ShakeCamera(0.3f);
        Juicer.PlaySound(0);
        passedOutGuy.transform.position = transform.position;
        transform.parent.position       = otherStart;
        yield return(new WaitForSeconds(2));

        GameConductor.UnfreezePlayer();
        GameConductor.CameraStateTrigger("FocusPlayer");
    }
Esempio n. 13
0
    private IEnumerator Hatch()
    {
        Juicer.ShakeCamera(1);
        yield return(new WaitForSeconds(2));

        DataDump.Set("LocalPetGrowthStage", 2);
        DataDump.Set("LocalPetFullness", InitialFullness);
        DataDump.Set("LocalPetBerriesEaten", 0);
        DataDump.Set("LocalPetCookiesEaten", 0);
        DataDump.Set("LocalPetFishEaten", 0);
        DataDump.Set("LocalPetHappiness", 0);
        DataDump.Set("LocalPetAnnoyance", 0);
        int nextGrowthTime = CurrentTime + (MinutesSpentAsChild * 60);

        DataDump.Set("LocalPetNextGrowthTime", nextGrowthTime);
        Juicer.ShakeCamera(3);
    }
Esempio n. 14
0
 private IEnumerator PlayMessages()
 {
     OnPanelOpen.Invoke();
     playingMessages = true;
     while (playingMessages)
     {
         var currentMessage     = messages.Dequeue();
         var currentMessageText = currentMessage.Text;
         OnMessageStart.Invoke(currentMessageText);
         for (int i = CharacterBunch; i < currentMessageText.Length; i += CharacterBunch)
         {
             if (ShouldSkipText())
             {
                 break;
             }
             messageText.text = currentMessageText.Substring(0, i);
             yield return(new WaitForSecondsOr(CharacterDelay, ShouldSkipText));
         }
         messageText.text = currentMessageText;
         OnMessageEnd.Invoke(currentMessageText);
         skipKeyActive = false;
         if (RequireConfirmation)
         {
             while (!ShouldSkipText())
             {
                 yield return(null);
             }
         }
         else
         {
             yield return(new WaitForSecondsOr(MessageDelay, ShouldSkipText));
         }
         Juicer.PlaySound(3);
         skipKeyActive           = false;
         interruptCurrentMessage = false;
         currentMessage.Action();
         if (messages.Count == 0)
         {
             playingMessages = false;
         }
     }
     messageText.text = string.Empty;
     OnPanelClose.Invoke();
 }
Esempio n. 15
0
    public IEnumerator OnUpdate()
    {
        GameConductor.FreezePlayer();
        GameConductor.CameraStateTrigger("OblexCam");
        yield return(new WaitForSeconds(2));

        // todo: shwink sound and animations
        GameConductor.GetGate.transform.Translate(0, -10, 0);
        Juicer.PlaySound(1);
        Juicer.ShakeCamera(0.1f);
        yield return(new WaitForSeconds(1));

        GameConductor.CameraStateTrigger("NextState");
        yield return(new WaitForSeconds(1));

        Juicer.PlaySound(0);
        Juicer.ShakeCamera(1);
        yield return(new WaitForSeconds(1));

        Juicer.PlaySound(1);
        Juicer.PlaySound(0);
        GameConductor.GetCurtain.transform.Translate(0, -10, 0);
        foreach (var npc in GameConductor.GetBandNPCs)
        {
            npc.transform.Translate(0, -10, 0);
        }
        GameConductor.GetOblexBody.SetActive(true);
        foreach (var npc in GameConductor.GetNPCs)
        {
            npc.GetComponentInChildren <OblexNPC>()?.Activate();
        }
        // todo: disable doors
        GameConductor.IsOblexRevealed = true;
        yield return(new WaitForSeconds(3));

        GameConductor.UnfreezePlayer();
        GameConductor.CameraStateTrigger("FocusPlayer");
        while (GameConductor.NPCsKilled < 11)
        {
            yield return(null);
        }
    }
Esempio n. 16
0
    public IEnumerator OnUpdate()
    {
        do
        {
            int currentHP = DataDump.Get <int>("HP") - 1;
            DataDump.Set("HP", currentHP);
            DataDump.Set("ScaledHP", (float)currentHP / maxHP);
            yield return(new WaitForSeconds(1));
        } while (DataDump.Get <int>("HP") > 0);
        Juicer.CreateFx(0, player.transform.position);
        GameObject.Destroy(player);
        Juicer.ShakeCamera(1.5f);
        bool readyToMoveOn = false;

        MessageController.AddMessage("butterboi is dead now.", postAction: () => readyToMoveOn = true);
        while (!readyToMoveOn)
        {
            yield return(null);
        }
    }
Esempio n. 17
0
        private static void Main()
        {
            //var configuration = new ConfigurationBuilder()
            //    .SetBasePath(Directory.GetCurrentDirectory())
            //    .AddJsonFile("appsettings.json")
            //    .Build();
            //var logger = new LoggerConfiguration()
            //    .ReadFrom.Configuration(configuration)
            //    .CreateLogger();

            //Juicer.AddLogging(new SerilogLoggerFactory(logger: logger));

            IInjector injector  = Juicer.CreateInjector(new TestModule().Override(new ModuleToOverride()));
            IInjector injector2 = injector.Get <IInjector>();
            IInjector injector3 = injector.CreateChildInjector();

            Console.WriteLine($"Injector was able to inject itself: {injector == injector2}.");

            Console.WriteLine();
            IService    service  = injector.Get <IService>();
            ServiceImpl service2 = injector.Get <ServiceImpl>();
            IService    service3 = injector3.Get <IService>();

            service.DoThing();
            Console.WriteLine($"Same instance of service when using untargeted vs targeted binding: {service == service2}.");
            Console.WriteLine($"Same instance of service retrieved from the child injector: {service == service3}");

            Console.WriteLine();
            Console.WriteLine($"Number from IService: {service.GetNumber()}");

            Console.WriteLine();
            HashSet <IMultiImplService> services = injector.Get <HashSet <IMultiImplService> >();

            Console.WriteLine($"Number of services created for IMultiImplService: {services?.Count}");

            Console.WriteLine();
            IOtherServiceFactory serviceFactory = injector.Get <IOtherServiceFactory>();
            IOtherService        otherService   = serviceFactory.CreateService(5);

            Console.WriteLine($"Factory service numbers: {otherService.GetNumber1()} | {otherService.GetNumber2()}");

            Console.WriteLine();
            NoInterfaceService noInterfaceService = injector.Get <NoInterfaceService>();

            noInterfaceService.PrintString();

            Console.WriteLine();
            Console.WriteLine($"Doubled Num1: {injector.Get<int>("DoubledNum1")}");

            Console.WriteLine();
            var externallyProvidedService = injector.Get <IExternallyProvidedService>();

            Console.WriteLine($"String from externally provided service: {externallyProvidedService.GetPrintString()}");
            Console.WriteLine($"Same instance of externally provided service received: {externallyProvidedService == injector.Get<IExternallyProvidedService>()}.");

            Console.WriteLine();
            var mappedServices = injector.Get <Dictionary <MappedServiceTypes, IMappedService> >();

            foreach (var type in Enum.GetValues(typeof(MappedServiceTypes)).Cast <MappedServiceTypes>())
            {
                var mappedService = mappedServices[type];
                mappedService.DoSomething();
            }
#if DEBUG
            Console.ReadLine();
#endif
        }
Esempio n. 18
0
 private void Awake()
 {
     _instance   = this.CheckSingleton(_instance);
     audioSource = gameObject.AddComponent <AudioSource>();
     audioSource.outputAudioMixerGroup = uiSfxMixerGroup;
 }
Esempio n. 19
0
 private void Awake()
 {
     _instance             = this.CheckSingleton(_instance);
     _instance.audioSource = _instance.gameObject.AddComponent <AudioSource>();
 }
Esempio n. 20
0
 private void Awake()
 {
     _instance = this.CheckSingleton(_instance);
 }
Esempio n. 21
0
    public void OnGrowthStageChanged(int newStage)
    {
        Juicer.CreateFx(0, transform.position);
        switch ((GrowthStage)newStage)
        {
        case GrowthStage.Egg:
            ImpulseMover.GoHomeHack();
            PhoenixStage.SetActive(false);
            EggStage.SetActive(true);
            MessageController.AddMessage("ah, an egg..");
            MessageController.AddMessage("i wonder how it likes being poked");
            break;

        case GrowthStage.Hatching:
            StartCoroutine(Hatch());
            break;

        case GrowthStage.Baby:
            EggStage.SetActive(false);
            BabyStage.SetActive(true);
            break;

        case GrowthStage.Juvi:
            MusicBox.ChangeMusic(Song.Boss.ToInt());
            BabyStage.SetActive(false);
            JuviStage.SetActive(true);
            var petType = CalculatePetType();
            switch (petType)
            {
            case PetType.Cute:
                JuviCuteStage.SetActive(true);
                MessageController.AddMessage("aw, it grew into a cute one!");
                break;

            case PetType.Chubby:
                JuviChubbyStage.SetActive(true);
                MessageController.AddMessage("heh, it grew into a chubby one!");
                break;

            case PetType.Tough:
                JuviToughStage.SetActive(true);
                MessageController.AddMessage("oo, it grew into a tough one!");
                break;
            }
            break;

        case GrowthStage.Dead:
            EggStage.SetActive(false);
            BabyStage.SetActive(false);
            JuviStage.SetActive(false);
            JuviCuteStage.SetActive(false);
            JuviChubbyStage.SetActive(false);
            JuviToughStage.SetActive(false);
            DeadStage.SetActive(true);
            break;

        case GrowthStage.Pheonix:
            DeadStage.SetActive(false);
            PhoenixStage.SetActive(true);
            break;
        }
    }
Esempio n. 22
0
 public void OnEnter()
 {
     Juicer.ShakeCamera(0.5f);
 }