public bool ExecuteStep(ParsingArguments modifiedArguments, out ParsingArguments parsingArguments) { parsingArguments = null; if (modifiedArguments != null && modifiedArguments.ArgumentsChanged) { UpdateModifiedCounters(modifiedArguments); } if (CurrentIndex >= html.Length) { return(false); } char currentCharacter = html[CurrentIndex]; CharacterTypes characterType = currentCharacter.ToCharacterType(); UpdateCounters(characterType); transitionManager.Move(characterType, out AdditionalOperations[] additionalOperations); HandleState(transitionManager.CurrentState); HandleAdditionalOperations(additionalOperations, currentCharacter, buffer); parsingArguments = new ParsingArguments(CurrentIndexInLine, CurrentIndex, CurrentLine, stack); return(true); }
public static SpawnPoint GetFurthestPoint(CharacterTypes types, params Transform[] objects) { var points = instance.SpawnPoints.Where(p => p.IsVacant && p.SpawnType == types); float maxDistance = float.MinValue; SpawnPoint candidate = null; foreach (var point in points) { float distance = float.MaxValue; foreach (var obj in objects) { float dist = (obj.position - point.transform.position).sqrMagnitude; distance = Mathf.Min(dist, distance); } if (distance > maxDistance) { maxDistance = distance; candidate = point; } } return(candidate); }
// Methods public void Read(BINAReader reader) { // Read the data uint lineType = reader.ReadUInt32(); uint padding1 = reader.ReadUInt32(); ulong nameOffset = reader.ReadUInt64(); ulong padding2 = reader.ReadUInt64(); UnknownFloat1 = reader.ReadSingle(); byte firstCharacter = reader.ReadByte(); byte firstAnim = reader.ReadByte(); byte secondCharacter = reader.ReadByte(); byte secondAnim = reader.ReadByte(); TalkingCharacter = reader.ReadUInt64(); // Parse it if (nameOffset != 0) { Name = reader.GetString((uint)nameOffset + reader.Offset); } LineType = (LineTypes)lineType; FirstCharacter = (CharacterTypes)firstCharacter; FirstCharAnimation = (AnimationTypes)firstAnim; SecondCharacter = (CharacterTypes)secondCharacter; SecondCharAnimation = (AnimationTypes)secondAnim; }
////////////////////////////////////////// /// OnMoveMade() /// Callback for when a character makes a /// move. ////////////////////////////////////////// private void OnMoveMade() { // a move has been made, so decrement # of moves left m_nMovesLeft--; // if there are 0 moves left, we need to flip whose turn it is and update/reset counters if (m_nMovesLeft <= 0) { // if the non-starting character has taken the last turn in a round, increment round and reset the turn int nMaxTurns = Constants.GetConstant <int>("TurnsPerRound"); if (m_nTurn == nMaxTurns && m_eStartingCharacter != m_eActiveCharacter) { m_nRound++; // new round! m_nTurn = 1; // next round starts at turn 1 Messenger.Broadcast("RoundEnded"); // send out a message that a round has ended } else if (m_eStartingCharacter != m_eActiveCharacter) { // otherwise if the non-starting character took their turn, just increment the round m_nTurn++; } // reset the # of moves the active char can take ResetMovesLeft(); // swap the active char CharacterTypes eNewChar = m_eActiveCharacter == CharacterTypes.Player ? CharacterTypes.AI : CharacterTypes.Player; SetActiveCharacter(eNewChar); } else { UpdateUI(); // update the UI if a move was taken but there are still moves left before a turn ends } }
public ActionResult <Warrior> Create(CharacterTypes character) { var warrior = new Warrior(character); WarriorCollection.Warriors.Add(warrior); return(Ok(warrior)); }
public int GetLevels(StatsAtributte stat, CharacterTypes charTypes) { BuildLookup(); int[] levels = lookupTable[charTypes][stat]; return(levels.Length); }
private void CmdTrySpawn(int characterType) { //Convert for readability. CharacterTypes characterEnum = (CharacterTypes)characterType; int index = _characterPrefabs.FindIndex(x => x.CharacterType == characterEnum); //If index isn't found then you likely forgot to setup the character type prefabs. if (index == -1) { return; } //No prefab set for index, you likely forgot to specify a prefab for the character type. if (_characterPrefabs[index].Prefab == null) { return; } //Choose a random position. Vector3 pos = new Vector3(UnityEngine.Random.Range(-5, 5), 0, 0); GameObject result = Instantiate(_characterPrefabs[index].Prefab, pos, Quaternion.identity); //Spawn over server giving authority to the client calling this command. NetworkServer.Spawn(result, base.netIdentity.connectionToClient); //Tell player their character was spawned. Could pass in an object here. TargetCharacterSpawned(); }
// Use this for initialization void Start() { Enemies = GameObject.FindGameObjectsWithTag("Enemy"); _enemyTypes = Camera.main.GetComponent<CharacterTypes>(); //attempting to make a for loop build all of the enemies stats in an array. for(int i = 0; i < Enemies.Length; i++) { RandomClass = Random.Range(0,100); if(RandomClass >= 0 && RandomClass <= 19){ Camera.main.SendMessage("TechnoMage"); } if(RandomClass >= 20 && RandomClass <= 39){ Camera.main.SendMessage("StimBot"); } if(RandomClass >= 40 && RandomClass <= 59){ Camera.main.SendMessage("WarpTheif"); } if(RandomClass >= 60 && RandomClass <= 79){ Camera.main.SendMessage("Cyborg"); } if(RandomClass >= 80 && RandomClass <= 99){ Camera.main.SendMessage("HyperElf"); } Enemies[i].GetComponent<EnemyStats>().name = _enemyTypes.name; Enemies[i].GetComponent<EnemyStats>().stamina = _enemyTypes.stamina; Enemies[i].GetComponent<EnemyStats>().dexterity = _enemyTypes.dexterity; Enemies[i].GetComponent<EnemyStats>().strength = _enemyTypes.strength; Enemies[i].GetComponent<EnemyStats>().energy = _enemyTypes.energy; Enemies[i].GetComponent<EnemyStats>().healing = _enemyTypes.healing; } }
public static SpawnPoint GetRandomVacantPoint(CharacterTypes type) { var points = instance.SpawnPoints.Where(p => p.IsVacant && p.SpawnType == type); int count = points.Count(); return(points.ElementAt(Random.Range(0, count))); }
public static List <int> GetOptionsForCharacterTypes(CharacterTypes characterTypes) { switch (characterTypes) { case CharacterTypes.AlphabeticalOnly: return(AlphabeticalOnlyCodes); case CharacterTypes.NumericOnly: return(NumericOnlyCodes); case CharacterTypes.Alphanumeric: var builder = new List <int>(); builder.AddRange(AlphabeticalOnlyCodes); builder.AddRange(NumericOnlyCodes); return(builder); case CharacterTypes.AllAscii: var builder2 = new List <int>(); builder2.AddRange(AlphabeticalOnlyCodes); builder2.AddRange(NumericOnlyCodes); builder2.AddRange(PunctuationCodes); return(builder2); default: throw new System.NotImplementedException(); } }
public async Task LoadAsync() { foreach (var characterType in (await CharacterChoices.GetAsync()).CharacterTypes) { CharacterTypes.Add(characterType); } PlayerNumbers = GetPlayerNumbers(); }
public void GivenCreateANewOgre(CharacterTypes character) { var client = new RestClient($"{_baseUri}/api/Warriors/create?character={character}"); var request = new RestRequest(Method.POST); var response = client.Execute(request); _warrior = JsonConvert.DeserializeObject <Warrior>(response.Content); }
internal CharacterListItemModel(Character character) { name = character.Name; price = character.Price; created = character.Created; type = character.Type; active = character.Active; deleted = character.Deleted; }
public Person(CharacterTypes character, Vector2 position) { Type = character; TexturePath = "Planet/" + character.ToString() + "/player"; Position = position; Velocity = Vector2.Zero; DrawBox = new Rectangle((int)position.X, (int)position.Y, 50, 100); HitboxSrc = new Rectangle(0, 0, 50, 100); }
public Characters(string name, int health, int loot, ProductTypes products, WeaponTypes weapons, CharacterTypes charactertype) { Name = name; Health = health; Loot = loot; Product = products; Weapon = weapons; CharacterType = charactertype; }
////////////////////////////////////////// /// OnTurnEnded() /// Callback for when the current turn /// has ended. ////////////////////////////////////////// private void OnTurnEnded() { // send out a message that this character's turn is ending Messenger.Broadcast("TurnOver_" + m_dataActiveCharacter.Name); // set the active character -- right now it's either the AI or player's turn CharacterTypes eActiveCharacter = m_eActiveCharacter == CharacterTypes.AI ? CharacterTypes.Player : CharacterTypes.AI; SetActiveCharacter(eActiveCharacter); }
private Stack <byte> GetPlayerNumbers() { var stack = new Stack <byte>(); foreach (byte num in Enumerable.Range(1, CharacterTypes.SelectMany(ct => ct.Characters).Count()).Reverse()) { stack.Push(num); } return(stack); }
private static SecureString GeneratePassword(int passwordLength, CharacterTypes option) { if (passwordLength < 5) throw new InvalidPasswordLengthException(); var passwordOptions = GetCharactersToIncludeInPassword(option); var securePassword = SelectPassword(passwordLength, passwordOptions); return securePassword; }
public void Select(object buttonObj) { UI.Button btn = (UI.Button)buttonObj; if (btn.State != UI.UIControlState.Disabled) { SelectedCharacter = (CharacterTypes)btn.Tag; DB.CurrentSave.Character = (int)SelectedCharacter; } }
public float GetStat(StatsAtributte stat, CharacterTypes charType, int level) { BuildLookup(); int[] levels = lookupTable[charType][stat]; if (levels.Length < level) { return(0); } return(levels[level - 1]); }
/// <summary> /// Allocates a new ViewID from Photon, and sends message to instantiate a new character. /// </summary> /// <param name="myCharacter">Character prefab to use.</param> public void AllocateViewIDAndCallInstantiate(CharacterTypes myCharacter, TeamTypes team) { if (!enteredGame) { enteredGame = true; int myID = PhotonNetwork.AllocateViewID(); view.RPC("InstantiateObject", PhotonTargets.AllBuffered, myID, myCharacter.GetHashCode(), team.GetHashCode(), PlayFabManager.instance.GetMyPlayerID(), PlayFabManager.instance.playerDisplayName); } }
public CharacterView GetViewFromType(CharacterTypes i_eType) { if (i_eType == CharacterTypes.Player) { return(Characters[0]); } else { return(Characters[1]); } }
/// <summary> /// Allocates a new ViewID from Photon, and sends message to instantiate a new character. /// </summary> /// <param name="myCharacter">Character prefab to use.</param> public void AllocateViewIDAndCallInstantiate(CharacterTypes myCharacter,TeamTypes team) { if (!enteredGame) { enteredGame = true; int myID = PhotonNetwork.AllocateViewID(); view.RPC("InstantiateObject", PhotonTargets.AllBuffered, myID, myCharacter.GetHashCode(), team.GetHashCode(),PlayFabManager.instance.GetMyPlayerID(),PlayFabManager.instance.playerDisplayName); } }
void CheckMyPlayerProperties(string playerName, TeamTypes playerTeam, CharacterTypes playerChar) { if (selectedTeam != playerTeam) { this.ChangeTeam(false); } if (selectedCharacter != playerChar) { this.SelectChar(playerChar.ToString(), false); } }
public void Draw(Character character, CharacterTypes type) { _renderer.Begin(); var sprite = _textureLookup[(int)type]; var position = character.Position; _renderer.Draw(sprite, new Vector2(position.X, position.Y)); _renderer.End(); }
private void UpdateCounters(CharacterTypes characterType) { CurrentIndex++; if (characterType == CharacterTypes.NewLine) { CurrentLine++; CurrentIndexInLine = 1; } else { CurrentIndexInLine++; } }
////////////////////////////////////////// /// SetActiveCharacter() /// Sets the active character to the /// incoming type. ////////////////////////////////////////// private void SetActiveCharacter(CharacterTypes i_eType) { // make sure the active character isn't being set numerous times in a row if (m_eActiveCharacter == i_eType) { Debug.LogError("Warning, character getting set to current twice: " + i_eType); return; } // set the active char m_eActiveCharacter = i_eType; m_dataActiveCharacter = GameBoard_Chain.Instance.GetDataFromType(i_eType); }
// Use this for initialization public void LoadCharacter(CharacterTypes CharacterName) { //playerController = new PlayerController(); GameObject model = null; switch (CharacterName) { case CharacterTypes.MELLISA: model = Instantiate(CharacterModels[0], new Vector3(0, 1, 0), Quaternion.identity); model.AddComponent <PlayerController>(); model.GetComponent <PlayerController>().BuildCharacter(6, .8f, "Mellisa", wand); print("ive built"); break; case CharacterTypes.BRAD: model = Instantiate(CharacterModels[1], new Vector3(0, -1, 0), Quaternion.identity); //Instantiate(model, new Vector3(0, 0, 0), Quaternion.identity); model.AddComponent <PlayerController>(); model.GetComponent <PlayerController>().BuildCharacter(4, .1f, "Brad", wand); break; case CharacterTypes.WYATT: model = Instantiate(CharacterModels[2], new Vector3(0, 0, 0), Quaternion.identity); Instantiate(model, new Vector3(0, 0, 0), Quaternion.identity); model.AddComponent <PlayerController>(); model.GetComponent <PlayerController>().BuildCharacter(8, .06f, "Wyatt", wand); break; } // model.GetComponent<PlayerController>().AddNewWand(wand); // GameObject player = CharacterModels[0]; // PlayerController pc = player.AddComponent<PlayerController>(); // pc = playerController; // GameObject Player = InitializeCharacter(); Destroy(canvas); GameManager.instance.SetPlayerObject(); GameManager.instance.displayHUD(); Camera.main.transform.Find("UICanvas").GetComponent <UIBehaviour>().SetCharacterPortrait(CharacterName); Camera.main.transform.Find("UICanvas").GetComponent <UIBehaviour>().setMaxHealth(2); Destroy(gameObject); }
public ParsingStates Move(CharacterTypes characterType, out AdditionalOperations[] additionalOperations) { Transition transition = new Transition(CurrentState, characterType); ParsingStates nextState = ParsingRules.StatesTable[transition]; ParsingStateChange parsingStateChange = new ParsingStateChange(CurrentState, nextState); additionalOperations = null; if (ParsingRules.AdditionalParsingOperations.ContainsKey(parsingStateChange)) { additionalOperations = ParsingRules.AdditionalParsingOperations[parsingStateChange]; } CurrentState = nextState; return(CurrentState); }
/// <summary> /// Changes player avatar, to the one the player has chosen. /// </summary> /// <param name="myType">New character.</param> /// <param name="syncNetwork">If will send data to the network.</param> public void ChangePlayerAvatar(CharacterTypes myType, bool syncNetwork) { if (myCharacter != myType) { myCharacter = myType; ExitGames.Client.Photon.Hashtable properties = new ExitGames.Client.Photon.Hashtable(); properties.Add("Character", myCharacter.GetHashCode()); PhotonNetwork.player.SetCustomProperties(properties); if (syncNetwork) { networkLayer.OnPropertiesChanged(); } } }
public static string GenerateRandomCode(int length, CharacterTypes characterTypes) { var builder = new List <char>(); var options = GetOptionsForCharacterTypes(characterTypes); var random = new Random(); for (var i = 0; i < length; i++) { var nextIndex = random.Next(options.Count); var charCode = options[nextIndex]; builder.Add((char)charCode); } return(new string(builder.ToArray())); }
/// <summary> /// Initializes a new instance of the <see cref="Warrior"/> class. /// </summary> /// <param name="character">The character<see cref="CharacterTypes"/></param> public Warrior(CharacterTypes character) { Id = Guid.NewGuid().ToString(); CharacterType = character; switch (character) { case CharacterTypes.Elf: Health = 80; Magic = 100; break; case CharacterTypes.Ogre: Health = 100; Magic = 80; break; } }
private static PasswordOptions GetCharactersToIncludeInPassword(CharacterTypes option) { var list = new PasswordOptions(); switch (option) { case CharacterTypes.Alpha_Lower: list.Add(AlphaLC); break; case CharacterTypes.Alpha_Upper: list.Add(AlphaUC); break; case CharacterTypes.Digit: list.Add(Digits); break; case CharacterTypes.AlphaLowerNumeric: list.Add(AlphaLC); list.Add(Digits); break; case CharacterTypes.AlphaUpperNumeric: list.Add(AlphaUC); list.Add(Digits); break; case CharacterTypes.AlphaNumeric: list.Add(AlphaLC); list.Add(AlphaUC); list.Add(Digits); break; case CharacterTypes.Special: list.Add(Specials); break; case CharacterTypes.AlphaNumericSpecial: list.Add(AlphaLC); list.Add(AlphaUC); list.Add(Digits); list.Add(Specials); break; default: list.Add(AlphaLC); list.Add(AlphaUC); break; } return list; }
public NetworkPlayer() { CharacterType = (CharacterTypes)UnityEngine.Random.Range(1, 4); switch (CharacterType) { case CharacterTypes.Unassigned: case CharacterTypes.Cat: Name = NAMES_CATS.OrderBy(n => Guid.NewGuid()).First(); break; case CharacterTypes.Dog: Name = NAMES_DOGS.OrderBy(n => Guid.NewGuid()).First(); break; case CharacterTypes.Bird: Name = NAMES_BIRDS.OrderBy(n => Guid.NewGuid()).First(); break; } }
public void PlayDieEffect(Transform parent, CharacterTypes characterType) { switch (characterType) { case CharacterTypes.Player: InstantiateEffect(dieEffect, parent); break; case CharacterTypes.Slime: InstantiateEffect(slimeDieEffect, parent); break; case CharacterTypes.Ghost: InstantiateEffect(ghostDieEffect, parent); break; default: InstantiateEffect(dieEffect, parent); break; } }
public void SelectChar(string characterName, bool syncNetwork) { if (ready) { return; } CharacterTypes newType = (CharacterTypes)System.Enum.Parse(typeof(CharacterTypes), characterName, true); if (newType != selectedCharacter) { charactersAvatars[selectedCharacter.GetHashCode()].SetActive(false); selectedCharacter = newType; charactersAvatars[selectedCharacter.GetHashCode()].SetActive(true); this.RebuildAvatarTextures(); this.ChangeStatsValues(); } MultiplayerRoomsManager.instance.ChangePlayerAvatar(selectedCharacter, syncNetwork); }
public SecureString Generate(int passwordLength, CharacterTypes option) { return GeneratePassword(passwordLength, option); }
// Use this for initialization void Start() { _charTypes = Camera.main.GetComponent<CharacterTypes>(); _charSelected = Camera.main.GetComponent<CharacterSelected>(); Characters = GameObject.FindGameObjectsWithTag("Player"); }
public void SelectChar(string characterName, bool syncNetwork) { if (ready) return; CharacterTypes newType = (CharacterTypes)System.Enum.Parse(typeof(CharacterTypes), characterName, true); if (newType != selectedCharacter) { charactersAvatars[selectedCharacter.GetHashCode()].SetActive(false); selectedCharacter = newType; charactersAvatars[selectedCharacter.GetHashCode()].SetActive(true); this.RebuildAvatarTextures(); this.ChangeStatsValues(); } MultiplayerRoomsManager.instance.ChangePlayerAvatar(selectedCharacter,syncNetwork); }