public override async Task <bool> Take() { await TextArea.PrintLine(); await TextArea.PrintLine(); if (fortressActivator.CompendiumAttacking) { await TextArea.PrintLine("You can't hold it."); } else { await TextArea.PrintLine("You grab the compendium."); SoundMan.PlaySound(LotaSound.VeryGood); await GameControl.WaitAsync(500); await TextArea.FlashLinesWhile(new CountdownTimer(2500).StillRunning, XleColor.Yellow, XleColor.Cyan, 50); Enabled = false; CloseExit(GameState); fortressActivator.CreateWarlord(); } return(true); }
public override async Task Execute() { SoundMan.PlaySound(LotaSound.Xamine); await GameControl.WaitAsync(500); await TextArea.PrintLine("\n"); await PrintDungeonLevel(); DungeonMonster foundMonster = FirstVisibleMonster(Player.Location, Player.FaceDirection, Player.DungeonLevel); int monsterDistance = RevealDistance(foundMonster); bool revealHidden = RevealTrapsUpTo(monsterDistance); if (revealHidden) { XamineFormatter.PrintHiddenObjectsDetected(); SoundMan.PlaySound(LotaSound.XamineDetected); } if (foundMonster != null) { PrintExamineMonsterMessage(foundMonster); } else { PrintExamineObjectMessage(); } }
protected async Task ApplyHealingEffect() { Player.HP += Player.MaxHP / 2; SoundMan.PlaySound(LotaSound.Good); await GameControl.FlashHPWhileSound(XleColor.Cyan); }
public override async Task PlayerCursorMovement(Direction dir) { Point stepDirection; string command; OnBeforePlayerMove(dir); _MoveDungeon(dir, ShowDirections(), out command, out stepDirection); if (stepDirection != Point.Zero) { if (CanPlayerStepIntoImpl(Player.X + stepDirection.X, Player.Y + stepDirection.Y) == false) { CommandTextForInvalidMovement(ref command); await TextArea.PrintLine(command); SoundMan.PlaySound(LotaSound.Bump); } else { await TextArea.PrintLine(command); PlayPlayerMoveSound(); await MovePlayer(stepDirection); } } else { // Turning in place await TextArea.PrintLine(command); PlayPlayerMoveSound(); } }
public async Task ExecuteMapChange() { try { await MapChanger.ChangeMap(TheEvent.MapID, TheEvent.TargetEntryPoint); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); SoundMan.PlaySound(LotaSound.Bad); await TextArea.Print("Failed to load ", XleColor.White); await TextArea.Print(GetMapName(), XleColor.Red); await TextArea.Print(".", XleColor.White); await TextArea.PrintLine(); await TextArea.PrintLine(); await GameControl.WaitAsync(1500); } }
private async Task PlayerDisembark(Direction dir) { Player.BoardedRaft = null; await Map.PlayerCursorMovement(dir); SoundMan.StopSound(LotaSound.Raft1); }
public override async Task PlayerCursorMovement(Direction dir) { string command; Point stepDirection; _Move2D(dir, "Move", out command, out stepDirection); if (await CanPlayerStep(stepDirection)) { await TextArea.PrintLine(command); await MovePlayer(stepDirection); SoundMan.PlaySound(LotaSound.WalkTown); Player.TimeQuality += 0.03; } else { SoundMan.PlaySound(LotaSound.Invalid); //Commands.CommandList.UpdateCommand("Move Nowhere"); await TextArea.PrintLine("Move nowhere"); } }
private async Task AskForTribute() { if (Player.HP >= Player.MaxHP) { await TextArea.PrintLine("We're not asking for tribute now."); return; } await TextArea.PrintLine("Please offer tribute."); var choice = await NumberPicker.ChooseNumber(Player.Gold); var max = (int)((Player.MaxHP - Player.HP) * 0.75 + 1); if (choice > max) { choice = max; await TextArea.PrintLine("I only want " + choice + " gold."); } int hp = choice * 4 / 3; Player.HP += hp; await TextArea.PrintLine(" HP + " + hp); SoundMan.PlaySound(LotaSound.Good); await TextArea.FlashLinesWhile(() => SoundMan.IsAnyPlaying(), XleColor.White, XleColor.LightGreen, 50, 4); }
public override async Task <bool> Speak() { SoundMan.PlaySound(LotaSound.VeryGood); TextArea.Clear(true); await TextArea.PrintLine(); await TextArea.PrintLine(" casandra the temptress", XleColor.Yellow); await TextArea.PrintLine(); await TextArea.FlashLinesWhile(() => SoundMan.IsPlaying(LotaSound.VeryGood), XleColor.Yellow, XleColor.Cyan, 250); if (Story.VisitedCasandra == false) { await OfferGoldOrCharm(); } else { await BegoneMessage(); } await GameControl.WaitAsync(5000); return(true); }
public override async Task <bool> Use(int item) { if (item != (int)LobItem.SingingCrystal) { return(false); } Rectangle area = new Rectangle(Player.X - 2, Player.Y - 3, 6, 8); RemoveRockSlide(area); if (area.Right >= TheEvent.Rectangle.Right - 3) { SoundMan.PlaySound(LotaSound.VeryBad); Player.Items[LobItem.SingingCrystal] = 0; await TextArea.PrintLine("Your singing crystal melts."); await TextArea.FlashLinesWhile(() => SoundMan.IsPlaying(LotaSound.VeryBad), XleColor.Yellow, XleColor.Red, 250); Story.ClearedRockSlide = true; } return(true); }
public override async Task BeforeStepOn() { if (givenMessage) { return; } if (Player.Items[LobItem.FalconFeather] == 0) { return; } givenMessage = true; TextArea.Clear(true); await TextArea.PrintLine(); await TextArea.PrintLine(" You see the prince on a dais!"); SoundMan.PlaySound(LotaSound.VeryGood); await TextArea.FlashLinesWhile(() => SoundMan.IsPlaying(LotaSound.VeryGood), XleColor.Yellow, XleColor.Cyan, 80, 1); TextArea.Clear(); }
protected async Task TeleportAnimation() { SoundMan.PlaySound(LotaSound.Teleporter); Stopwatch watch = new Stopwatch(); watch.Start(); await GameControl.WaitAsync(100); while (watch.ElapsedMilliseconds < 1800) { int index = ((int)watch.ElapsedMilliseconds % 80) / 50; if (index == 0) { Player.RenderColor = XleColor.Black; } else { Player.RenderColor = XleColor.White; } await GameControl.WaitAsync(1); } Player.RenderColor = XleColor.White; await GameControl.WaitAsync(200); }
private async Task<bool> KillGuard(Guard guard) { await TextArea.PrintLine(); await TextArea.PrintLine(); await TextArea.PrintLine("You surprise the guard and kill him."); SoundMan.PlaySound(LotaSound.EnemyDie); Map.Guards.Remove(guard); Map.Guards.IsAngry = true; await GameControl.WaitAsync(1500); await TextArea.PrintLine(); await TextArea.PrintLine("You find a rod on the body...", XleColor.Cyan); await GameControl.WaitAsync(1500); Map.RemoveJailBars(TheEvent.Rectangle, 21); await TextArea.PrintLine(); await TextArea.PrintLine("It unlocks the door.", XleColor.Yellow); await GameControl.PlaySoundWait(LotaSound.VeryGood); await TextArea.PrintLine(); await TextArea.PrintLine("You find a broadaxe.", XleColor.White); await GameControl.PlaySoundWait(LotaSound.VeryGood); Player.AddWeapon(7, 3); if (Player.CurrentWeapon.ID == 0) Player.CurrentWeapon = Player.Weapons.Last(); Enabled = false; return true; }
protected override async Task <bool> OnStepOnImpl() { string newMapName = GetMapName(); await TextArea.PrintLine(); await TextArea.PrintLine("Enter " + newMapName + "?"); SoundMan.PlaySound(LotaSound.Question); int choice = await QuickMenu.QuickMenu(new MenuItemList("Yes", "No"), 3); if (choice == 1) { return(false); } else if (string.IsNullOrEmpty(TheEvent.CommandText) == false) { await TextArea.PrintLine(); await TextArea.PrintLine( string.Format(TheEvent.CommandText, Map.MapName, newMapName)); await TextArea.PrintLine(); await GameControl.WaitAsync(500); } await ExecuteMapChange(); return(true); }
protected override async Task <bool> OnStepOnImpl() { await TextArea.PrintLine(); if (Player.Items[LobItem.RopeAndPulley] == 0) { await TextArea.PrintLine("You're not equipped"); await TextArea.PrintLine("to storm the citadel."); SoundMan.PlaySound(LotaSound.Bad); } else { await TextArea.PrintLine("The drawbridge is up."); await TextArea.PrintLine("You may wish to lower it."); SoundMan.PlaySound(LotaSound.Question); } await GameControl.WaitAsync(1000); return(true); }
public override async Task <bool> Speak() { SoundMan.PlaySound(LotaSound.VeryGood); TextArea.Clear(true); await TextArea.PrintLine(); await TextArea.PrintLine(" Meet the wizard of potions!!", XleColor.Cyan); await TextArea.PrintLine(); await TextArea.FlashLinesWhile(() => SoundMan.IsPlaying(LotaSound.VeryGood), XleColor.Green, XleColor.Cyan, 250); if (Story.BoughtPotion) { await BegoneMessage(); } else { await OfferPotion(); } await GameControl.WaitAsync(5000); return(true); }
private async Task StartEncounter() { currentMonst.Clear(); IsMonsterFriendly = false; int type = Random.Next(0, 15); SetMonsterImagePosition(); if (type < 10) { EncounterState = EncounterState.UnknownCreatureApproaching; SoundMan.PlaySound(LotaSound.Encounter); await TextArea.PrintLine(); await TextArea.PrintLine("An unknown creature is approaching ", XleColor.Cyan); await TextArea.PrintLine("from the " + monstDir.ToString() + ".", XleColor.Cyan); await GameControl.WaitAsync(1000); } else if (type < 15) { EncounterState = EncounterState.CreatureAppearing; //GameControl.Wait(1000); } }
private async Task Introduction(GameState unused) { await TextArea.PrintLineSlow("Ah, it is a pleasure to at last be"); await TextArea.PrintLineSlow("free from these vile and troublesome"); await TextArea.PrintLineSlow("orc guards. One good turn deserves"); await TextArea.PrintLineSlow("another."); await TextArea.PrintLineSlow(); await GameControl.WaitForKey(); TextArea.Clear(true); await TextArea.PrintLine(); await TextArea.PrintLine(); await TextArea.PrintLine("I promote you to apprentice."); await TextArea.PrintLine(); SoundMan.PlaySound(LotaSound.VeryGood); await TextArea.FlashLinesWhile(() => SoundMan.IsPlaying(LotaSound.VeryGood), XleColor.White, XleColor.Red, 250); await TextArea.PrintLineSlow("(Admittedly, it's not much, but"); await TextArea.PrintLineSlow("far better than being a serf.)"); await TextArea.PrintLineSlow(); SoundMan.PlaySound(LotaSound.Good); await TextArea.PrintLineSlow("Charisma: +5"); Player.Attribute[Attributes.charm] += 5; Player.Level = 2; await TextArea.PrintLineSlow(); await GameControl.WaitForKey(); if (AllOrcsKilled(GameState)) { await GiveGoldKey(GameState); } else { await TextArea.PrintLineSlow("Please get rid of the rest of these"); await TextArea.PrintLineSlow("orcs. If you don't, they'll only"); await TextArea.PrintLineSlow("come back."); await TextArea.PrintLineSlow(); } await GameControl.WaitForKey(); }
public virtual async Task GuardAttackPlayer(Guard guard) { await TextArea.PrintLine(); await TextArea.Print("Attacked by " + guard.Name + "! -- ", XleColor.White); if (Random.NextDouble() > ChanceToHitPlayer(guard)) { await TextArea.Print("Missed", XleColor.Cyan); SoundMan.PlaySound(LotaSound.EnemyMiss); } else { int dam = RollDamageToPlayer(guard); await TextArea.Print("Blow ", XleColor.Yellow); await TextArea.Print(dam.ToString(), XleColor.White); await TextArea.Print(" H.P.", XleColor.White); SoundMan.PlaySound(LotaSound.EnemyHit); Player.HP -= dam; } await TextArea.PrintLine(); await GameControl.WaitAsync(100 *Player.Gamespeed); }
private async Task MoveWarlord(Guard warlord, int dx, int dy) { warlord.X += dx; warlord.Y += dy; warlord.Facing = new Point(dx, dy).ToDirection(); SoundMan.PlaySound(LotaSound.WalkOutside); await GameControl.WaitAsync(750); }
override public void Notify(float xCurs, float yCurs) { if (ColRect.Intersect(this.pFont.pFontSprite.pColRect, new ColRect(xCurs, yCurs, 1, 1))) { SceneContext.SetState(SceneContext.Scene.HighScore); SceneContext.GetState().Initialize(); SoundMan.PlaySound(Sound.Name.Shoot); } }
public override async Task Execute() { await TextArea.PrintLine(); await TextArea.PrintLine(); int distance = 0; int maxDistance = 1; if (Player.CurrentWeapon.Info(Data).Ranged) { maxDistance = 5; } DungeonMonster monst = MonsterInFrontOfPlayer(Player, ref distance); if (monst == null) { await TextArea.PrintLine("Nothing to fight."); return; } else if (distance > maxDistance) { await TextArea.PrintLine("The " + monst.Name + " is out-of-range"); await TextArea.PrintLine("of your " + Player.CurrentWeapon.BaseName(Data) + "."); return; } bool hit = RollToHitMonster(monst); await TextArea.Print("Hit "); await TextArea.Print(monst.Name, XleColor.White); await TextArea.PrintLine(" with " + Player.CurrentWeapon.BaseName(Data)); if (hit) { int damage = RollDamageToMonster(monst); SoundMan.PlaySound(LotaSound.PlayerHit); await HitMonster(monst, damage, XleColor.Cyan); } else { SoundMan.PlaySound(LotaSound.PlayerMiss); await TextArea.PrintLine("Your attack misses."); await GameControl.WaitAsync(500); } return; }
private async Task Puzzle() { await TextArea.PrintLine("I've prepared a test."); await TextArea.PrintLine(); bool valid = true; await TextArea.PrintLineSlow("Would you rather rescue a beautiful"); await TextArea.PrintLineSlow("princess or a elven baby?\n"); int choice = await QuickMenu.QuickMenu(new MenuItemList("Princess", "Baby"), 2); valid &= (choice == 1); await TextArea.PrintLineSlow("Would you rather slay a marauding"); await TextArea.PrintLineSlow("dragon or an incompetent baron?\n"); choice = await QuickMenu.QuickMenu(new MenuItemList("Dragon", "Baron"), 2); valid &= (choice == 1); await TextArea.PrintLineSlow("Would you rather give money to"); await TextArea.PrintLineSlow("a hungry thief or a thirsty drunk?\n"); choice = await QuickMenu.QuickMenu(new MenuItemList("Thief", "Drunk"), 2); valid &= (choice == 0); if (valid == false) { await TextArea.PrintLineSlow("I'm sorry, you suck."); return; } SoundMan.PlaySound(LotaSound.VeryGood); TextArea.Clear(); await TextArea.PrintLineSlow("You have passed the test!\n"); await TextArea.PrintLineSlow("A princess has many saviors, \na baby has none.\n"); await TextArea.PrintLineSlow("The foibles of a dragon hurt few, \nunlike the failures of a baron.\n"); await TextArea.PrintLineSlow("A hungry thief has stopped stealing,\nunlike a thirsty drunk.\n"); await TextArea.PrintLineSlow("I have happened across this signet ring. I "); await TextArea.PrintLineSlow("believe it will help you.\n"); Player.Items[LobItem.SignetRing]++; Story.ElfSolvedPuzzle = true; }
public override void ShootMissile(ShipLeaf Ship) { ShipMan.InitializeBullet(); SoundMan.Play(SoundName.Shoot); // switch states Handle(Ship); }
public async Task OfferMuseumCoin() { int coin = -1; MenuItemList menu = new MenuItemList("Yes", "No"); coin = NextMuseumCoinOffer(); if (coin == -1) { return; } int amount = 50 + (int)(Random.NextDouble() * 20 * Player.Level); if (amount > Player.Gold) { amount /= 2; } SoundMan.PlaySound(LotaSound.Question); await TextArea.PrintLine("Would you like to buy a "); await GameControl.WaitAsync(1); await TextArea.PrintLine("museum coin for " + amount.ToString() + " gold?"); await GameControl.WaitAsync(1); await TextArea.PrintLine(); await GameControl.WaitAsync(1); int choice = await QuickMenu.QuickMenu(menu, 3, 0); if (choice == 0) { if (Player.Spend(amount)) { string coinName = Data.ItemList[coin].Name; await TextArea.PrintLine("Use this " + coinName + " well!"); Player.Items[coin] += 1; SoundMan.PlaySound(LotaSound.Sale); } else { await TextArea.PrintLine("Not enough gold."); SoundMan.PlaySound(LotaSound.Medium); } } }
private async Task AttackGuard(Guard guard, int distance) { if (guard.OnPlayerAttack != null) { bool cancel = await guard.OnPlayerAttack(GameState, guard); if (cancel) { return; } } double hitChance = ChanceToHitGuard(guard, distance); if (Random.NextDouble() > hitChance) { await TextArea.PrintLine("Attack on " + guard.Name + " missed", XleColor.Purple); SoundMan.PlaySound(LotaSound.PlayerMiss); } else { int dam = RollDamageToGuard(guard); IsAngry = true; Player.LastAttackedMapID = TheMap.MapID; await TextArea.Print(guard.Name + " struck ", XleColor.Yellow); await TextArea.Print(dam.ToString(), XleColor.White); await TextArea.Print(" H.P. Blow", XleColor.White); await TextArea.PrintLine(); guard.HP -= dam; SoundMan.PlaySound(LotaSound.PlayerHit); if (guard.HP <= 0) { await TextArea.PrintLine(guard.Name + " killed"); TheMap.Guards.Remove(guard); await GameControl.WaitAsync(100); SoundMan.StopSound(LotaSound.PlayerHit); SoundMan.PlaySound(LotaSound.EnemyDie); await(guard.OnGuardDead?.Invoke(GameState, guard) ?? Task.FromResult(false)); } } }
public override async Task <bool> Open() { UpdateCommand(); await TextArea.PrintLine(); if (TheEvent.Closed == false) { await PrintAlreadyOpenMessage(); return(true); } PlayOpenChestSound(); await GameControl.WaitAsync(GameState.GameSpeed.CastleOpenChestSoundTime); SetOpenTilesOnMap(); if (MakesGuardsAngry) { SetAngry(); } if (TheEvent.ContainsItem) { int count = 1; int item = TheEvent.Contents; BeforeGiveItem(ref item, ref count); GameState.Player.Items[item] += count; await PrintObtainItemMessage(item, count); PlayObtainItemSound(item, count); } else { int gd = TheEvent.Contents; await TextArea.PrintLine(string.Format("You find {0} gold.", gd)); GameState.Player.Gold += gd; SoundMan.PlaySound(LotaSound.Sale); } TheEvent.Closed = false; await GameControl.WaitAsync(GameState.GameSpeed.CastleOpenChestTime); MarkChestAsOpen(); return(true); }
void Awake() { if (_instance) { return; } _instance = this; Object.DontDestroyOnLoad(gameObject); // gameObject.transform.position = new Vector3(0, 0, -10); }
private async Task OpenChest(int val) { await TextArea.PrintLine(" Chest"); await TextArea.PrintLine(); SoundMan.PlaySound(LotaSound.OpenChest); await GameControl.WaitAsync(GameState.GameSpeed.DungeonOpenChestSoundTime); await GiveChestContents(val); }
public virtual async Task PlayerIsDead() { await TextArea.PrintLine(); await TextArea.PrintLine(); await TextArea.PrintLine(" You died!"); await TextArea.PrintLine(); await TextArea.PrintLine(); SoundMan.PlaySound(LotaSound.VeryBad); await GameControl.FlashHPWhileSound(XleColor.Red, XleColor.Yellow); await LoadOutsideMap(); IOutsideExtender extender = (IOutsideExtender)GameState.MapExtender; Outside map = (Outside)extender.TheMap; extender.CancelEncounter(); TerrainType t; do { Player.X = Random.Next(Map.Width); Player.Y = Random.Next(Map.Height); t = map.TerrainAt(Player.X, Player.Y); } while (t != TerrainType.Grass && t != TerrainType.Forest); Player.Rafts.Clear(); Player.HP = Player.MaxHP; Player.Food = 30 + Random.Next(10); Player.Gold = 25 + Random.Next(30); Player.BoardedRaft = null; Player.LastAttackedMapID = 0; while (SoundMan.IsPlaying(LotaSound.VeryBad)) { await GameControl.WaitAsync(40); } await TextArea.PrintLine("The powers of the museum"); await TextArea.PrintLine("resurrect you from the grave!"); await TextArea.PrintLine(); await GameControl.PlaySoundWait(LotaSound.VeryGood); }
// Use this for initialization void OnEnable () { main = this; source = GetComponent<AudioSource> (); }
// Use this for initialization void Start() { uiManager = GetComponent<UIMan>(); soundManager = GetComponent<SoundMan>(); speedFactor = 0; Meter = 0; HighScore = PlayerPrefs.GetInt("HighScore"); liveObstacles = new List<GameObject>(); # if UNITY_STANDALONE InputManager = (InputMan)gameObject.AddComponent<PCInputMan>(); #elif UNITY_ANDROID InputManager = (InputMan)gameObject.AddComponent<AndroidInputMan>(); #endif //InputManager.enabled = false; }