public void Init(Transform parent, AbilityTypes type) { //Follow if (m_FollowController == null) { m_FollowController = GetComponent <FollowTransformController> (); } m_FollowController.Init(parent); //Rotation m_TargetRot = parent.rotation; //Color if (m_Material == null) { m_Material = new Material(Renderer.sharedMaterial); Renderer.sharedMaterial = m_Material; } //Length Vector3 scale = transform.localScale; scale.z = GameManager.Instance.GameState.DataTableAbilities.GetAbilityData(type).Length; transform.localScale = scale; m_Material.color = GameManager.Instance.GameState.AbilityColorController.GetAbilityColor(type); m_IsActive = true; }
/// <summary> /// Заупск снаряда способности /// </summary> /// <param name="type">Type.</param> /// <param name="dir">Dir.</param> void LaunchProjectile(AbilityTypes type, Vector2 dir, int senderTeamID) { Projectile projectile = PoolManager.GetObject(GameManager.Instance.PrefabLibrary.GetAbilityProjectilePrefab(type)) as Projectile; projectile.transform.position = AbilitySpawnPoint.position; projectile.Launch(dir, type, senderTeamID, GameManager.Instance.GameState.DataTableAbilities.GetAbilityData(type).Length); }
void CreateParticles(AbilityTypes type, Vector3 position, Vector3 origin, float angle, float radius) { int step = 20; float angleBetweenOriginAndForward = Vector3.Angle(Vector3.forward, origin); float dot = Vector3.Dot(Vector3.right, origin); float sign = Mathf.Sign(dot); Debug.Log("Shield angle: " + angle + " OriginAndForward Angle: " + angleBetweenOriginAndForward + " Dot: " + dot); int startAngle = (int)((angleBetweenOriginAndForward + angle) * sign); int finishAngle = startAngle + (int)(angle * 2 * -sign); Debug.Log("Start angle: " + startAngle + " Finish angle: " + finishAngle + " " + Mathf.CeilToInt(angle * 2 / step)); for (int i = startAngle; sign > 0 ? i > finishAngle : i < finishAngle; i += step * -(int)sign) { float scale = 1f; Vector3 pos = PositionOnCircle(position, radius, i); ShieldVisualsParticle ob = PoolManager.GetObject(GameManager.Instance.PrefabLibrary.GetAbilityShieldParticlePrefab(type)) as ShieldVisualsParticle; ob.transform.localScale = new Vector3(scale, scale, scale); ob.transform.position = pos; ob.transform.rotation = Quaternion.LookRotation(pos - position); m_Particles.Add(ob); } }
public void Init(AbilityTypes type, int health) { m_LerpData = new Utils.InterpolationData <float>(AnimationTime); m_MaxHealth = health; switch (type) { case AbilityTypes.Blue: Image_FG.color = Color.blue; break; case AbilityTypes.Green: Image_FG.color = Color.green; break; case AbilityTypes.Red: Image_FG.color = Color.red; break; case AbilityTypes.Violet: Image_FG.color = Color.magenta; break; case AbilityTypes.Yellow: Image_FG.color = Color.yellow; break; default: Image_FG.color = Color.white; break; } }
/// <summary> /// Добавить определенное количество зарядов конкретной способности /// </summary> /// <param name="type">Тип способности</param> /// <param name="ammoAmount">Количество зарядов</param> public void AddAmmo(AbilityTypes type, int ammoAmount) { if (m_Abilities.ContainsKey(type)) { m_Abilities[type].AddAmmo(ammoAmount); } }
public void OperatorEqualTest(string referenceId, string buttonId, AbilityTypes abilityTypes, bool isPassive, AbilityTiers tier, string referenceId2, string buttonId2, AbilityTypes abilityTypes2, bool isPassive2, AbilityTiers tier2) { Ability ability2 = new Ability() { AbilityTalentId = new AbilityTalentId(referenceId2, buttonId2) { AbilityType = abilityTypes2, IsPassive = isPassive2, }, Tier = tier2, }; Ability ability = new Ability() { AbilityTalentId = new AbilityTalentId(referenceId, buttonId) { AbilityType = abilityTypes, IsPassive = isPassive, }, Tier = tier, }; #pragma warning disable SA1131 // Use readable conditions Assert.IsFalse(null ! == ability2); #pragma warning restore SA1131 // Use readable conditions Assert.IsFalse(ability2 == null !); Assert.IsTrue(null ! == (AbilityTalentId)null !); Assert.IsTrue(ability == ability2); Assert.AreEqual(ability.GetHashCode(), ability2 !.GetHashCode()); }
/// <summary> /// Использовать способность /// </summary> /// <param name="type">Тип способности</param> /// <param name="dir">Направление способности</param> /// <returns>true если способность была применена</returns> public void TryUseAbility(AbilityTypes type, Vector2 dir, int senderTeamID) { //Если у персонажа есть способность if (m_Abilities.ContainsKey(type)) { CreatureAbility ability = m_Abilities[type]; int abilityCode = CanUseABility(ability); if (abilityCode == ABILITY_CAN_USE) { ability.Use(); LaunchProjectile(type, dir, senderTeamID); if (OnAbilityUse != null) { OnAbilityUse(type); } } else { Debug.Log("CANT USE ABILITY. REASON " + abilityCode); } } }
public BaseAbility(Dictionary <string, string> abilityDictionary) { string[] delimiter = new string[] { " " }; _name = abilityDictionary["Name"]; _description = abilityDictionary["Description"]; _ID = int.Parse(abilityDictionary["ID"]); _type = (AbilityTypes)System.Enum.Parse(typeof(BaseAbility.AbilityTypes), abilityDictionary["Type"].ToString()); _currentRank = int.Parse(abilityDictionary["CurrentRank"]); _maxRank = int.Parse(abilityDictionary["MaxRank"]); _statusEffect = abilityDictionary["StatusEffect"]; string[] tempDamage = abilityDictionary["Damage"].Split(delimiter, StringSplitOptions.None); for (int i = 0; i < tempDamage.Length; i++) { _damage.Add(int.Parse(tempDamage[i])); } string[] tempCost = abilityDictionary["Cost"].Split(delimiter, StringSplitOptions.None); for (int i = 0; i < tempCost.Length; i++) { _cost.Add(int.Parse(tempCost[i])); } string[] tempXPToLevel = abilityDictionary["XPToLevel"].Split(delimiter, StringSplitOptions.None); for (int i = 0; i < tempXPToLevel.Length; i++) { _xpToLevel.Add(int.Parse(tempXPToLevel[i])); } }
IEnumerator AbilityActive(AbilityTypes type) { IsEnabled = false; if (type == AbilityTypes.Dodge) { movementSpeed = dodge.movementSpeed; rotationSpeed = dodge.rotationSpeed; yield return(dodge.waitTime); } else if (type == AbilityTypes.Glimmer) { movementSpeed = swiftMinor.movementSpeed; rotationSpeed = swiftMinor.rotationSpeed; yield return(swiftMinor.waitTime); } else if (type == AbilityTypes.EnergizedGlimmer) { movementSpeed = swiftMajor.movementSpeed; rotationSpeed = swiftMajor.rotationSpeed; yield return(swiftMajor.waitTime); } IsEnabled = true; movementSpeed = normalMovementSpeed; rotationSpeed = normalRotationSpeed; }
public void CreateShield(Vector3 position, Vector3 origin, float angle, AbilityTypes type, int senderTeamID) { if (angle < m_MIN_ANGLE_TO_CREATE) { Debug.Log("ShieldController: Cannot create shield. Angle is to small"); return; } //Создать визуальное отображение щита ShieldVisuals shieldObj = PoolManager.GetObject(GameManager.Instance.PrefabLibrary.ShieldVisualsPrefab) as ShieldVisuals; //Создать програмное представление щита Shield shield = new Shield(position, origin, ShieldRadius, angle, type, senderTeamID, shieldObj); //Задать событие на уничтожение щита shieldObj.OnTimeElapsed = () => { GameManager.Instance.GameState.DataContainerController.ShieldContainer.RemoveShield(shield); }; //Добавить програмное представление щита в список активных щитов GameManager.Instance.GameState.DataContainerController.ShieldContainer.AddShield(shield); //Инициализировать визуальное обображение щита shieldObj.Init(type, position, origin, ShieldRadius, angle, ShieldExistsTimeMiliseconds); }
} //Окончание инициализации //Обработка public virtual void SelectAbility(AbilityTypes abilityType) { if (m_SelectedAbility != abilityType) { m_SelectedAbility = abilityType; m_AbilityController.SelectAbilityEffect(abilityType); } }
public bool AddAbility(AbilityTypes ability) { if (IsEnabled) { PlayerComponent.AddAbility(ability); } return(true); }
void VirtualJoystickUpdateAbilityAmmo(AbilityTypes type, int ammoAmount) { AbilityVirtualButtonWrapper targetJoystick = InputManager.Instance.VirtualJoystickInput.GetAbilityJoystick(type); if (targetJoystick != null) { targetJoystick.UpdateAbilityAmmo(ammoAmount); } }
private Dictionary <AbilityTypes, AbilityVirtualButtonWrapper> m_AbilityWrappers; //Словарь создан для более удобного доступа к способностям public AbilityVirtualButtonWrapper GetAbilityJoystick(AbilityTypes type) { if (m_AbilityWrappers.ContainsKey(type)) { return(m_AbilityWrappers[type]); } return(null); }
void VirtualJoystickSelectAbility(AbilityTypes type) { AbilityVirtualButtonWrapper targetJoystick = InputManager.Instance.VirtualJoystickInput.GetAbilityJoystick(type); if (targetJoystick != null) { JoystickSelectionController.Select(targetJoystick.transform); } }
void KeyboardUpdateAbilityAmmo(AbilityTypes type, int ammoAmount) { AbilityKeyboardWrapper targetKeyboard = InputManager.Instance.KeyboardInput.GetAbilityKeyboard(type); if (targetKeyboard != null) { targetKeyboard.UpdateAbilityAmmo(ammoAmount); } }
public void AddAbility(AbilityTypes abilityType) { if (!IsOwner) { return; } photonView.RPC("RpcAddAbility", PhotonTargets.AllBuffered, abilityType, PhotonNetwork.AllocateViewID()); }
/// <summary> /// Выделить способность /// </summary> /// <param name="abilityType"></param> public override void SelectAbility(AbilityTypes abilityType) { if (m_SelectedAbility != abilityType) { GameManager.Instance.UIManager.SelectAbilityVisuals(abilityType); } base.SelectAbility(abilityType); }
public void UpdateUI(AbilityTypes type, int currentHealth) { UIHealthBarSegment segment = GetSegmentForTakeDamage(type); if (segment != null) { segment.UpdateUI(currentHealth); } }
void KeyboardSelectAbility(AbilityTypes type) { AbilityKeyboardWrapper targetKeyboard = InputManager.Instance.KeyboardInput.GetAbilityKeyboard(type); if (targetKeyboard != null) { KeyboardSelectionController.Select(targetKeyboard.transform); } }
public Item GetAbilityItemPrefab(AbilityTypes type) { if (m_AbilityItems.ContainsKey(type)) { return(m_AbilityItems[type].Prefab); } return(null); }
public Color GetAbilityColor(AbilityTypes type) { if (m_AbilityColors.ContainsKey(type)) { return(m_AbilityColors[type].Color); } return(Color.white); }
private Dictionary <AbilityTypes, AbilityKeyboardWrapper> m_KeyboardWrappers; //Словарь создан для более удобного доступа к иконкам способностей public AbilityKeyboardWrapper GetAbilityKeyboard(AbilityTypes type) { if (m_KeyboardWrappers.ContainsKey(type)) { return(m_KeyboardWrappers[type]); } return(null); }
public ShieldVisualsParticle GetAbilityShieldParticlePrefab(AbilityTypes type) { if (m_AbilityShieldParticles.ContainsKey(type)) { return(m_AbilityShieldParticles[type].Prefab); } return(null); }
public Projectile GetAbilityProjectilePrefab(AbilityTypes type) { if (m_AbilityProjectiles.ContainsKey(type)) { return(m_AbilityProjectiles[type].Prefab); } return(null); }
public void EqualsTest(string referenceId, string buttonId, AbilityTypes abilityTypes, bool isPassive) { AbilityTalentId abilityTalentId = new AbilityTalentId(referenceId, buttonId) { AbilityType = abilityTypes, IsPassive = isPassive, }; Assert.AreEqual(abilityTalentId, abilityTalentId); }
void ProcessAbilityKey(KeyCode key, AbilityTypes type) { if (Input.GetKeyUp(key)) { if (OnAbilitySelect != null) { OnAbilitySelect(type); } } }
public bool TryGetAbility(AbilityTypes abilityType, out Ability ability) { ability = null; if (Contains(abilityType)) { ability = lookup[abilityType]; return(true); } return(false); }
/// <summary> /// Можно ли использовать способность (хватает патронов и способность не в откате) /// </summary> public bool CanUseABility(AbilityTypes type) { //Если у персонажа есть способность if (m_Abilities.ContainsKey(type)) { return(CanUseABility(m_Abilities [type]) == ABILITY_CAN_USE); } return(false); }
protected Ability(AbilityTypes type, Being being, TimeSpan cooldown, TimeSpan castTime, float manaCost, string iconFile) { Type = type; Being = being; FullCooldown = cooldown; ManaCost = manaCost; CastTime = castTime; DrawIcon = iconFile != ""; Texture = DrawIcon ? TextureCacheFactory.GetOnce($"Icons/{iconFile}.png") : null; DisabledTexture = DrawIcon ? TextureCacheFactory.GetOnce($"Icons/{iconFile}-grey.png") : null; }
public AbilityBase Create(AbilityTypes abilityTypes) { switch (abilityTypes) { case AbilityTypes.SLOW_TIME: return instantiator.Instantiate<SlowTime>(); case AbilityTypes.SPEED_UP_TIME: return instantiator.Instantiate<BoostTime>(); default: throw new ArgumentOutOfRangeException("abilityTypes"); } }
public CreatureData(string name, ushort hitPoints, uint experiencePoints, ushort summonMana, ushort convinceMana, bool canSeeInvisible, ushort speed, AbilityTypes abilities, DamageTypes immunities, IEnumerable<Damage> damages, IEnumerable<CreatureData> minions, Dictionary<Loot, Loot.Chance> loot) { this.Name = name; this.HitPoints = hitPoints; this.ExperiencePoints = experiencePoints; this.SummonMana = summonMana; this.ConvinceMana = convinceMana; this.CanSeeInvisible = canSeeInvisible; this.Speed = speed; this.Abilities = abilities; this.Immunities = immunities; this.Damages = damages.ToList(); this.Minions = minions.ToList(); this.Loots = loot; }
public bool EquippedAbility(AbilityTypes abilityType) { throw new NotImplementedException(); }