Esempio n. 1
0
	public virtual void EndGame()
	{
		Debug.Log("2");
		if(minigameState == MinigameState.active)
		{
			Debug.Log("3");
			//PlayerManager.Instance.GiveRewards(score, npcMinigame.Loots);
			minigameState = MinigameState.ended;
			StartCoroutine(EndGameSequence());
		}
	}
Esempio n. 2
0
File: Frosty.cs Progetto: Mej0/a
        private async Task MinefieldSurvival()
        {
            this.minigameState = MinigameState.Supported;
            var mines = EntityManager <Entity> .Entities.Where(x => x.Name == "techies_game_remote_mine");

            var avoid = new List <Vector3>();

            foreach (var entity in mines)
            {
                avoid.Add(entity.Position);
            }
        }
Esempio n. 3
0
        private void ChangeCanvas(MinigameState toCanvas, int victorID = -1)
        {
            switch (toCanvas)
            {
            case (MinigameState.Intro):

                // Deactivate
                DeactivateAllCanvas();

                // Activate
                introControl.gameObject.SetActive(true);
                introControl.PlayIntro();

                break;

            case (MinigameState.Selection):

                // Deactivate
                DeactivateAllCanvas();


                // Activate
                selectionControl.gameObject.SetActive(true);
                selectionControl.Display();

                break;

            case (MinigameState.Gameplay):

                // Deactivate
                DeactivateAllCanvas();

                // Activate
                gameControl.gameObject.SetActive(true);
                gameControl.StartGameplay();

                break;

            case (MinigameState.EndBattle):

                // Deactivate
                DeactivateAllCanvas();

                // Activate
                endControl.gameObject.SetActive(true);
                endControl.StartEndingCutscene(victorID);

                break;
            }
        }
Esempio n. 4
0
        private void StartEndBattleSequence(int victorID)
        {
            // Deactivate Pause Menu
            PauseCanvas.SetActive(false);

            // Change To End Song
            levelMusic.PlayEndMusic();


            // Change State
            currentState = MinigameState.EndBattle;

            ChangeCanvas(currentState, victorID);
        }
Esempio n. 5
0
File: Frosty.cs Progetto: Mej0/a
        private async Task SurviveTheWinter()
        {
            this.minigameState = MinigameState.PartialSupported;

            // var rune = EntityManager<Rune>.Entities.FirstOrDefault(x => x.Distance2D(this.hero) < 175f);
            // if (rune != null)
            // {
            // this.hero.PickUpRune(rune);
            // }
            var item = EntityManager <PhysicalItem> .Entities.FirstOrDefault(x => x.Distance2D(this.hero) < 175f);

            if (item != null)
            {
                this.hero.PickUpItem(item);
            }
        }
Esempio n. 6
0
        public void StartSelectionSequence()
        {
            // Define current state
            currentState = MinigameState.Selection;

            // Continue previous Muisic

            // Deactivate Player Controllers
            ConfigFighterControllers(false);

            // Deactivate Pause Menu
            PauseCanvas.SetActive(false);

            // Config Canvas
            ChangeCanvas(currentState);
        } // Public
Esempio n. 7
0
File: Frosty.cs Progetto: Mej0/a
        private async Task RedLightGreenLight()
        {
            this.minigameState = MinigameState.Supported;

            if (this.hero.HasModifier("modifier_rupture_damage"))
            {
                this.hero.Stop();
                return;
            }

            if (this.hero.Spellbook.Spell1.Cooldown <= 0)
            {
                this.hero.Spellbook.Spell1.UseAbility();
            }

            this.hero.Move(this.hero.Position + new Vector3(250, 0, 0));
        }
Esempio n. 8
0
        private void StartIntroSequence()
        {
            // Define current state
            currentState = MinigameState.Intro;

            // Change music - Intro music
            levelMusic.IntroMusic();

            // Deactivate Player Controllers
            ConfigFighterControllers(false);

            // Deactivate Pause Menu
            PauseCanvas.SetActive(false);

            // Config Canvas
            ChangeCanvas(currentState);
        }
Esempio n. 9
0
        } // Public

        private void StartNewRoundSequence()
        {
            // Change music - Start music
            levelMusic.PlayStandardMusic();

            // Recover full Health & Position
            ResetAllFightersStats();

            // Activate Player Controllers
            ConfigFighterControllers(true);

            //Update Round Counter & Update UI
            roundID += 1;

            // UI Update
            UpdateRoundDisplay();

            //Update Background
            UpdateBackground();

            // Change State
            currentState = MinigameState.Gameplay;
        }
Esempio n. 10
0
 public IterationProgress updateMinigameState(MinigameType type, MinigameState state)
 {
     minigames.Add(type, state);
     return(withMinigames(minigames));
 }
Esempio n. 11
0
        public override void Update(GameTime gameTime)
        {
            timer       += gameTime.ElapsedGameTime.TotalMilliseconds;
            rSpawnTimer += gameTime.ElapsedGameTime.TotalMilliseconds;
            spawnTimer  += gameTime.ElapsedGameTime.TotalMilliseconds;
            float dt = (float)gameTime.ElapsedGameTime.TotalMilliseconds;
            float dv = 0.0004f;

            water.Update(gameTime);
            Tile.Update(gameTime);
            player.Update(gameTime);
            float bossFightTimer = (float)(timer - (124000 + 4 / dv + 64));

            if (player.Health <= 0)
            {
                GameManager.GetInstance().ChangeScreen(ScreenState.MENU);
            }

            int t = (int)(2 / dv + 16);
            int rSpawnTimerThresh = (state.Equals(MinigameState.BOSS)) ? 300 : 200;

            if (timer > 8000 && rSpawnTimer > rSpawnTimerThresh && boss.Health > 0)
            {
                rSpawnTimer = 0;
                if (!state.Equals(MinigameState.BOSS))
                {
                    SpawnRandom(350);
                }
                Color            c  = (state.Equals(MinigameState.BOSS)) ? Color.Red : Color.Transparent;
                RandomProjectile p  = GenerateProjectile(game.Width / 5, 0, 10, c);
                RandomProjectile p2 = GenerateProjectile(game.Width / 5 * 2, 0, 10, c);
                RandomProjectile p3 = GenerateProjectile(game.Width / 5 * 3, 0, 10, c);
                RandomProjectile p4 = GenerateProjectile(game.Width / 5 * 4, 0, 10, c);

                projectiles.Add(p);
                projectiles.Add(p2);
                projectiles.Add(p3);
                projectiles.Add(p4);
            }

            int initialCount = projectiles.Count;

            for (int i = 0; i < projectiles.Count; i++)
            {
                projectiles[i].Update(gameTime);
                i += Math.Max(Math.Min(0, projectiles.Count - initialCount), 0);
                if (projectiles[Math.Min(i, projectiles.Count - 1)].TTL <= 0)
                {
                    projectiles.RemoveAt(i--);
                }
                i += Math.Max(Math.Min(0, projectiles.Count - initialCount), 0);
            }

            if (timer < 8000)
            {
                state = MinigameState.BEGIN;
            }
            else if (timer > 8000 && timer < 14000)
            {
                state = MinigameState.KEYNESIAN_CROSS;
                if (spawnTimer > 200)
                {
                    spawnTimer = 0;
                    projectiles.Add(new FortyFiveProjectile(blank, new Rectangle(
                                                                0, game.Height, 10, 10), 9000));
                    projectiles.Add(new KeynesianCross(blank, new Rectangle(
                                                           0, game.Height / 3 * 2, 10, 10), 9000));
                }
            }
            else if (timer > 15000 && timer < 28500)
            {
                state = MinigameState.AGGREGATE_DEMAND_SUPPLY;
                if (spawnTimer > 200)
                {
                    spawnTimer = 0;
                    projectiles.Add(new LRASProjectile(blank, new Rectangle(
                                                           game.Width / 2, 0, 10, 10), 5000));
                    projectiles.Add(new ASProjectile(blank, new Rectangle(
                                                         0, game.Height * 3 / 4, 10, 10), 10000));
                    projectiles.Add(new ADProjectile(blank, new Rectangle(
                                                         game.Width, game.Height * 3 / 4, 10, 10), 10000));
                }
            }
            else if (timer > 32000 && timer < 46500)
            {
                state = MinigameState.BUSINESS_CYCLE;
                if (spawnTimer > 200)
                {
                    spawnTimer = 0;
                    projectiles.Add(new BusinessCycleProjectile(blank, new Rectangle(
                                                                    0, game.Height / 4 * 3, 10, 10), 10000));
                }
            }
            else if (timer > 50000 && timer < 62000)
            {
                state = MinigameState.PHILLIPS;

                if (spawnTimer > 200)
                {
                    spawnTimer = 0;
                    projectiles.Add(new PhillipsProjectile(blank, new Rectangle(50, 0, 10, 10), 18000));
                }
            }
            else if (timer > 64000 && timer < 78000)
            {
                state = MinigameState.SUPPLY_DEMAND;

                if (spawnTimer > 200)
                {
                    spawnTimer = 0;
                    projectiles.Add(new ASProjectile(blank, new Rectangle(
                                                         0, game.Height * 3 / 4, 10, 10), 10000));
                    projectiles.Add(new ADProjectile(blank, new Rectangle(
                                                         game.Width, game.Height * 3 / 4, 10, 10), 10000));
                }
            }
            else if (timer > 82000 && timer < 88500)
            {
                state = MinigameState.RECESSION_DEPRESSION;

                if (spawnTimer > 200)
                {
                    spawnTimer = 0;
                    // recession/depression
                    projectiles.Add(new LRASProjectile(blank, new Rectangle(
                                                           game.Width / 2, 0, 10, 10), 5000));
                    projectiles.Add(new ASProjectile(blank, new Rectangle(
                                                         0, game.Height * 3 / 4, 10, 10), 10000));
                    projectiles.Add(new ADProjectile(blank, new Rectangle(
                                                         game.Width, game.Height * 3 / 4, 10, 10), 10000));
                    projectiles.Add(new ADProjectile(blank, new Rectangle(
                                                         game.Width - 300, game.Height * 3 / 4 + 300, 10, 10), 10000));
                }
            }
            else if (timer >= 88500 && timer < 96000)
            {
                state = MinigameState.INFLATION;

                if (spawnTimer > 200)
                {
                    spawnTimer = 0;
                    projectiles.Add(new LRASProjectile(blank, new Rectangle(
                                                           game.Width / 2, 0, 10, 10), 5000));
                    projectiles.Add(new ASProjectile(blank, new Rectangle(
                                                         0, game.Height * 3 / 4, 10, 10), 10000));
                    projectiles.Add(new ADProjectile(blank, new Rectangle(
                                                         game.Width, game.Height * 3 / 4, 10, 10), 10000));
                    projectiles.Add(new ADProjectile(blank, new Rectangle(
                                                         game.Width + 200, game.Height * 3 / 4 - 100, 10, 10), 10000));
                }
            }
            else if (timer >= 96000 && timer < 103000)
            {
                state = MinigameState.STAGFLATION;
                if (spawnTimer > 200)
                {
                    spawnTimer = 0;
                    projectiles.Add(new LRASProjectile(blank, new Rectangle(
                                                           game.Width / 2, 0, 10, 10), 5000));
                    projectiles.Add(new ASProjectile(blank, new Rectangle(
                                                         0, game.Height * 3 / 4, 10, 10), 10000));
                    projectiles.Add(new ASProjectile(blank, new Rectangle(
                                                         -200, game.Height * 3 / 4 - 200, 10, 10), 10000));
                    projectiles.Add(new ADProjectile(blank, new Rectangle(
                                                         game.Width, game.Height * 3 / 4, 10, 10), 10000));
                }
            }
            else if (timer > 103000 && timer < 112000)
            {
                state = MinigameState.ECONOMIC_BOOM;
                if (spawnTimer > 200)
                {
                    spawnTimer = 0;
                    projectiles.Add(new LRASProjectile(blank, new Rectangle(
                                                           game.Width / 2, 0, 10, 10), 5000));
                    projectiles.Add(new ASProjectile(blank, new Rectangle(
                                                         0, game.Height * 3 / 4, 10, 10), 10000));
                    projectiles.Add(new ASProjectile(blank, new Rectangle(
                                                         200, game.Height * 3 / 4 + 200, 10, 10), 10000));
                    projectiles.Add(new ADProjectile(blank, new Rectangle(
                                                         game.Width, game.Height * 3 / 4, 10, 10), 10000));
                }
            }
            else if (timer > 114000 && timer < 124000)
            {
                if (spawnTimer > 70)
                {
                    spawnTimer = 0;
                    projectiles.Add(new LafferProjectile(blank, new Rectangle(0, game.Height, 10, 10), 10000));
                }
                state = MinigameState.LAFFERS_CURVE;
            }
            else if (timer > 124000 && timer < 124000 + t)
            {
                state = MinigameState.NONE;
                MediaPlayer.Volume = Math.Max(MediaPlayer.Volume - dv * dt, 0);
                //GameManager.GetInstance().ChangeScreen(ScreenState.MENU);
            }
            else if (timer > 124000 + t && timer < 124000 + 2 * t)
            {
                if (!isPlayFlag)
                {
                    isPlayFlag = true;
                    MediaPlayer.Play(background2);
                }
                MediaPlayer.Volume = Math.Min(MediaPlayer.Volume + dv * dt, 1);
            }
            else if (timer > 124000 + 4 / dv + 64 && boss.Health > 0)
            {
                state = MinigameState.BOSS;
                boss.Update(gameTime);
                songName = "Spear of Justice! - Undertale";
            }
            else
            {
                state = MinigameState.NONE;
            }

            if (boss.Health <= 0)
            {
                endTimer += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
                state     = MinigameState.END;

                if (endTimer > 10000)
                {
                    GameManager.GetInstance().ChangeScreen(ScreenState.MENU);
                }
            }
        }
 private void SetState(MinigameState state)
 {
     CurrentState = state;
     if (StateChanged != null)
         StateChanged(CurrentState);
 }
Esempio n. 13
0
File: Frosty.cs Progetto: Mej0/a
        private async Task MainLoop(CancellationToken token)
        {
            foreach (var obj in ObjectManager.LocalPlayer.Selection.OfType <Unit>())
            {
                Log.Debug($"Obj: {obj.Name} | {obj.Team} | {obj.Animation.Name} | {obj.MoveCapability}");
                foreach (var modifier in obj.Modifiers)
                {
                    Log.Debug($"\t{modifier.Name} | {modifier.TextureName}");
                }

                foreach (var spellbookSpell in obj.Spellbook.Spells)
                {
                    Log.Debug($"\t\t{spellbookSpell.Name} | {spellbookSpell.AbilitySlot}");
                }
            }

            var query = ObjectManager.LocalPlayer.QueryUnit as Unit;

            if (query != null)
            {
                Log.Debug($"query: {query.Name} | {query.Team} | {query.Animation.Name}");
                foreach (var modifier in query.Modifiers)
                {
                    Log.Debug($"\t{modifier.Name} | {modifier.TextureName}");
                }
            }

            this.minigameState = MinigameState.Unknown;

            this.hero = ObjectManager.LocalHero;
            if (this.hero == null || !this.hero.IsAlive)
            {
                Log.Debug($"{Game.MousePosition}");

                await Task.Delay(250, token);

                return;
            }

            Log.Debug($"{Game.MousePosition} - {this.hero.Position} -> {Game.MousePosition.Distance(this.hero.Position)}");

            this.minigameState = MinigameState.Unsupported;

            // https://dota2.gamepedia.com/Frostivus_2017
            var heroId = this.hero.HeroId;

            switch (heroId)
            {
            case HeroId.npc_dota_hero_weaver:
                await this.RedLightGreenLight();

                break;

            case HeroId.npc_dota_hero_invoker:
                if (this.hero.HasModifier("modifier_invoked_spell_to_cast"))
                {
                    await this.FollowTheLeader();
                }

                break;

            case HeroId.npc_dota_hero_queenofpain:
                if (this.hero.HasModifier("modifier_weather_snowstorm"))
                {
                    await this.SurviveTheWinter();
                }

                break;

            case HeroId.npc_dota_hero_spirit_breaker:
                break;

            case HeroId.npc_dota_hero_techies:
                if (this.hero.Spellbook.VisibleCount == 0)
                {
                    await this.MinefieldSurvival();
                }

                break;

            case HeroId.npc_dota_hero_mirana:
                await this.ArrowPractice();

                break;

            default:
                this.minigameState = MinigameState.Unsupported;
                break;
            }

            await Task.Delay(250, token);
        }
Esempio n. 14
0
        public CustomBobberBar(
            IModHelper helper,
            FishConfig fishConfig,
            TreasureConfig treasureConfig,
            FishingInfo fishingInfo,
            FishEntry fishEntry,
            FishTraits fishTraits,
            Item fishItem,
            float fishSizePercent,
            bool treasure,
            int bobber,
            bool fromFishPond
            )
            : base(0, fishSizePercent, treasure, bobber)
        {
            _ = helper ?? throw new ArgumentNullException(nameof(helper));
            this.fishConfig     = fishConfig ?? throw new ArgumentNullException(nameof(fishConfig));
            this.treasureConfig =
                treasureConfig ?? throw new ArgumentNullException(nameof(treasureConfig));
            this.fishingInfo = fishingInfo ?? throw new ArgumentNullException(nameof(fishingInfo));
            this.fishEntry   = fishEntry;
            this.fishTraits  = fishTraits ?? throw new ArgumentNullException(nameof(fishTraits));
            this.fishItem    = fishItem ?? throw new ArgumentNullException(nameof(fishItem));

            this.treasureField         = helper.Reflection.GetField <bool>(this, "treasure");
            this.treasureCaughtField   = helper.Reflection.GetField <bool>(this, "treasureCaught");
            this.treasurePositionField =
                helper.Reflection.GetField <float>(this, "treasurePosition");
            this.treasureAppearTimerField =
                helper.Reflection.GetField <float>(this, "treasureAppearTimer");
            this.treasureScaleField = helper.Reflection.GetField <float>(this, "treasureScale");

            this.distanceFromCatchingField =
                helper.Reflection.GetField <float>(this, "distanceFromCatching");
            this.treasureCatchLevelField =
                helper.Reflection.GetField <float>(this, "treasureCatchLevel");

            this.bobberBarPosField    = helper.Reflection.GetField <float>(this, "bobberBarPos");
            this.bobberInBarField     = helper.Reflection.GetField <bool>(this, "bobberInBar");
            this.difficultyField      = helper.Reflection.GetField <float>(this, "difficulty");
            this.fishQualityField     = helper.Reflection.GetField <int>(this, "fishQuality");
            this.perfectField         = helper.Reflection.GetField <bool>(this, "perfect");
            this.scaleField           = helper.Reflection.GetField <float>(this, "scale");
            this.flipBubbleField      = helper.Reflection.GetField <bool>(this, "flipBubble");
            this.bobberBarHeightField = helper.Reflection.GetField <int>(this, "bobberBarHeight");
            this.reelRotationField    = helper.Reflection.GetField <float>(this, "reelRotation");
            this.bobberPositionField  = helper.Reflection.GetField <float>(this, "bobberPosition");
            this.bossFishField        = helper.Reflection.GetField <bool>(this, "bossFish");
            this.motionTypeField      = helper.Reflection.GetField <int>(this, "motionType");
            this.fishSizeField        = helper.Reflection.GetField <int>(this, "fishSize");
            this.minFishSizeField     = helper.Reflection.GetField <int>(this, "minFishSize");
            this.maxFishSizeField     = helper.Reflection.GetField <int>(this, "maxFishSize");
            this.fromFishPondField    = helper.Reflection.GetField <bool>(this, "fromFishPond");

            this.barShakeField        = helper.Reflection.GetField <Vector2>(this, "barShake");
            this.fishShakeField       = helper.Reflection.GetField <Vector2>(this, "fishShake");
            this.treasureShakeField   = helper.Reflection.GetField <Vector2>(this, "treasureShake");
            this.everythingShakeField =
                helper.Reflection.GetField <Vector2>(this, "everythingShake");
            this.fadeOutField = helper.Reflection.GetField <bool>(this, "fadeOut");

            this.sparkleTextField = helper.Reflection.GetField <SparklingText?>(this, "sparkleText");

            // Track state
            this.lastDistanceFromCatching = 0f;
            this.lastTreasureCatchLevel   = 0f;
            this.state = new(true, treasure ? TreasureState.NotCaught : TreasureState.None);

            // Track player streak
            this.perfectField.SetValue(true);
            var fishSizeReductionTimerField =
                helper.Reflection.GetField <int>(this, "fishSizeReductionTimer");

            fishSizeReductionTimerField.SetValue(800);

            // Fish size
            var minFishSize = fishTraits.MinSize;
            var maxFishSize = fishTraits.MaxSize;
            var fishSize    = (int)(minFishSize + (maxFishSize - minFishSize) * fishSizePercent) + 1;

            this.minFishSizeField.SetValue(minFishSize);
            this.maxFishSizeField.SetValue(maxFishSize);
            this.fishSizeField.SetValue(fishSize);

            // Track other information (not all tracked by vanilla)
            this.fromFishPondField.SetValue(fromFishPond);
            this.bossFishField.SetValue(fishTraits.IsLegendary);

            // Adjust quality to be increased by streak
            var fishQuality = fishSizePercent switch
            {
Esempio n. 15
0
 private void ChangeCurrentMinigameState(MinigameState newState)
 {
     currentState = newState;
 }
Esempio n. 16
0
	public void Awake()
	{
		minigameState = MinigameState.initialised;
		//npcMinigame = Storage.LoadById<NPCMinigame>( npcMinigameID, new NPCMinigame());
	}