public IEnumerable <Act.Status> SummonSkeletons() { while (true) { Skeletons.RemoveAll(skeleton => skeleton.IsDead); if (SummonTimer.HasTriggered && Skeletons.Count < MaxSkeletons) { SummonTimer.Reset(SummonTimer.TargetTimeSeconds); for (int i = Skeletons.Count; i < MaxSkeletons; i += 2) { SummonSkeleton(); } yield return(Act.Status.Success); } else if (SummonTimer.HasTriggered) { yield return(Act.Status.Success); } SummonTimer.Update(DwarfTime.LastTime); if (WanderTimer.HasTriggered) { Physics.ApplyForce(MathFunctions.RandVector3Box(-5f, 5f, 0.01f, 0.01f, -5f, 5f), 1f); GatherSkeletons(); } WanderTimer.Update(DwarfTime.LastTime); if (AttackTimer.HasTriggered) { OrderSkeletonsToAttack(); } AttackTimer.Update(DwarfTime.LastTime); yield return(Act.Status.Running); } }
public static bool ApplyAttack(Mobile m) { if (IsUnderAttackEffect(m)) return false; m_AttackTable[m] = new AttackTimer(m); m.SendLocalizedMessage(1062319); // Your attack chance has been reduced! return true; }
/// <summary> /// Manages what happens when the game is done /// </summary> private void EndOfGame() { AttackTimer.Stop(); ShowEndWarTextImage(); WinnerAnnouncement(); WinnerSound(); //new ManualResetEvent(false).WaitOne(5000); //Application.Exit(); }
// Update is called once per frame void Update() { pos = this.transform.position; PauseTimer.updateTimer(Time.deltaTime); AttackTimer.updateTimer(Time.deltaTime); LightTimer.updateTimer(Time.deltaTime); if (player.getposition().x < pos.x) { sr.flipX = false; if (player.getposition().y < 6 && pos.x > (initialx - 12) && pos.x <= initialx) { transform.Translate(Vector2.left * speed / 10); } } if (player.getposition().x > pos.x) { sr.flipX = true; if (player.getposition().y < 6 && pos.x > (initialx - 12) && pos.x <= initialx) { transform.Translate(Vector2.right * speed / 10); } } //For the pause and the light if (wait && PauseTimer.stopped()) { isattacking = true; wait = false; AttackTimer.startTimer(); anim.CrossFade("attack", 0f); GameObject.Find("Light").GetComponent <Light> ().intensity = 1.3f; } if (!wait && AttackTimer.stopped()) { isattacking = false; wait = true; PauseTimer.startTimer(); anim.CrossFade("Idle", 0f); LightTimer.startTimer(); } if (wait && LightTimer.stopped()) { GameObject.Find("Light").GetComponent <Light> ().intensity = 3.0f; } if (healthManager.dead()) { Instantiate(FlowerPrefabs, FlowerInstantiate.transform.position, FlowerInstantiate.rotation); Destroy(background_before); targetSliderOject.SetActive(false); Destroy(gameObject); } }
public void Attack() { AttackTimer.Restart(); var enemy = Game.Enemies.FirstOrDefault(x => x.Location == Location + (Size)(LookDirection == Look.Right ? new Point(1, 0) : new Point(-1, 0))); enemy?.GetDamage(Damage); }
public void Attack() { SetLookDirectionToPlayer(); AttackTimer.Restart(); if (Game.Player.IsBlocking && Game.Player.LookDirection != LookDirection) { return; } Game.Player.GetDamage(Damage); }
public override void _Ready() { this.AddChild(this.LineDrawer); RangeArea.Connect("body_entered", this, nameof(On_Area_Entered)); RangeArea.Connect("body_exited", this, nameof(On_Area_Exited)); this.AddChild(AttackTimer); AttackTimer.OneShot = false; AttackTimer.Connect("timeout", this, nameof(On_Attack_Timeout)); }
public static bool ApplyAttack(Mobile m) { if (IsUnderAttackEffect(m)) { return(false); } m_AttackTable[m] = new AttackTimer(m); m.SendLocalizedMessage(1062319); // Your attack chance has been reduced! return(true); }
public static bool ApplyAttack(Mobile m) { if (IsUnderAttackEffect(m)) { return(false); } m_AttackTable[m] = new AttackTimer(m); BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.HitLowerAttack, 1151315, 1151314, AttackEffectDuration, m, "25")); m.SendLocalizedMessage(1062319); // Your attack chance has been reduced! return(true); }
public void On_Attack_Timeout() { if (CloseEnemies.Count > 0) { this.Attack(); this.AttackTimer.Start(AttackDelay); } else { Attacking = false; AttackTimer.Stop(); } }
protected override void LoadComponents() { base.LoadComponents(); unitTraits = GetComponent <UnitTraits>(); unitRelationships = GetComponent <UnitRelationships>(); unitController = GetComponent <UnitController>(); unitAnim = GetComponent <UnitAnimController>(); attackTimer = GetComponent <AttackTimer>(); bodyController = GetComponent <BodyPartController>(); combatSkills = GetComponent <CombatSkills>(); attack1Parts = bodyController.attack1Parts; //main attack2Parts = bodyController.attack2Parts; //off }
public static void ApplyAttack( Mobile m ) { if ( IsUnderAttackEffect( m ) ) m_AttackTable[m].Stop(); TimeSpan duration = AttackEffectDuration; if ( m.Weapon is BaseRanged ) duration -= TimeSpan.FromSeconds( 3.0 ); BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.HitLowerAttack, 1151315, 1151314, duration, m, "25" ) ); m_AttackTable[m] = new AttackTimer( m, duration ); m.SendLocalizedMessage( 1062319 ); // Your attack chance has been reduced! }
public IEnumerable <Act.Status> SummonSkeletons() { while (true) { Skeletons.RemoveAll(skeleton => skeleton.IsDead); Creature.CurrentCharacterMode = CharacterMode.Idle; Creature.OverrideCharacterMode = false; SummonTimer.Update(DwarfTime.LastTime); if (SummonTimer.HasTriggered && Skeletons.Count < MaxSkeletons) { Creature.CurrentCharacterMode = Creature.Stats.CurrentClass.AttackMode; Creature.OverrideCharacterMode = true; Creature.Sprite.ReloopAnimations(Creature.Stats.CurrentClass.AttackMode); SoundManager.PlaySound(ContentPaths.Audio.Oscar.sfx_ic_necromancer_summon, Position, true); SummonTimer.Reset(SummonTimer.TargetTimeSeconds); for (int i = Skeletons.Count; i < MaxSkeletons; i += 2) { SummonSkeleton(); } yield return(Act.Status.Success); } else if (SummonTimer.HasTriggered) { yield return(Act.Status.Success); } GatherSkeletonsTimer.Update(DwarfTime.LastTime); if (GatherSkeletonsTimer.HasTriggered) { var wander = new WanderAct(this, GatherSkeletonsTimer.TargetTimeSeconds, 1.0f, 1.0f); foreach (var status in wander.Run()) { GatherSkeletons(); yield return(Act.Status.Running); } } AttackTimer.Update(DwarfTime.LastTime); if (AttackTimer.HasTriggered) { OrderSkeletonsToAttack(); } yield return(Act.Status.Running); } }
private void Attack() { AttackInfo myAttack; AttackTimer attackTimer = usm.attackTimer; BodyPartController myBody = usm.bodyController; CombatSkills mySkills = usm.combatSkills; if (Random.Range(0, 100) <= 75) { if (!myBody.PartTooInjured(attack1Parts)) { AttackAnimation(); myAttack = mySkills.RequestAttackInfo(attack1Parts[0].MyWeapon()); } else { string line = "<color=red>" + gameObject.name + " is too injured to attack with their " + attack1Parts[0].MyWeapon().name + "</color>"; FloatingTextController.CreateFloatingText("Too injured!", transform, Color.red); BattleReport.AddToBattleReport(line); attackTimer.ResetAttackTimer(7f); //arbitrarily reset attack timer to prevent attack //unit reactions -> run away if not player? return; } } else { if (!myBody.PartTooInjured(attack2Parts)) { AttackAnimation(); myAttack = mySkills.RequestAttackInfo(attack2Parts[0].MyWeapon()); } else { string line = "<color=red>" + gameObject.name + " is too injured to attack with their " + attack2Parts[0].MyWeapon().name + "</color>"; FloatingTextController.CreateFloatingText("Too injured!", transform, Color.red); BattleReport.AddToBattleReport(line); attackTimer.ResetAttackTimer(7f); //arbitrarily reset attack timer to prevent attack //unit reactions -> run away if not player? return; } } Debug.Log(gameObject.name + " attacking with reset timer of " + myAttack.speed); targetBody.RecieveAttack(myAttack, transform); //should reset back to whatever weapon was used attackTimer.ResetAttackTimer(myAttack.speed); }
public void On_Area_Entered(Node body) { if (body.IsInGroup("Enemies")) { Enemy enemy = body.GetOwner <Enemy>(); CloseEnemies.Add(WeakRef(enemy)); enemy.Connect("EnemyDied", this, nameof(this.RemoveEnemy)); if (CloseEnemies.Count > 0 && !Attacking) { Attacking = true; this.Attack(); AttackTimer.Start(AttackDelay); } } }
public static void ApplyAttack(Mobile m) { if (IsUnderAttackEffect(m)) { m_AttackTable[m].Stop(); } TimeSpan duration = AttackEffectDuration; if (m.Weapon is BaseRanged) { duration -= TimeSpan.FromSeconds(3.0); } BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.HitLowerAttack, 1151315, 1151314, duration, m, "25")); m_AttackTable[m] = new AttackTimer(m, duration); m.SendLocalizedMessage(1062319); // Your attack chance has been reduced! }
/// <summary> /// Updates a Monster /// </summary> public new void Update() { base.Update(); AttackTimer.Update(); MoveTimer.Update(); if (MoveTimer.ActionReady) { if (MoveToLowestWeight()) { return; } if (GameManager.Random.Next(0, 100) == 0) { RegenHealth(); MoveRandomOne(); } } }
public void Attack() { SetLookDirectionToPlayer(); AttackTimer.Restart(); SpawnSkeleton(); }