/// <summary> /// If the result is empty, format the fragment of text describing the error. /// </summary> /// <returns>The error fragment.</returns> public string FormatErrorMessageFragment() { if (ErrorMessage != null) { return(ErrorMessage); } string message; if (Remainder.IsAtEnd) { message = "unexpected end of input"; } else { var next = Remainder.ConsumeToken().Value; var appearance = Presentation.FormatAppearance(next.Kind, next.ToStringValue()); message = $"unexpected {appearance}"; } if (Expectations != null) { var expected = Friendly.List(Expectations); message += $", expected {expected}"; } return(message); }
public static void Shop_Get_Items(Friendly _Merchant) { foreach (Item item in _Merchant.NPC_Inventory) { Item_Names.Add(item.Item_Name); } }
/// <summary> /// If the result is empty, format the fragment of text describing the error. /// </summary> /// <returns>The error fragment.</returns> public string FormatErrorMessageFragment() { if (ErrorMessage != null) { return(ErrorMessage); } string message; if (Location.IsAtEnd) { message = "unexpected end of input"; } else { var next = Location.ConsumeChar().Value; message = $"unexpected {Display.Presentation.FormatLiteral(next)}"; } if (Expectations != null) { var expected = Friendly.List(Expectations); message += $", expected {expected}"; } return(message); }
public static void Shop_Handler(Player _player, Friendly _Merchant, string sentence01, string sentence02) { Shop_Get_Items(_Merchant); string choice; List <string> Validinput = new List <string> { "Yes", "yes", "YES", "No", "no", "NO" }; do { Console.WriteLine("Do you want to see their wares?"); choice = Console.ReadLine(); } while (Validinput.Contains(choice) == false); if (choice == "Yes" || choice == "yes" || choice == "YES") { Shop_Show_Items(_player, _Merchant, sentence01, sentence02); } else if (choice == "NO" || choice == "No" || choice == "no") { } }
public static void Draw_Loading() { Console.ForegroundColor = ConsoleColor.DarkGray; Console.WriteLine("||| "); Thread.Sleep(200); Console.WriteLine("||| "); Thread.Sleep(200); Console.WriteLine("||| ||||| ||| ||||||||||||| 000 ||| ||| ||||||||||||| "); Thread.Sleep(200); Console.WriteLine("||| ||||| ||| ||| ||| | |||| ||| ||| "); Thread.Sleep(200); Console.WriteLine("||| ||| ||| ||| ||| ||| ||| ||| ||||| ||| ||| "); Thread.Sleep(200); Console.WriteLine("||| ||| ||| ||| ||| ||| ||| ||| ||| || ||| ||| "); Thread.Sleep(200); Console.WriteLine("||| ||| ||| ||| ||| ||| ||| ||| ||| || ||| ||| "); Thread.Sleep(200); Console.WriteLine("||| ||| ||| ||| ||| ||| ||| ||| ||| || ||| ||| ||||| "); Thread.Sleep(200); Console.WriteLine("||| ||| ||| ||| ||||||| ||| ||| ||| ||| ||| || ||| ||| ||| "); Thread.Sleep(200); Console.WriteLine("||| ||| ||| ||| ||| ||| ||| ||| ||| || ||| ||| ||| "); Thread.Sleep(200); Console.WriteLine("|||||||||| |||||| ||| ||| ||| ||| ||| ||| ||||| ||| ||| "); Thread.Sleep(200); Console.WriteLine("|||||||||| |||||| ||| ||| ||||||||||||| ||| ||| |||| |||||||||||| .................."); Console.ResetColor(); Item.Initialise_Items(); Friendly.Initialise_Friendlies(); Building.Initialise_Buildings(); Enemy.Initialise_Enemies(); Thread.Sleep(2500); }
private void RenderFriendliesAndZombie() { var zombie = SpaceTime.CurrentSpaceTime.Add(new Enemy() { Symbol = 'Z' }); new Bot(zombie, new List <IBotStrategy>() { new MoveTowardsEnemy() }); zombie.MoveTo(SpaceTime.CurrentSpaceTime.Width * .5f, SpaceTime.CurrentSpaceTime.Height * .5f); for (var x = SpaceTime.CurrentSpaceTime.Width * .05f; x < SpaceTime.CurrentSpaceTime.Width * .95f; x += 7) { for (var y = SpaceTime.CurrentSpaceTime.Height * .05f; y < SpaceTime.CurrentSpaceTime.Height * .95f; y += 7) { var friendly = new Friendly() { Symbol = RandomLetter(), }; new Bot(friendly, new List <IBotStrategy>() { new AvoidEnemies() }); friendly.MoveTo(x, y); SpaceTime.CurrentSpaceTime.Delay(() => SpaceTime.CurrentSpaceTime.Add(friendly), (int)(x + y)); } } }
/// <summary> /// If the result is empty, format the fragment of text describing the error. /// </summary> /// <returns>The error fragment.</returns> public string FormatErrorMessageFragment() { if (ErrorMessage != null) { return(ErrorMessage); } string message; if (Remainder.IsAtEnd) { message = "unexpected end of input"; } else { var next = Remainder.ConsumeChar().Value; message = $"unexpected `{next}`"; } if (Expectations != null) { var expected = Friendly.List(Expectations); message += $", expected {expected}"; } return(message); }
private void Shooting() { RaycastHit hit; laser.SetPosition(0, gunEnd.position); if (Physics.Raycast(gunEnd.transform.position, gunEnd.transform.forward, out hit, range)) { laser.SetPosition(1, hit.point); Player target = hit.transform.GetComponent <Player>(); Friendly target1 = hit.transform.GetComponent <Friendly>(); if (target != null) { target.TakeDamage(damage); } else if (target1 != null) { target1.TakeDamage(damage); } GameObject impactGO = Instantiate(particle, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(impactGO, 2f); } else { laser.SetPosition(1, gunEnd.transform.position + (gunEnd.transform.forward * range)); } }
public void FriendlyListsPreserveOrderButRemoveDuplicates() { var actual = Friendly.List(new[] { "one", "two", "two", "one", "three" }); const string expected = "one, two or three"; Assert.Equal(expected, actual); }
public BattleCharacter FriendCreate(int CreateIndex) //캐릭터 생성 { Friendly targetCharacter; targetCharacter = new Friendly(CreateIndex); return(targetCharacter); }
public void Apply_NotACharacter_Test() { var entity = Mock.Of <IEntity>(); var friendly = new Friendly(); friendly.Apply(entity); Assert.IsTrue(true); // If we made it here without exception then the test passed }
void Awake() { enemy1 = EnemyFactory.getEnemy(EnemyTypes.flying); enemy1 = EnemyFactory.getEnemy(EnemyTypes.walking); friendly1 = FriendlyFactory.getFriendly(FriendlyTypes.flying); friendly2 = FriendlyFactory.getFriendly(FriendlyTypes.walking); }
public void Remove_NoConditions_Test() { var character = CreateMockCharacter(); var friendly = new Friendly(); friendly.Apply(character); friendly.Remove(character); Assert.AreEqual(0, character.Conditions.Count); }
public void Apply_Character_WithExistingFriendlyCondition_Test() { var character = CreateMockCharacter(); character.Conditions.Add(new Friendly()); var friendly = new Friendly(); friendly.Apply(character); }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public override int GetHashCode() { unchecked // Ignore overflow { var hash = 17; hash = hash * 23 + Internal.GetHashCode(); hash = hash * 23 + Friendly.GetHashCode(); return(hash); } }
/// <summary> /// Determines whether the specified <see cref="System.Object" }, is equal to this instance. /// </summary> /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param> /// <returns> /// <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>. /// </returns> public override bool Equals(object obj) { var otherPair = obj as ApplicationVersionPair; if (otherPair == null) { return(false); } return(Internal.Equals(otherPair.Internal) && Friendly.Equals(otherPair.Friendly)); }
public void Apply_Character_NoConditions_Test() { var character = CreateMockCharacter(); var friendly = new Friendly(); friendly.Apply(character); Assert.AreEqual(EntityIds.FRIENDLY_CONDITION_ID, character.Conditions[0].Id); Assert.AreSame(friendly, character.Conditions[0]); Assert.AreEqual(ConditionGroup.Attitude, character.Conditions[0].Group); }
public static void Shop_Purchase(Player _player, Friendly _Merchant, string sentence01, string sentence02) { int x = 0; List <string> item_names = new List <string>(); string itemchoice; Console.Clear(); Draw_UI.Draw_UI_Shop_Buy(_Merchant, _player); Console.WriteLine("Back - (Type 'back')"); while (x < _Merchant.NPC_Inventory.Count()) { do { Console.Write("Purchase Item: "); itemchoice = Console.ReadLine(); } while (itemchoice.Any(char.IsLetter) == false); if (itemchoice == "Back" || itemchoice == "back" || itemchoice == "BACK") { Shop_Show_Items(_player, _Merchant, sentence01, sentence02); } else { foreach (Item item in _Merchant.NPC_Inventory) { item_names.Add(item.Item_Name); } if (item_names.Contains(itemchoice)) { foreach (Item item in _Merchant.NPC_Inventory) { if (itemchoice == item.Item_Name) { x = x + 1; if (_player.Char_Gold >= item.Item_Buy) { Console.WriteLine("You have purchased " + item.Item_Name + " for " + item.Item_Buy + " Gold coins"); Remove_Merchant_Items(_Merchant, itemchoice); _player.Char_Gold -= item.Item_Buy; _Merchant.Shop_Gold += item.Item_Buy; } else { Console.WriteLine("You do not have enough gold."); } } } } else { Console.WriteLine("Item not found."); } } } }
public int CompareTo(ApplicationVersionPair other) { // Compare the internal version first and then the friendly version var internalCompare = Internal.CompareTo(other.Internal); if (internalCompare != 0) { return(internalCompare); } return(Friendly.CompareTo(other.Friendly)); }
void ResetDataField() { for (int i = 0; i < currentFieldList.Count; ++i) { int rand = Random.Range(0, DataSet.CharacterImageResources.Length); currentFieldList[i].FieldSet(rand); Friendly tempCharacter = new Friendly(rand); currentFieldList[i].CharacterSet(tempCharacter); currentFieldList[i].InitSet(); } contentRect.sizeDelta = new Vector2(0, currentFieldList.Count * 100); }
public static void Remove_Merchant_Items(Friendly _Merchant, string itemchoice) { List <object> items = new List <object>(); foreach (Item item in _Merchant.NPC_Inventory) { if (item.Item_Name != itemchoice) { items.Add(item); } } _Merchant.NPC_Inventory = items; }
private static void CreateFriendly(Location loadedLocation) { string projectPath = AppDomain.CurrentDomain.BaseDirectory; string path = projectPath + @"\JSON\Characters\Friendlies\"; foreach (string fileName in Directory.GetFiles(path, "*.json").Select(Path.GetFileName)) { if (fileName == loadedLocation.FriendlyJsonFileName + ".json") { loadedLocation.LocationFriendly = Friendly.CreateFriendly(fileName); } } }
private void OnTick(object Sender, EventArgs Args) { Logger.Debug("Tick!"); // Do not draw the UI elements if the game is loading, paused, player is dead or it cannot be controlled if (Game.IsLoading || Game.IsPaused || !Game.Player.Character.IsAlive || !Function.Call <bool>(Hash.IS_PLAYER_CONTROL_ON, Game.Player)) { return; } // Disable the original game HUD and radar if is requested if (Config.DisableHud) { Function.Call(Hash.HIDE_HUD_AND_RADAR_THIS_FRAME); } // Draw the squad information on the top left // First, create a list to start counting int Count = 1; // Then, Run over the peds and draw them on the screen (up to 6 of them, including the player) // NOTE: We order them by ped hash because the players have lower hash codes than the rest of entities foreach (Ped Friendly in World.GetNearbyPeds(Game.Player.Character.Position, 50f).OrderBy(P => P.GetHashCode())) { // Check that the ped is a mission entity and is friendly if (Friendly.IsMissionEntity() && Friendly.IsFriendly() && Count <= 6) { // Select the icon image by checking that the ped is either dead or alive string ImagePath; if (Friendly.IsDead) { ImagePath = Common.Image.ResourceToPNG(Resources.ImageDead, "SquadDead" + Count.ToString()); } else { ImagePath = Common.Image.ResourceToPNG(Resources.ImageCharacter, "SquadAlive" + Count.ToString()); } // Finally, draw the icon Point Position = new Point(Config.SquadPosition.X, (Config.SquadPosition.Y + Config.ElementsRelative.Height) * Count); Draw.Icon(Config, ImagePath, Position); // And the information of it Point InfoPosition = new Point(Config.SquadPosition.X + Config.IconBackgroundSize.Width + Config.ElementsRelative.Width, (Config.SquadPosition.Y + Config.ElementsRelative.Height) * Count); Draw.PedInfo(Config, Friendly, InfoPosition); // To end this up, increase the count of peds "rendered" Count++; } } }
// Use this for initialization void Start () { if (GetComponent<Friendly>() == true) { friendlyScript = GetComponent<Friendly>(); isFriendlyOrEnemy = true; } else if(GetComponent<Enemy>() == true) { enemyScript = GetComponent<Enemy>(); isFriendlyOrEnemy = false; } pos = transform.position; rot = transform.rotation; }
public Castle() : base("The Castle", "A huge castle, but it is so quiet here.|\r\n") { // Items Items.Add(new VikingShield()); // Friendly LocationFriendly = Friendly.CreateFriendly(Friendlies.Fairy); Characters.Add(LocationFriendly); FriendlyDescription = "Someone comes: it's the FRIENDLY_NAME. Do you want to talk (o)"; // Monster MonsterDescription = ""; UpdateLocation(); }
public static void Forest_Start(Player _player) { string sentence01; string sentence02; Random Rand = new Random(); Enemy _enemy; Draw_UI.Draw_UI_Stat_start(_player); _enemy = Enemy.Hound_List[Rand.Next(0, 2)]; sentence01 = ("You wake up from a cold sleep, only to hear the howling screams "); sentence02 = ("of " + _enemy.Enemy_Name + " from behind a tree."); Console.WriteLine(sentence01); Console.WriteLine(sentence02); Base_Player_Actions.Action_Handler(_player, _enemy, sentence01, sentence02); Draw_UI.Draw_UI_Stat_start(_player); _enemy = Enemy.Other_Animal_List[1]; sentence01 = ("After Battling " + _enemy.Enemy_Name + " you manage to win however as you recover,"); sentence02 = ("you see standing in front of you a terrifying bear, preparing to attack."); Console.WriteLine(sentence01); Console.WriteLine(sentence02); Base_Player_Actions.Action_Handler(_player, _enemy, sentence01, sentence02); Friendly _Friendly = Friendly.Merchant_List[0]; Console.Clear(); Draw_UI.Draw_UI_Stat_start(_player); sentence01 = ("After battling with the bear, you manage to overcome it. You rest, but see on the dirt path ahead a figure."); sentence02 = ("He approaches you, you then realise that it is a shopkeeper selling his wares."); Console.WriteLine(sentence01); Console.WriteLine(sentence02); Shop.Shop_Handler(_player, _Friendly, sentence01, sentence02); Building building = Building.Easy_Buildings[Rand.Next(1, Building.Easy_Buildings.Count)]; sentence01 = "You see a nearby " + building.Building_Name + ", and night is approaching.Do you "; sentence02 = "want to search the " + building.Building_Name + "?"; Draw_UI.Draw_UI_Stats(_player, sentence01, sentence02); Base_Player_Actions.Search_Building(_player, building); Console.ReadKey(); }
public static GameObject findClosestPlayableCharacter(GameObject Enemy) { int maxDist = int.MaxValue; GameObject closest = null; foreach (GameObject Friendly in GameObject.FindGameObjectsWithTag("Friendly")) { int thisdistance = (Enemy.GetComponent <Character>().isAt().GetComponent <Tile>().getX() - Friendly.GetComponent <Character>().isAt().GetComponent <Tile>().getX()) + (Enemy.GetComponent <Character>().isAt().GetComponent <Tile>().getY() - Friendly.GetComponent <Character>().isAt().GetComponent <Tile>().getY()); if (thisdistance < maxDist) { maxDist = thisdistance; closest = Friendly; } } return(closest); }
public static string FormatAppearance <TKind>(TKind kind, string value) { var clipped = FormatLiteral(Friendly.Clip(value, 12)); var description = TryGetTokenAttribute(kind); if (description != null) { if (description.Category != null) { return($"{description.Category} {clipped}"); } if (description.Example != null) { return(clipped); } } return($"{FormatKind(kind!)} {clipped}"); }
public static void Draw_UI_Shop_Main(Friendly _Merchant, Player _Player) { Console.Clear(); Console.SetCursorPosition(Console.WindowWidth / 2 - 10, Console.WindowHeight / 2); Console.Write("Getting Merchant Wares..........."); Thread.Sleep(1000); Console.Clear(); for (int i = 0; i < 120; i++) { Console.Write("_"); } Console.WriteLine("Character Name: " + _Player.Char_Name + " " + "Class: " + _Player.Char_Class + " " + "Level: " + _Player.Char_Level + " " + "Experience: " + _Player.Char_Experience + "/" + Player.Current_Level_Xp); Console.WriteLine("Player Gold: " + _Player.Char_Gold); for (int i = 0; i < 120; i++) { Console.Write("_"); } Console.WriteLine("Buy - 1"); Console.WriteLine("Sell - 2"); Console.WriteLine("Leave - 3"); }
public static void Draw_UI_Shop_Sell(Player _player, Friendly _merchant) { Console.Clear(); Console.SetCursorPosition(Console.WindowWidth / 2 - 10, Console.WindowHeight / 2); Console.Write("Getting Player Items..........."); Thread.Sleep(1000); Console.Clear(); for (int i = 0; i < 120; i++) { Console.Write("_"); } Console.WriteLine("Character Name: " + _player.Char_Name + " " + "Class: " + _player.Char_Class + " " + "Level: " + _player.Char_Level + " " + "Experience: " + _player.Char_Experience + "/" + Player.Current_Level_Xp); Console.WriteLine("Player Gold: " + _player.Char_Gold + " " + "Merchant Gold:" + _merchant.Shop_Gold); for (int i = 0; i < 120; i++) { Console.Write("_"); } foreach (Item item in _player.Char_Inventory) { Console.WriteLine("Item: " + item.Item_Name + " Sell Price: " + item.Item_Buy + " Gold Coins"); } }
public static void Shop_Show_Items(Player _player, Friendly _Merchant, string sentence01, string sentence02) { Draw_UI.Draw_UI_Shop_Main(_Merchant, _player); string Input; do { Console.Write("Input: "); Input = Console.ReadLine(); } while (Input.All(char.IsDigit) == false); switch (Input) { case "1": Shop_Purchase(_player, _Merchant, sentence01, sentence02); break; case "2": Shop_Sell(_Merchant, _player, sentence01, sentence02); break; case "3": break; } }