IEnumerator ExecuteAttack() { int attackIndex = Random.Range(0, attacks.Length); AttackSettings settings = attacks[attackIndex]; animator.SetInteger("attack", settings.index); nexAttack = Time.time + settings.cooldown; yield return(new WaitForSeconds(settings.animationOffset)); RaycastHit hit; if (Physics.Raycast(attackOrigin.position, attackOrigin.forward, out hit, settings.distance, attackFilter)) { //Hit the player Collider col = hit.collider; if (col) { PlayerStats stats = col.GetComponent <PlayerStats>(); if (stats) { stats.ReciveDamage(settings.damage); } } } animator.SetInteger("attack", 0); Debug.Log("Success attack"); }
protected override void OnExecute() { //Check ItemEntity hold by agent if (!agent.ItemEntity || agent.ItemEntity.item.weapon == null || agent.ItemEntity.item.weapon.attacks.Count == 0) { EndAction(false); } else { //Init damageProcessed = false; target = _target.value; //Save inital Target value to prevent from changes before the end of action attack = agent.ItemEntity.item.weapon.attacks[0]; //TODO: other attacks //Start animation if it exists if (attack.animation) { overrideAnimator.ChangeStateAnimationClip("EmptyAction", attack.animation); animator.SetTrigger("Action"); } //Get trail particle trail = agent.ItemEntity ? agent.ItemEntity.GetComponentInChildren <ParticleSystem>() : null; } }
public void LoadObject() { Move = Resources.FindObjectsOfTypeAll <MoveSettings>().First() as MoveSettings; Item = Resources.FindObjectsOfTypeAll <ItemSettings>().First() as ItemSettings; Attack = Resources.FindObjectsOfTypeAll <AttackSettings>().First() as AttackSettings; Game = Resources.FindObjectsOfTypeAll <GameSettings>().First() as GameSettings; }
private static bool LoadSettings(string path) { try { gameSettings = GameSettings.Load(path); } catch (Exception ex) { LogSystem.Error("Error load settings " + path, ex); if (MessageBox.Show(@"Создать настройки по умолчанию? Yes -создадуться настройки поумолчанию. После создания проверьте пожалуйста настройки. No - подправить настройки в ручную и запустить заново бота (Для продвинутых пользователей).", "Незагрузился файл настроек" + path, MessageBoxButtons.YesNo) == DialogResult.Yes) { gameSettings = GameSettings.Create(path); GameSettings.Save(); } else { return(false); } } botvaSettings = gameSettings.BotvaSettings; accountantSettings = botvaSettings.AccountantSettings; minerSettings = botvaSettings.MinerSettings; attackSettings = botvaSettings.AttackSettings; acountSettings = botvaSettings.AcountSettings; return(true); }
protected override void OnUpdate() { weaponItem = inventory.activeItem as WeaponItem; attackSettings = secondary.value ? weaponItem.secondaryAttack : weaponItem.primaryAttack; if (!holdPosition.value && !savedTarget) { EndAction(false); } else { if (holdPosition.value || agent.GoTo(savedTarget.transform.position, Mathf.Max(savedTarget.stopDistance, attackSettings.range))) { isBusy = true; //play animation if (attackSettings.projectile) { Object.Instantiate(attackSettings.projectile, agent.transform.position, savedTarget ? Quaternion.LookRotation(savedTarget.transform.position - agent.transform.position) : agent.transform.rotation); } Collider[] colliders = Physics.OverlapSphere(agent.transform.position, attackSettings.damageRange); for (int i = 0; i < colliders.Length; i++) { Character targetCharacter = colliders[i].gameObject.GetComponent <Character>(); if (targetCharacter && targetCharacter != agent) { targetCharacter.Health -= (weaponItem.damage + attackSettings.additionalDamage) * attackSettings.totalDamageMultiplier; } } EndAction(true); } } }
/// <summary> /// Saves the specified settings. /// </summary> /// <param name="settings">The settings.</param> public void Save(AttackSettings settings) { settings.IgnoreWarsClan = boxIgnoreWarsClan.Checked; settings.AllowLostGlory = checkBoxAllowLostGlory.Checked; settings.AttackTimeShift = (int)boxAttackTimeShift.Value; settings.MinSkillDifference = (int)boxMinSkillDifference.Value; settings.MinBenefit = (int)boxMinBenefit.Value; settings.RivalSources = rivalSourcesControl1.GetValue(); }
/// <summary> /// Shows the specified settings. /// </summary> /// <param name="settings">The settings.</param> public void Show(AttackSettings settings) { boxAttackTimeShift.Value = settings.AttackTimeShift; boxMinSkillDifference.Value = settings.MinSkillDifference; boxMinBenefit.Value = settings.MinBenefit; boxIgnoreWarsClan.Checked = settings.IgnoreWarsClan; checkBoxAllowLostGlory.Checked = settings.AllowLostGlory; rivalSourcesControl1.Show(settings.RivalSources); }
private void btnStartAttack_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(this.tbPassword.Text) || String.IsNullOrEmpty(this.tbUserName.Text) || String.IsNullOrEmpty(this.tbUsernamesFilePath.Text) || String.IsNullOrEmpty(this.tbPasswordFilePath.Text) || String.IsNullOrEmpty(this.cbUrlsToAttack.Text.Trim())) { MessageBox.Show("All of the attack settings should be specified!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } this._attackSettings = new AttackSettings(); this.CreateAttackParams(); this._attackSettings.AttackUrl = this.cbUrlsToAttack.Text.Trim(); this.bgwDictionaryAttack.RunWorkerAsync(); }
public Monster(AttackSettings settings, IOutput output) : base(output) { _attackSettings = settings; }