private void REPLAY(List <string> PASSED_SEQUENCE, DataTable TABLE_TO_INJECT) { SendKeys.Flush(); //Wait for the buffer to empty. foreach (string KEY in PASSED_SEQUENCE) //For each key in the recorded sequence... { bool IS_CHAR = Char.IsLetterOrDigit(KEY, 0); //Check if its a letter. if (IS_CHAR) //If the key is a letter, this is an indication that substitution needs to happen... { foreach (DataRow ROW in TABLE_TO_INJECT.Rows) //Cycle through the table to find the right row. { string ROW_LETTER = ROW["Letter"].ToString(); //Get the current row letter. if (KEY.ToUpper() == ROW_LETTER) //If the row letter matches the letter from the key stream... { foreach (char CHARACTER in ROW["Value"].ToString()) //for each character in the value field, send the key. { SendKeys.SendWait(CHARACTER.ToString()); System.Threading.Thread.Sleep(75); //Delay a bit. } } } } else //The key is not a letter... { SendKeys.SendWait(KEY); //Just send the key. } System.Threading.Thread.Sleep(75); //Delay a bit. } REPLAY_SEQUENCE_ACTIVE = false; //Indicate the sequence is done. DONE_REPLAYING?.Invoke(null, null); }
virtual public void Init() { string[] typeArray = style.Split('-'); category = (EQUIP_CATEGORY)int.Parse(typeArray[0]); if (category == EQUIP_CATEGORY.WEAPON) { character = (CHARACTER)int.Parse(typeArray[1]); string _cate = Enum.GetName(typeof(EQUIP_CATEGORY), category); string _character = Enum.GetName(typeof(CHARACTER), character); JsonUtility.FromJsonOverwrite(EquipType.equipType[_cate][_character][level - 1].ToJson(), this); } else { sort = (EQUIP_SORT)int.Parse(typeArray[1]); type = (EQUIP_TYPE)int.Parse(typeArray[2]); string _cate = Enum.GetName(typeof(EQUIP_CATEGORY), category); string _sort = Enum.GetName(typeof(EQUIP_SORT), sort); string _type = Enum.GetName(typeof(EQUIP_TYPE), type); JsonUtility.FromJsonOverwrite(EquipType.equipType[_cate][_sort][_type][level - 1].ToJson(), this); } //EQUIP_BASE //if(EquipType.equipType[_cate][_sort][_type][level - 1]["base"] != null) { //baseMod //} //ModInfo modInfo = new ModInfo(); }
public void Enter(CHARACTER character) { Animator animator = GetAnimator(character); animator.SetBool("Leaving", false); animator.SetBool("Entering", true); }
public PLAYER_INFO(int i, PLAYER_TYPE t, CHARACTER c, DevType[] _dev = null) { id = i; type = t; character = c; dev = _dev; }
///<summary> /// Animates the removal of a character after a delay. ///</summary> private IEnumerator removeCharacter(CHARACTER character) { print($"Removing character {character}."); yield return(new WaitForSeconds(CHARACTER_LEAVE_DELAY)); print($"Triggering leave animation for {character}."); animationManager.Leave(character); }
void Start() { if (playerType == PLAYER.UNASSIGNED) { Debug.LogWarning("playerType of " + name + " is unassigned!"); } if (baseProjectile == null) { Debug.LogWarning("Base Projectile not set on player: " + name); } charcterType = (CHARACTER)characterSetter.playerSelections[((int)playerType) - 1]; if (playerRagdolls[(int)charcterType] != null) { playerRagdolls[(int)charcterType].SetActive(true); playerMesh = playerRagdolls[(int)charcterType]; Debug.Log(charcterType); } else { Debug.LogWarning("Could not find a gameobject for character on player: " + name); playerRagdolls[0].SetActive(true); playerMesh = playerRagdolls[0]; } aimIndicator = transform.GetChild(0).gameObject; //Reset vars canFire = true; lastAimVec = transform.forward; //set projType if (charcterType == CHARACTER.ARCHER) { projType = projectileController.PROJTYPES.ARROW; } else if (charcterType == CHARACTER.BARD) { projType = projectileController.PROJTYPES.NOTE; } else if (charcterType == CHARACTER.MAGE) { projType = projectileController.PROJTYPES.FIREBALL; } else if (charcterType == CHARACTER.WARRIOR) { projType = projectileController.PROJTYPES.AXE; } initalMaterial = playerMesh.transform.GetChild(0).GetComponent <SkinnedMeshRenderer>().material; }
///<summary> /// Handles the dismissal of a character by fading out their audio and animating them. ///</summary> private void dismissCharacter(CHARACTER character) { if (!presentCharacters[(int)character]) { // This character isn't even here! Do nothing return; } presentCharacters[(int)character] = false; StartCoroutine(fadeAudioOut(character)); StartCoroutine(removeCharacter(character)); }
public void draw(SpriteBatch batch, Camera2D cam, Characters Char) { foreach (Characters CHARACTER in CharactersHandler.Players) { if (CHARACTER.returnName() != "GhostCharacter") { batch.Draw(HpBar, new Rectangle((int)CHARACTER.CharacterPos.X, (int)CHARACTER.CharacterPos.Y - 15, (50 - ((CHARACTER.getMaximumHp() - CHARACTER.getHp()) / 2)), 5), setHpColor(CHARACTER)); } } batch.DrawString(font, assets[0] + Char.returnName(), new Vector2(cam.Position.X - 700, cam.Position.Y - 500), Color.White); batch.DrawString(font, assets[1] + Char.getHp(), new Vector2(cam.Position.X - 480, cam.Position.Y - 500), Color.White); batch.DrawString(font, assets[2] + Char.GetActiveWeapon().getName(), new Vector2(cam.Position.X - 700, cam.Position.Y - 475), Color.White); batch.DrawString(font, assets[3] + roundTime, new Vector2(cam.Position.X - 700, cam.Position.Y - 450), color); }
/// <summary> /// Constructor for the player. Initilazing the Name, starting point, frame, commands /// and the list for the bombs he placed /// </summary> /// <param name="name">Name of the player</param> /// <param name="startingPoint">Starting point</param> /// <param name="cUp">Key for moving up</param> /// <param name="cDown">Key for moving down</param> /// <param name="cLeft">Key for moving left</param> /// <param name="cRight">Key for moving right</param> /// <param name="putbomb">Key for placing the bomb</param> public BomberMan(String name, Point startingPoint, Keys cUp, Keys cDown, Keys cLeft, Keys cRight, Keys putbomb, CHARACTER ch) : base(1, 1, 1) { Name = name; IsAlive = true; Point = new Point(startingPoint.X, startingPoint.Y); Key = Point; CommandUp = cUp; CommandDown = cDown; CommandLeft = cLeft; CommandRight = cRight; CommandPutBomb = putbomb; Bombs = new Dictionary <Point, Bomb>(); Frame = new Rectangle(Point.X + 5, Point.Y + 5, 40, 40); type = ch; }
private Animator GetAnimator(CHARACTER character) { switch (character) { case CHARACTER.GIRL: return(girlAnimator); case CHARACTER.CAT: return(catAnimator); case CHARACTER.LADY: return(ladyAnimator); default: return(manAnimator); } }
/// <summary> /// Lerps character audio from current volume to targetVolume over AUDIO_FADE_TIME seconds /// </summary> /// <param name="character">Specified character.</param> /// <param name="targetVolume">Volume between 0 and 1 to go to.</param> private IEnumerator lerpAudio(CHARACTER character, float targetVolume, bool leaveDelay = false) { AudioSource audioSource = audioSources[(int)character]; float startVolume = audioSources[(int)character].volume; float volumeDifferential = targetVolume - startVolume; float fractionLerped = 0; // goes from 0 to 1 over time // Lerp the volume. for (float time = 0f; time < AUDIO_FADE_TIME; time += Time.deltaTime) { fractionLerped = time / AUDIO_FADE_TIME; audioSource.volume = fractionLerped * volumeDifferential + startVolume; yield return(new WaitForSeconds(AUDIO_FADE_INTERVAL)); } // Ensure that the character has reached target volume after lerp. audioSource.volume = targetVolume; Debug.Log("Audio set to 1"); }
public King(string dummy) { this.id = 1 + GetID(); this.name = "KING" + this.id; this.predictability = UnityEngine.Random.Range(0, 10); this.persistence = UnityEngine.Random.Range(0, 10); this.trustworthiness = UnityEngine.Random.Range(0, 10); this.selflessness = UnityEngine.Random.Range(0, 10); this.skill = UnityEngine.Random.Range(0, 10); this.racism = UnityEngine.Random.Range(0, 10); this.religiousTolerance = UnityEngine.Random.Range(0, 10); this.character = (CHARACTER)(UnityEngine.Random.Range(0, System.Enum.GetNames(typeof(CHARACTER)).Length)); this.goals = new List <GOALS> (); this.tasks = new List <List <string> > (); this.publicImages = new List <PUBLIC_IMAGE> (); this.relationshipKings = new List <Relationship> (); this.relationshipMayors = new List <Relationship> (); SetLastID(this.id); }
///<summary> /// Lerps the volume of a character from 1 to 0. ///</summary> private IEnumerator fadeAudioIn(CHARACTER character) { yield return(new WaitForSeconds(CHARACTER_ENTER_DELAY)); StartCoroutine(lerpAudio(character, 1)); }
///<summary> /// Lerps the volume of a character from 1 to 0. ///</summary> private IEnumerator fadeAudioOut(CHARACTER character) { yield return(new WaitForSeconds(CHARACTER_LEAVE_DELAY)); StartCoroutine(lerpAudio(character, 0, leaveDelay: true)); }