public void GenerateStringTypeTests() { FastRandom fr = new FastRandom(); CharacterType[] types = new CharacterType[] { CharacterType.LowerCase, CharacterType.UpperCase, CharacterType.Numeric }; Func<char, bool>[] actions = new Func<char, bool>[] { Char.IsLower, Char.IsUpper, Char.IsNumber }; for(int i = 0; i < types.Length; i++) { for(int j = 0; j < 1000; j++) { var s = fr.NextString(5, types[i]); Assert.Equal(5, s.Length); foreach(var c in s) { Assert.True(actions[i](c)); } } } { var s = fr.NextString(5, CharacterType.Special); Assert.Equal(5, s.Length); foreach(var c in s) { Assert.True(FastRandom.SpecialCharacters.Contains(c)); } } }
void OnTriggerExit(Collider other) { if (other.gameObject.CompareTag ("Player")) { confirm.text = ""; selected = CharacterType.None; } }
void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag ("Player")) { tag = gameObject.tag; switch(tag){ case ("AssassinPad"): confirm.text = "Take the Path of the Assassin?\n (y)"; selected = CharacterType.Assassin; Debug.Log (gameObject.tag); break; case ("WarriorPad"): confirm.text = "Take the Path of the Warrior?\n (y)"; selected = CharacterType.Warrior; Debug.Log (gameObject.tag); break; case ("RangerPad"): confirm.text = "Take the Path of the Ranger?\n (y)"; selected = CharacterType.Ranger; Debug.Log (gameObject.tag); break; case ("MagePad"): confirm.text = "Take the Path of the Mage?\n (y)"; selected = CharacterType.Mage; Debug.Log (gameObject.tag); break; } //other.gameObject.SetActive(false); //Debug.Log (gameObject); //Debug.Log ("Entered pad Trigger"); } }
protected Player(string name, int str, int dex, int vit, int intl, int strengthModifier, int dexterityModifier, int vitalityModifier, int intelligenceModifier, List<IItem> baseItems, CharacterType characterType) : base(name) { this.Strength = str; this.Dexterity = dex; this.Vitality = vit; this.Intelligence = intl; this.StrengthModifier = strengthModifier; this.DexterityModifier = dexterityModifier; this.VitalityModifier = vitalityModifier; this.IntelligenceModifier = intelligenceModifier; Position = new Position(); this.Level = 1; this.Cash = 500; this.Inventory = new List<IItem>(); this.Equiped = new List<IItem>(); this.InitialItemEquip(baseItems); //CalculateAttackPoints(); //CalculateDefencePoints(); this.CalculateHitPoints(); CurrentHitPoints = this.MaxHitPoints; this.CharacterType = characterType; }
public static void Draw(ref System.Windows.Forms.PaintEventArgs e, CharacterType type, MovementWay way = MovementWay.Right) { switch (type) { case CharacterType.Packman: e.Graphics.Clear(System.Drawing.SystemColors.Control); e.Graphics.FillEllipse(System.Drawing.Brushes.Yellow, 0, 0, 20, 20); e.Graphics.FillEllipse(System.Drawing.Brushes.Black, new System.Drawing.Rectangle(6, 7, 3, 3)); e.Graphics.FillEllipse(System.Drawing.Brushes.Black, new System.Drawing.Rectangle(12, 7, 3, 3)); e.Graphics.FillEllipse(System.Drawing.Brushes.Black, new System.Drawing.Rectangle(12, 7, 3, 3)); e.Graphics.FillEllipse(System.Drawing.Brushes.Black, new System.Drawing.Rectangle(8, 12, 6, 2)); break; case CharacterType.Enemy: e.Graphics.Clear(System.Drawing.SystemColors.Control); e.Graphics.FillEllipse(System.Drawing.Brushes.Blue, new System.Drawing.Rectangle(0, 0, 20, 25)); e.Graphics.FillEllipse(System.Drawing.Brushes.LightYellow, new System.Drawing.Rectangle(4, 8, 3, 3)); e.Graphics.FillEllipse(System.Drawing.Brushes.LightYellow, new System.Drawing.Rectangle(13, 8, 3, 3)); e.Graphics.FillPolygon(System.Drawing.SystemBrushes.Control, new System.Drawing.Point[] { new System.Drawing.Point(1, 20), new System.Drawing.Point(4, 15), new System.Drawing.Point(7, 20), new System.Drawing.Point(10, 15), new System.Drawing.Point(13, 20), new System.Drawing.Point(16, 15), new System.Drawing.Point(19, 20)}); break; } }
public EnemyCharacter(CharacterType characterType, MonsterController controller) { this.characterType = characterType; MovementSpeed = GameProperties.DEFAULT_ENEMY_SPEED; this.controller = controller; OnDeathAction += OnDeath; SetupCharacter(); }
void SpawnCharacterForPlayer(Player player, CharacterType type, GameObject spawnPoint) { Character newCharacter = (Instantiate(characterPrefab, spawnPoint.transform.position, Quaternion.identity) as GameObject).GetComponent<Character>(); newCharacter.player = player; player.character = newCharacter; newCharacter.InitializeWithType(type); }
public IEnumerator DrawTextBox(string text, float duration, CharacterType Character) { switch (Character) { case CharacterType.Kegan: break; case CharacterType.Klug: break; case CharacterType.Melonee: ProfilePic.sprite = MeloneePic; break; case CharacterType.Brentt: ProfilePic.sprite = BrenttPic; break; case CharacterType.Brandon: ProfilePic.sprite = BrandonPic; break; case CharacterType.Chuck: ProfilePic.sprite = ChuckPic; Debug.Log("ASD"); break; case CharacterType.Nyjel: ProfilePic.sprite = NyjelPic; break; } TextBoxText.text = text; TextBox.SetActive (true); yield return new WaitForSeconds(duration); TextBox.SetActive (false); }
public static Character CreateCharacter(CharacterType newCharacterType, Vector2 position, Tile CurrentTile) { Character newCharacter = null; switch (newCharacterType) { case CharacterType.GRU: newCharacter = CreateGru(position, CurrentTile); break; case CharacterType.MINION_BANANA: newCharacter = CreateBananaMinion(position, CurrentTile); break; case CharacterType.POWERUP_MINION: newCharacter = CreatePowerupMinion(position, CurrentTile); break; case CharacterType.POLICE_OFFICER: newCharacter = CreatePoliceOfficer(position, CurrentTile); break; } return newCharacter; }
/// <summary> /// Initializes a new instance of the <see cref="CharacterDefinition"/> class. /// Creates the animation and frame array and then reads character data from file to fill /// all fields /// </summary> /// <param name="path">The path.</param> public CharacterDefinition(String loadPath, CharacterType type) { Reset(); Path = loadPath; Read(); CharType = (int)type; }
private void InstantiateCharacterTypeInScene(CharacterType characterType) { Character characterPrefab = GetCharacter(characterType); Character character = Instantiate(characterPrefab); character.transform.parent = characterHolder; character.transform.localPosition = Vector3.zero; currentCharacter = character; }
public Pool(CharacterType ctype) { switch (ctype) { case CharacterType.PikeMan: m_pref = (GameObject)Resources.Load("Prefab/AttackEffect/pike_effect"); break; } }
public Pool(CharacterType ctype, PoolType ptype) { switch (ptype) { case PoolType.AttackEffectPool: switch (ctype) { case CharacterType.PikeMan: m_pref = (GameObject)Resources.Load("Prefab/AttackEffect/pike_effect"); break; case CharacterType.GunGirl: m_pref = (GameObject)Resources.Load("Prefab/AttackEffect/gungirl_effect"); break; case CharacterType.SpiderQueen: m_pref = (GameObject)Resources.Load("Prefab/AttackEffect/SpiderQueen_effect"); break; case CharacterType.Zako: m_pref = (GameObject)Resources.Load("Prefab/AttackEffect/Zako_effect"); break; case CharacterType.ZakoFar: m_pref = (GameObject)Resources.Load("Prefab/AttackEffect/syuriken"); break; } break; case PoolType.HitEffectPool: break; } }
/** * Appends a new character to the end of the buffer. * * @param characterType * the type of Arabic letter or Quranic symbol to append, such as * <i>Alif</i> or <i>Ba</i>. */ public void add(CharacterType characterType) { // Check if the buffer is not large enough to support a new character. if (characterCount >= characterCapacity) { // Copy the existing data into a new larger buffer. int newCapacity = characterCapacity * 2; byte[] newBuffer = new byte[newCapacity * ByteFormat.CHARACTER_WIDTH]; Array.Copy(buffer, 0, newBuffer, 0, characterCapacity * ByteFormat.CHARACTER_WIDTH); // Use the new buffer. buffer = newBuffer; characterCapacity = newCapacity; } // Add the character to the end of the buffer. int offset = characterCount * ByteFormat.CHARACTER_WIDTH; buffer[offset] = characterType != null ? (byte)characterType : ByteFormat.WHITESPACE; buffer[offset + 1] = 0; buffer[offset + 2] = 0; // Increment character count. characterCount++; }
public static Pool GetAttackEffectPoolByType(CharacterType ctype) { if (!AEPoolDic.ContainsKey(ctype)) { Pool aePool = new Pool(ctype, Pool.PoolType.AttackEffectPool); AEPoolDic.Add(ctype, aePool); return aePool; } return AEPoolDic[ctype]; }
public void ObjectiveDeactivated(CharacterType type) { if (type == CharacterType.SmallCube) { smallCubeObjectiveMet = false; } else { bigCubeObjectiveMet = false; } }
public RPGCharacter( CharacterType type, string name, bool isLeader, bool isBerserker ) { Weapon = WeaponType.Fists; characterType = type; this.name = name; IsLeader = isLeader; IsBeserker = isBerserker; IsDead = false; }
/// <summary> /// Sets the chosen character type /// </summary> /// <param name="type">the type</param> public void SetCharacterType(CharacterType type) { audioSource.PlayOneShot(GameManager.Instance.GameSounds[Constants.CLICK_SND]); previewObjects[selectedType].SetActive(false); previewObjects[type].SetActive(true); selectedType = type; selectButton.SetActive(true); title.text = classNames[type]; }
void Update () { if (lastCharacterType != characterType || lastLocation != location) { Change(); lastCharacterType = characterType; lastLocation = location; } }
protected bool HasAny(int team, CharacterType type) { return TargetManager.GetTargets(x => x != null && x.Team == team && x.GetComponent<TypeProvider>().Type == type && !x.GetComponent<DeathHandler>().IsDead ).Any(); }
private Texture2D GetTexture (CharacterType character) { foreach(CharacterThumbnail thumbnail in thumbnails) { if(thumbnail.character == character) return thumbnail.thumbnail; } return null; }
public Character GetCharacterByType (CharacterType type) { foreach(Character character in characters) { if(character.characterType == type) return character; } return null; }
void Fx(int id, Gender gender, CharacterType cType) { PlayerFxData fxData; fxData = PlayerFxManager.GetData(id, gender, cType); foreach (PlayerFxDatum d in fxData.data) { StartCoroutine(PlayFx(d)); } }
protected Character(string name, CharacterType characterType) : base(name) { this.CharacterType = characterType; this.levelIncreaseFactor = 1.2; // Base stats this.health = 20; this.damage = 5; this.armor = 3; }
private Character GetCharacter(CharacterType characterType) { LoadCharactersIfNeeded(); foreach (Character character in characters) { if (character.characterType == characterType) return character; } Debug.LogError("could not find character of type: " + characterType); return null; }
public void CharacterTookDamageFromCharacter(CharacterType type, int damageAmount, CharacterType sourceType) { combatTextInc += "\n" + GetCharacterName(sourceType) + " dealt " + damageAmount + " damage to " + GetCharacterName(type) + "."; StartCoroutine(GenerateCombatLog()); if (charactersAreEnemies && !lastLevelEncouragementGiven) { lastLevelTipNeeded = false; lastLevelEncouragementGiven = true; GenerateLastLevelEncouragement(); } }
int GetAnimalIndex(CharacterType type) { switch (type) { case CharacterType.Eagle: return 0; case CharacterType.Pig: return 1; case CharacterType.Bear: return 2; } return -1; }
public void AddItem(Vector2 location, CharacterType characterType) { for (int i = 0; i < bucketItems.Length; i++) { if (bucketItems[i] == null) { bucketItems[i] = new BucketItem(location, characterType); return; } } }
public void PlayDeathSound(CharacterType icon, Vector3 position) { if(icon == CharacterType.Rhino) AudioSource.PlayClipAtPoint(rhinoDeathSound, position); else if(icon == CharacterType.Zebra) AudioSource.PlayClipAtPoint(zebraDeathSound, position); else if(icon == CharacterType.Bird) AudioSource.PlayClipAtPoint(birdDeathSound, position); else if(icon == CharacterType.Tiger) AudioSource.PlayClipAtPoint(tigerDeathSound, position); }
public void CreateCharacter(EPlayerID playerID, CharacterType type, Vector3 spawnPosition) { GameObject character; string charName; Color charColor; if(playerID == EPlayerID.PlayerOne) { character = playerOne; charName = "PLAYER_ONE"; charColor = Color.red; } else { character = playerTwo; charName = "PLAYER_TWO"; charColor = Color.blue; } if(character) Destroy(character); character = (GameObject) Instantiate(Resources.Load(type == CharacterType.Sausage ? "SAUSAGE" : "NINJA")); character.transform.parent = transform; character.GetComponent<PlayerController>().Init(playerID); character.name = charName; character.tag = charName; character.layer = LayerMask.NameToLayer(charName); foreach (Transform child in character.transform) { Renderer rndr = child.gameObject.GetComponent<Renderer>(); if(rndr) { rndr.material.color = charColor; } } Character charaterScript = character.GetComponent<Character>(); charaterScript.Spawn(spawnPosition); charaterScript.SetPlayerID(playerID); charaterScript.game = this; charaterScript.gameManager = gameManager; if(playerID == EPlayerID.PlayerOne) { playerOne = character; } else { playerTwo = character; } }
public CharacterArrayAttribute(CharacterType characterType, int constantLength) { CharacterType = characterType; ConstantLength = constantLength; }
/// <summary> /// Utwórz nową postać do wyświetlenia na planszy. /// </summary> /// <param name="texture">tło postaci</param> /// <param name="color">kolor tła postaci</param> /// <param name="position">pozycja postaci</param> /// <param name="scale">skala rozmiaru postaci</param> /// <param name="angle">kąt nachylenia postaci</param> /// <param name="characterType">rodzaj postaci <example>Ośmiornica</example></param> public Character(Texture2D texture, Color color, Vector2 position, Vector2 scale, float angle, CharacterType characterType) : base(texture, color, position, scale, angle) { CharacterType = characterType; }
public KillableAsciiSprite(CharacterType characterType, string[] frame1, string[] frame2, Point initialLocation, ConsoleColor color) : base( characterType, frame1, frame2, initialLocation, color) { }
/// <summary> /// Generates a random word with the specified length. /// </summary> /// <param name="length">The length.</param> /// <param name="characterType">Type of the character.</param> /// <param name="r">The r.</param> /// <returns></returns> public string Generate(int length, CharacterType characterType, Random r) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < length; ++i) { switch (characterType) { case CharacterType.LowerCase: sb.Append(CHARS_LCASE[r.Next(CHARS_LCASE.Length)]); break; case CharacterType.LowerUpperCase: if (r.Next(0, 2) == 1) { sb.Append(CHARS_LCASE[r.Next(CHARS_LCASE.Length)]); } else { sb.Append(CHARS_UCASE[r.Next(CHARS_UCASE.Length)]); } break; case CharacterType.Numbers: sb.Append(CHARS_NUMERIC[r.Next(CHARS_NUMERIC.Length)]); break; case CharacterType.NumbersLowerCase: if (r.Next(0, 2) == 1) { sb.Append(CHARS_LCASE[r.Next(CHARS_LCASE.Length)]); } else { sb.Append(CHARS_NUMERIC[r.Next(CHARS_NUMERIC.Length)]); } break; case CharacterType.NumbersUpperCase: if (r.Next(0, 2) == 1) { sb.Append(CHARS_UCASE[r.Next(CHARS_UCASE.Length)]); } else { sb.Append(CHARS_NUMERIC[r.Next(CHARS_NUMERIC.Length)]); } break; case CharacterType.UpperCase: sb.Append(CHARS_UCASE[r.Next(CHARS_UCASE.Length)]); break; case CharacterType.NumbersUpperLowerCase: int rNumber = r.Next(0, 3); if (rNumber == 0) { sb.Append(CHARS_LCASE[r.Next(CHARS_LCASE.Length)]); } else if (rNumber == 1) { sb.Append(CHARS_NUMERIC[r.Next(CHARS_NUMERIC.Length)]); } else { sb.Append(CHARS_UCASE[r.Next(CHARS_UCASE.Length)]); } break; } } return(sb.ToString()); }
public Encoder(char charToEncode) { this.charToEncode = charToEncode; this.characterType = GetCharacterType(); }
/// <summary> /// Initialize information /// </summary> /// <param name="iPlayerIndex"></param> /// <param name="iCharacterType"></param> /// <returns></returns> public PlayerInformation Init(PlayerIndex iPlayerIndex, CharacterType iCharacterType = CharacterType.CHARACTER_YELLOW) { this.PlayerIndex = iPlayerIndex; this.SelectedCharacterPath = CharacterPaths.CHARACTER_PATH[iCharacterType]; return(this); }
private void HandleLine(Action <Token> callback, string line) { if (string.IsNullOrEmpty(line)) { return; } CharacterType ct = GetCharType(line[0]); switch (ct) { case CharacterType.TableOpen: { callback(new Token() { type = TokenType.TableStart, content = line[0].ToString() }); break; } case CharacterType.TableClose: { callback(new Token() { type = TokenType.TableEnd, content = line[0].ToString() }); break; } case CharacterType.CommentDelimiter: { if (line.Length < 2 || GetCharType(line[1]) != CharacterType.CommentDelimiter) { throw new UnexpectedCharacterException("Single comment delimiter is not allowed", line[0]); } callback(new Token() { type = TokenType.Comment, content = line }); break; } default: { int endindex; bool isEnd; string text = GetTextToDelimiter(line, 0, out endindex, out isEnd); if (!isEnd) { startedToken = new Token() { type = TokenType.String, content = text }; unclosedLine = true; } else { callback(new Token() { type = TokenType.String, content = text }); if (endindex < line.Length) { HandleLine(callback, line.Substring(endindex).Trim()); } } break; } } }
public void Execute(Entity entity, int index, [ReadOnly] ref CollisionInfo collisionInfo, [ReadOnly] ref SpellCollisionComponent spellCollisionComponent, [ReadOnly] ref DamageComponent damageComponent) { CharacterType targetType = 0; CharacterType casterType = 0; for (var c = 0; c < this.Chunks.Length; c++) { var chunk = this.Chunks[c]; var entities = chunk.GetNativeArray(this.EntityType); var characterComponents = chunk.GetNativeArray(this.CharacterComponentType); for (var i = 0; i < chunk.Count; i++) { if (entities[i] == collisionInfo.Target) { targetType = characterComponents[i].CharacterType; } if (entities[i] == collisionInfo.Sender) { casterType = characterComponents[i].CharacterType; } } } if ((targetType == casterType && spellCollisionComponent.Target != collisionInfo.Sender) || (targetType != casterType && spellCollisionComponent.Target == collisionInfo.Sender)) { this.CommandBuffer.DestroyEntity(index, entity); return; } Entity newEntity; switch (collisionInfo.EventType) { case EventType.TriggerEnter: newEntity = this.CommandBuffer.CreateEntity(index); this.CommandBuffer.AddComponent(index, newEntity, collisionInfo); this.CommandBuffer.AddComponent(index, newEntity, new FinalDamageComponent { DamageType = damageComponent.DamageType, DamageAmount = damageComponent.DamageOnImpact }); break; case EventType.TriggerStay: newEntity = this.CommandBuffer.CreateEntity(index); this.CommandBuffer.AddComponent(index, newEntity, collisionInfo); this.CommandBuffer.AddComponent(index, newEntity, new FinalDamageComponent { DamageType = damageComponent.DamageType, DamageAmount = damageComponent.DamagePerSecond }); break; } this.CommandBuffer.DestroyEntity(index, entity); }
public void SetSelectedCharacterPath(CharacterType iCharacterType) { this.SelectedCharacterPath = CharacterPaths.CHARACTER_PATH[iCharacterType]; Debug.Log(CharacterPaths.CHARACTER_PATH[iCharacterType]); }
public HeroParty(CharacterType userControlledCharacterType, Battlefield battlefield, ICharacterController characterController, string numberallies) : base(userControlledCharacterType, battlefield, characterController, numberallies) { }
public CharacterDialogues GetDialogues(CharacterType character) { return(_characterDialogues[(int)character]); }
//! Get part prefab name. public string PartPrefab(CharacterPart Part, CharacterGroup Group, CharacterType Type) { return(characterParts[Part][Group][(int)Type].prefab); }
public Character(CharacterPoint point, CharacterType type) { Point = point; Type = type; IsCounted = false; }
public PortraitInfo(PortraitPosition portrait, CharacterType character, EmotionType emotion) { portraitType = portrait; characterType = character; emotionType = emotion; }
void PlayChangeEffect(CharacterType characterType) { ParticleSystem.MainModule main = changeEffect.main; main.startColor = changeEffectColor[(int)characterType]; changeEffect.Play(); }
public void ReplaceGenerateCharacterRequest(UnityEngine.Vector2 newPosition, Faction newFaction, CharacterType newCharacterType) { var index = GameComponentsLookup.GenerateCharacterRequest; var component = CreateComponent <GenerateCharacterRequestComponent>(index); component.Position = newPosition; component.Faction = newFaction; component.CharacterType = newCharacterType; ReplaceComponent(index, component); }
public void init(string code, CharacterType type) { characterCode = code; this.type = type; }
void OnGUI() { if (!skin) { skin = Resources.Load("vSkin") as GUISkin; } GUI.skin = skin; m_Logo = Resources.Load("icon_v2") as Texture2D; this.minSize = rect; this.titleContent = new GUIContent("Character", null, "Simple Melee AI Character Creator"); GUILayout.BeginVertical("SIMPLE MELEE AI CHARACTER CREATOR WINDOW", "window"); GUILayout.Label(m_Logo, GUILayout.MaxHeight(25)); GUILayout.Space(5); GUILayout.BeginVertical("box"); EditorGUILayout.HelpBox("This is a Simple Melee AI solution that comes with the Melee Combat Package, if you're looking for a more advanced and customizable AI check our AI Template in the AssetStore, it has Shooter Behavior, Waypoint System, NodeEditor for custom behaviours and more...", MessageType.Info); charType = (CharacterType)EditorGUILayout.EnumPopup("Character Type", charType); if (!charObj) { EditorGUILayout.HelpBox("Make sure to select the FBX model and not a Prefab already with components attached!", MessageType.Info); } else if (!charExist) { EditorGUILayout.HelpBox("Missing a Animator Component", MessageType.Error); } else if (!isHuman) { EditorGUILayout.HelpBox("This is not a Humanoid", MessageType.Error); } else if (!isValidAvatar) { EditorGUILayout.HelpBox(charObj.name + " is a invalid Humanoid", MessageType.Info); } charObj = EditorGUILayout.ObjectField("FBX Model", charObj, typeof(GameObject), true, GUILayout.ExpandWidth(true)) as GameObject; if (GUI.changed && charObj != null && charObj.GetComponent <v_AIController>() == null) { humanoidpreview = Editor.CreateEditor(charObj); } if (charObj != null && charObj.GetComponent <v_AIController>() != null) { EditorGUILayout.HelpBox("This gameObject already contains the component v_AIController", MessageType.Warning); } controller = EditorGUILayout.ObjectField("Animator Controller: ", controller, typeof(RuntimeAnimatorController), false) as RuntimeAnimatorController; GUILayout.EndVertical(); GUILayout.BeginHorizontal("box"); EditorGUILayout.LabelField("Need to know how it works?"); if (GUILayout.Button("Video Tutorial")) { Application.OpenURL("https://www.youtube.com/watch?v=tuwg-H8vjqY&list=PLvgXGzhT_qehtuCYl2oyL-LrWoT7fhg9d&index=3"); } GUILayout.EndHorizontal(); if (charObj) { charAnimator = charObj.GetComponent <Animator>(); } charExist = charAnimator != null; isHuman = charExist ? charAnimator.isHuman : false; isValidAvatar = charExist ? charAnimator.avatar.isValid : false; if (CanCreate()) { DrawHumanoidPreview(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (controller != null) { if (GUILayout.Button("Create")) { Create(); } } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } GUILayout.EndVertical(); }
public CharacterTypeEncodingRules(CharacterType characterType) { this.characterType = characterType; }
/// <summary> /// 创建角色(base,无装备,有武器) /// </summary> /// <param name="id">ID</param> /// <param name="name">名字</param> /// <param name="faction">势力(玩家,友军,敌人)</param> /// <param name="type">(英雄,普通)</param> /// <param name="constitution">体质</param> /// <param name="strength">力量</param> /// <param name="agility">灵巧</param> /// <param name="dexterous">洞察</param> /// <param name="concentration">专注</param> /// <param name="weapon">武器</param> /// <param name="allExperience">全部经验</param> /// <param name="skills">技能</param> /// <param name="currentExperience">当前经验</param> public CharacterProperty(int id, string name, CharacterFaction faction, CharacterType type, string sprite, CharacterKind kind, int constitution, int strength, int agility, int dexterous, int concentration, Item weapon, float allExperience, float resistance = 0, int[] skills = null, float currentExperience = 0, int headID = 0, int clothID = 0, int pantsID = 0, int beltID = 0, BuffProp buffProp = null) { #region 装备处理 if (this.EquipmentProp == null) { this.EquipmentProp = new EquipProp(headID, clothID, pantsID, beltID); } if ((headID != 0) || (clothID != 0) || (pantsID != 0) || (beltID != 0)) { this.EquipmentProp = new EquipProp(headID, clothID, pantsID, beltID); resistance += EquipmentProp.Resistance; constitution += EquipmentProp.Constitution; strength += EquipmentProp.Strength; dexterous += EquipmentProp.Dexterous; agility += EquipmentProp.Agility; concentration += EquipmentProp.Concentration; } #endregion #region 加成处理 if (buffProp != null) { this.BuffItemProp = buffProp; constitution += buffProp.Constitution; strength += buffProp.Strength; dexterous += buffProp.Dexterous; agility += buffProp.Agility; concentration += buffProp.Concentration; //else ... } #endregion this.ID = id; this.Name = name; this.Faction = faction; this.Type = type; this.Sprite = sprite; this.AllExperience = allExperience; this.Resistance = resistance; this.Constitution = constitution; this.Strength = strength; this.Agility = agility; this.Dexterous = dexterous; this.Concentration = concentration; this.HealthLevel = 100; this.charKind = kind; this.Level = CountLevel(allExperience, out currentExperience); this.CurrentExperience = currentExperience; this.Power = constitution + strength + agility + dexterous + concentration; this.WeaponWith = weapon; //通常角色 if (type == CharacterType.Common) { this.MaxHealth = 100 + 3 * constitution; this.MaxStamina = 100 + 1 * constitution; this.HealthRecovery = 0.2f; this.StaminaRecovery = 5f; this.MoveSpeed = 1.3f * (1 + 0.01f * agility); this.AimingSpeed = 2 * (1 + 0.02f * concentration); this.Critical = 0.1f + 0.01f * dexterous; this.MeleeRaise = 1.5f; this.ShootRaise = 1.5f; this.ThrowRaise = 1.5f; this.MaxAngle = 10 * (1 - 0.01f * concentration); this.KickDamage = 20 + strength; this.PunchDamage = 20 + strength; if (weapon is MeleeWeapon) { MeleeWeapon melee = (MeleeWeapon)weapon; this.MeleeDamage = melee.MeleeDamage + strength; this.ThrowDamage = melee.ThrowDamage + strength; this.AttackInterval = melee.AttackInterval * (1 - 0.02f * agility); } else if (weapon is ShootWeapon) { ShootWeapon shoot = (ShootWeapon)weapon; this.MinAngle = (110 - shoot.Accuracy / 15); this.Capacity = shoot.Accuracy * MaxAngle / 10; this.PullingTime = shoot.LaShuanTime * (1 - 0.02f * agility); this.ReloadTime = shoot.ReloadTime * (1 - 0.01f * agility); this.MeleeDamage = shoot.MeleeDamage + strength; this.ShootDamage = shoot.ShootDamage; this.AttackInterval = shoot.AttackInterval * (1 - 0.01f * agility); this.DeclineRange = shoot.DamageRange; } } //英雄角色 else if (type == CharacterType.Hero) { this.SkillA = skills[0]; this.SkillB = skills[1]; this.SkillC = skills[2]; this.SkillD = skills[3]; this.SkillE = skills[4]; this.SkillF = skills[5]; this.SkillG = skills[6]; this.SkillH = skills[7]; this.SkillI = skills[8]; this.SkillJ = skills[9]; this.SkillK = skills[10]; this.SkillL = skills[11]; this.SkillM = skills[12]; this.SkillN = skills[13]; this.SkillO = skills[14]; this.SkillP = skills[15]; this.SkillQ = skills[16]; this.SkillR = skills[17]; this.SkillS = skills[18]; this.SkillT = skills[19]; this.MaxHealth = 100 + 3 * constitution + 20 * SkillA; this.MaxStamina = 100 + 1 * constitution + 20 * SkillF; this.HealthRecovery = 0.2f + 2 * SkillM + 100 * SkillN; this.StaminaRecovery = 5 + 2 * SkillL; this.MoveSpeed = 1.3f * (1 + 0.01f * agility + 0.15f * SkillR); this.AimingSpeed = 2f * (1 + 0.02f * concentration + 0.1f * SkillQ); this.Critical = 0.1f + 0.01f * dexterous + 0.04f * SkillD; this.MeleeRaise = 1.5f + 0.5f * SkillI; this.ShootRaise = 1.5f + 0.5f * SkillJ; this.ThrowRaise = 1.5f + 1 * SkillT; this.MaxAngle = 10 * (1 - 0.01f * concentration - 0.04f * SkillE); this.Resistance = this.Resistance + 0.04f * SkillG + 0.1f * SkillN; this.KickDamage = 20 + 20 * SkillH; if (weapon is MeleeWeapon) { MeleeWeapon melee = (MeleeWeapon)weapon; this.MeleeDamage = (melee.MeleeDamage + strength) * (1 + 0.04f * SkillB); this.AttackInterval = melee.AttackInterval * (1 - 0.02f * agility - 0.04f * SkillC); this.ThrowDamage = melee.ThrowDamage * (1 + SkillT) + strength; } else if (weapon is ShootWeapon) { ShootWeapon shoot = (ShootWeapon)weapon; this.MinAngle = (110 - shoot.Accuracy / 15) * (1 - 0.1f * SkillP); this.Capacity = shoot.Accuracy * MaxAngle / 10f; this.ReloadTime = shoot.ReloadTime * (1 - 0.01f * agility - 0.1f * SkillO); this.PullingTime = shoot.LaShuanTime * (1 - 0.02f * agility - 0.08f * SkillK); this.MeleeDamage = (shoot.MeleeDamage * (1 + SkillT) + strength) * (1 + 0.04f * SkillB); this.ShootDamage = shoot.ShootDamage; this.AttackInterval = shoot.AttackInterval * (1 - 0.01f * agility - 0.04f * SkillC); } } }
public Character GetCharacter(CharacterType characterType) { return(new Character(characterType)); }
protected void refreshQuickLookup() { this.m_quickLookup_perkType.Clear(); for (int i = 0; i < ConfigPerks.ALL_PERKS.Count; i++) { PerkType perkType = ConfigPerks.ALL_PERKS[i]; PerkTypeQuickLookup lookup = new PerkTypeQuickLookup(); int num2 = 0; for (int n = 0; n < this.QuickLookupPerkInstances.Count; n++) { PerkInstance instance = this.QuickLookupPerkInstances[n]; num2 += instance.getPerkInstanceCount(perkType); } lookup.PerkInstanceCount = num2; float num4 = 0f; for (int num5 = 0; num5 < this.QuickLookupPerkInstances.Count; num5++) { float num6 = this.QuickLookupPerkInstances[num5].getGenericModifierForPerkType(perkType); num4 += num6; } lookup.GenericModifierForPerkType = num4; this.m_quickLookup_perkType.Add(perkType, lookup); } this.m_quickLookup_baseStatModifier.Clear(); for (int j = 0; j < ConfigGameplay.ALL_BASE_STAT_PROPERTY_TYPES.Count; j++) { BaseStatProperty prop = ConfigGameplay.ALL_BASE_STAT_PROPERTY_TYPES[j]; float num8 = 0f; for (int num9 = 0; num9 < this.QuickLookupPerkInstances.Count; num9++) { float num10 = this.QuickLookupPerkInstances[num9].getBaseStatModifier(prop); num8 += num10; } this.m_quickLookup_baseStatModifier.Add(prop, num8); } this.m_quickLookup_skillType.Clear(); for (int k = 0; k < ConfigSkills.ALL_HERO_SKILLS.Count; k++) { SkillType skillType = ConfigSkills.ALL_HERO_SKILLS[k]; SkillTypeQuickLookup lookup2 = new SkillTypeQuickLookup(); float num12 = 0f; for (int num13 = 0; num13 < this.QuickLookupPerkInstances.Count; num13++) { float num14 = this.QuickLookupPerkInstances[num13].getSkillDamageModifier(skillType); num12 += num14; } lookup2.SkillDamageModifier = num12; int num15 = 0; for (int num16 = 0; num16 < this.QuickLookupPerkInstances.Count; num16++) { PerkInstance instance5 = this.QuickLookupPerkInstances[num16]; num15 += instance5.getSkillExtraCharges(skillType); } lookup2.SkillExtraCharges = num15; bool flag = false; for (int num17 = 0; num17 < this.QuickLookupPerkInstances.Count; num17++) { PerkInstance instance6 = this.QuickLookupPerkInstances[num17]; if (instance6.hasSkillInvulnerability(skillType)) { flag = true; break; } } lookup2.SkillInvulnerability = flag; float num18 = 0f; for (int num19 = 0; num19 < this.QuickLookupPerkInstances.Count; num19++) { float num20 = this.QuickLookupPerkInstances[num19].getSkillCooldownModifier(skillType); num18 += num20; } lookup2.SkillCooldownModifier = num18; this.m_quickLookup_skillType.Add(skillType, lookup2); } this.m_quickLookup_characterType.Clear(); for (int m = 0; m < ConfigGameplay.ALL_CHARACTER_TYPES_INCLUDING_UNSPECIFIED.Count; m++) { CharacterType characterType = ConfigGameplay.ALL_CHARACTER_TYPES_INCLUDING_UNSPECIFIED[m]; CharacterTypeQuickLookup lookup3 = new CharacterTypeQuickLookup(); float num22 = 0f; for (int num23 = 0; num23 < this.QuickLookupPerkInstances.Count; num23++) { float num24 = this.QuickLookupPerkInstances[num23].getCharacterTypeDamageModifier(characterType); num22 += num24; } lookup3.CharacterTypeDamageModifier = num22; float num25 = 0f; for (int num26 = 0; num26 < this.QuickLookupPerkInstances.Count; num26++) { float num27 = this.QuickLookupPerkInstances[num26].getCharacterTypeArmorModifier(characterType); num25 += num27; } lookup3.CharacterTypeArmorModifier = num25; float num28 = 0f; for (int num29 = 0; num29 < this.QuickLookupPerkInstances.Count; num29++) { float num30 = this.QuickLookupPerkInstances[num29].getCharacterTypeXpModifier(characterType); num28 += num30; } lookup3.CharacterTypeXpModifier = num28; float num31 = 0f; for (int num32 = 0; num32 < this.QuickLookupPerkInstances.Count; num32++) { float num33 = this.QuickLookupPerkInstances[num32].getCharacterTypeCoinModifier(characterType); num31 += num33; } lookup3.CoinModifier = num31; this.m_quickLookup_characterType.Add(characterType, lookup3); } }
/// <summary> /// Generates the specified length. /// </summary> /// <param name="length">The length.</param> /// <param name="characterType">Type of the character.</param> /// <returns></returns> public string Generate(int length, CharacterType characterType) { return(Generate(length, characterType, new Random())); }
public float getCharacterTypeCoinModifier([Optional, DefaultParameterValue(0)] CharacterType characterType) { return(this.m_quickLookup_characterType[characterType].CoinModifier); }
public void SetCharacter(CharacterType newCharacter, GameObject targetCharacter, string playersName, float delay) { Debug.Log("New effect Loaded! " + newCharacter + " " + targetCharacter + " " + playerName + " " + delay); int characterId = characterPortraitLinks.IndexOf(newCharacter); Debug.Log("Character ID: " + characterId); toRender = new List <GameObject>(); if (portrait != null) { portrait.sprite = portraitCharacterLinks[characterId]; toRender.Add(portrait.gameObject); } if (nameplate != null) { nameplate.sprite = portraitNameBoxLinks[characterId]; toRender.Add(nameplate.gameObject); } if (characterName != null) { characterName.text = characterNameLinks[characterId]; toRender.Add(characterName.gameObject); } if (playerName != null) { playerName.text = playersName; toRender.Add(playerName.gameObject); } if (portraitRenderer != null) { portraitRenderer.sprite = portraitCharacterLinks[characterId]; toRender.Add(portraitRenderer.gameObject); } if (nameplateRenderer != null) { nameplateRenderer.sprite = portraitNameBoxLinks[characterId]; toRender.Add(nameplateRenderer.gameObject); } if (playerNameTextMesh != null) { playerNameTextMesh.text = playersName; playerNameTextMesh.GetComponent <MeshRenderer> ().sortingLayerName = sortingLayer; playerNameTextMesh.GetComponent <MeshRenderer> ().sortingOrder = sortingLayerIndex; toRender.Add(playerNameTextMesh.gameObject); } if (characterNameTextMesh != null) { characterNameTextMesh.text = characterNameLinks[characterId]; characterNameTextMesh.GetComponent <MeshRenderer> ().sortingLayerName = sortingLayer; characterNameTextMesh.GetComponent <MeshRenderer> ().sortingOrder = sortingLayerIndex; toRender.Add(characterNameTextMesh.gameObject); } this.targetCharacter = targetCharacter; foreach (var item in toRender) { item.SetActive(false); } this.delay = delay; transform.localScale = Vector3.one; targetPosition = new Vector3(targetCharacter.transform.position.x, targetCharacter.transform.position.y, transform.position.z); StartCoroutine(StartEffect()); }
public float getCharacterTypeXpModifier(CharacterType characterType) { return(this.m_quickLookup_characterType[characterType].CharacterTypeXpModifier); }
public void AddPlayerToCharaterList(GameObject gm, CharacterType typeChar) { CharacterTypeOfGameObject chGmType = new CharacterTypeOfGameObject(gm, typeChar); m_PlayerGameObjectWithType.Add(chGmType); }
private void Awake() { characterType = GetComponentInParent <ICharacter>().CharacterType; }
void SelectCharacterButton(CharacterType type) { EventManager.TriggerEvent(new SelectCharacterEvent(type)); EventManager.TriggerEvent(new ButtonActionEvent(ObjectType.SELECT_GAME)); }
public Dictionary <int, Dictionary <int, List <int> > > GetSkins(CharacterType character) { return(CharacterSkins[character]); }