public static async Task <bool> GapCloser() { if (await S.Cast(SB.ThrowGlaive, C.CombatColor, !Me.IsWithinMeleeRangeOf(CurrentTarget) && CurrentTarget.Distance <= 30, "GapCloser - GlaiveTimer: " + glaiveTossTimer.ElapsedMilliseconds + "ms")) { glaiveTossTimer.Restart(); return(true); } if (await S.Cast(SB.FelBlade, C.CombatColor, T.VengeanceFelblade && !CurrentTarget.IsWithinMeleeRangeOf(Me) && CurrentTarget.MeleeDistance() <= 15, "ST Gap Closer")) { return(true); } if (await S.CastGround(SB.InfernalStrike, C.CombatColor, VS.VengeanceCombatInfernalStrikeGapCloser && !CurrentTarget.IsWithinMeleeRangeOf(Me) && CurrentTarget.MeleeDistance() <= infernalStrikeRange && (S.GetSpellChargeInfo(SB.InfernalStrike).ChargesLeft > 0), "ST Gap Closer")) { return(true); } return(false); }
protected override void MoveTowardsTarget() { Vector3 pos = CurrentTarget.GetPosition(); pos.y = Mathf.Max(TravelHeight, pos.y); SwarmCenter.position = pos; }
/// <summary> /// Specifies the current target when casting spell and sleeps for lag /// </summary> /// <param name="Spell"></param> /// <param name="reqs"></param> /// <returns></returns> public async Task <bool> Cast(int Spell, Color newColor, bool reqs = true) { if (!CurrentTarget.IsValidCombatUnit()) { return(false); } if (!reqs) { //L.combatLog("Trying to cast: " + WoWSpell.FromId(Spell).Name + (String.IsNullOrEmpty(addLog) ? "" : " - " + addLog)); return(false); } if (!SpellManager.CanCast(WoWSpell.FromId(Spell), CurrentTarget, false, false, false)) //Should we check for if out currentTarget is moving? *Second false { return(false); } if (!SpellManager.Cast(Spell, CurrentTarget)) { return(false); } //lastSpellCast = Spell; combatLog("^" + WoWSpell.FromId(Spell).Name, newColor); await CommonCoroutines.SleepForLagDuration(); return(true); }
protected virtual bool ShouldHaunt(out TrinityActor target) { target = null; if (!Skills.WitchDoctor.Haunt.CanCast()) { return(false); } if (Player.PrimaryResource < PrimaryEnergyReserve) { return(false); } if (!CurrentTarget.HasDebuff(SNOPower.Witchdoctor_Haunt)) { target = CurrentTarget; return(target != null); } List <TrinityActor> notHaunted; var percentHaunted = TargetUtil.DebuffedPercent(SNOPower.Witchdoctor_Haunt, 20f, out notHaunted); if (percentHaunted >= 0.60f) { return(false); } target = notHaunted.FirstOrDefault(); return(target != null); }
/// <summary> /// When overridden in a derived class, gives the class an opportunity to monitor the current target. /// </summary> protected override void MonitorCurrentTargetOverride() { var currentTarget = CurrentTarget as DependencyObject; if (currentTarget != null) { //var dpd = DependencyPropertyDescriptor.FromProperty(_dependencyProperty, currentTarget.GetType()); //if (dpd != null) //{ // dpd.AddValueChanged(currentTarget, CurrentTarget_PropertyChanged); //} var eventInfo = CurrentTarget.GetType().GetEvent(PropertyName + "Changed"); if (eventInfo != null) { var addMethod = eventInfo.GetAddMethod(); if (addMethod != null) { var pi = addMethod.GetParameters()[0]; var d = Delegate.CreateDelegate(pi.ParameterType, this, GetType().GetMethod("CurrentTarget_PropertyChanged", BindingFlags.Public | BindingFlags.Instance)); addMethod.Invoke(CurrentTarget, new object[] { d }); } } } }
public void SetTarget(object Item) { if (CurrentTarget is IDesignUpdate) { CurrentTarget.CollectionChanged(); } }
private void StartGravity() { Vector3D position = MyEntity.GetPosition(); foreach (MyPlanet planet in Globals.AllPlanets()) { if (planet.IsPositionInGravityWell(position)) { Vector3D targetPosition = CurrentTarget.GetPosition(); if (!planet.IsPositionInGravityWell(targetPosition)) { Log.DebugLog("Target is not in gravity well, target position: " + targetPosition + ", planet: " + planet.getBestName(), Logger.severity.WARNING); return; } Vector3 gravAtTarget = planet.GetWorldGravityNormalized(ref targetPosition); m_gravData = new GravityData(planet, gravAtTarget); break; } } if (m_gravData != null) { UpdateGravity(); } }
public void StoreTarget() { if (shouldWrite) { File.WriteAllText(targetFile, CurrentTarget.AbsoluteUriTrimmed()); // NB: trim end! } }
public void DealDamage() { if (CurrentTarget != null) { CurrentTarget.GetComponent <IDamagable>().TakeDamage(Damage, transform, IsCrit()); } }
protected override bool ShouldSoulHarvest(out Vector3 position) { // We don't need to restrict harvest too much the CD with set reductions is very quick. position = Vector3.Zero; if (!Skills.WitchDoctor.SoulHarvest.CanCast()) { return(false); } var needStacks = Skills.WitchDoctor.SoulHarvest.BuffStacks <= 2; if (!needStacks) { var primaryTargetHaunted = CurrentTarget.HasDebuff(SNOPower.Witchdoctor_Haunt); var primaryTargetSwarmed = CurrentTarget.HasDebuff(SNOPower.Witchdoctor_Locust_Swarm); if (!primaryTargetHaunted || !primaryTargetSwarmed) { return(false); } } position = TargetUtil.GetBestClusterPoint(); return(position != Vector3.Zero); }
public unsafe void ChangeResolution(int width, int height) { _width = width; _height = height; //Clear the current render target DeviceContext.OMSetRenderTargets(_context, 0, null, IntPtr.Zero); //Release all target objects, including _defaultRenderTarget ReleaseRenderTargets?.Invoke(); //Release the default render view (containing reference to the back buffer) NativeHelper.Dispose(ref _defaultRenderView); //Resize swapchain SwapChain.ResizeBuffers(_swapchain, 1, (uint)width, (uint)height, 28 /*R8G8B8A8_UNorm*/, 0).Check(); //Get the new back buffer and create default view RebuildBackBuffer(); //Rebuild all target objects RebuildRenderTargets?.Invoke(); //Apply current RenderTarget CurrentTarget.Apply(); //Invoke external event ResolutionChanged?.Invoke(this, EventArgs.Empty); }
private void EnemyAttack() { if (CurrentTarget != null) { CurrentTarget.TakeDamage(Attack); } }
public void PickupGuest() { Debug.Log("PickupTarget"); CurrentTarget.ToggleKinematic(true); carrier = new GameObject("carrier"); carrier.transform.parent = transform; carrier.transform.position = CurrentTarget.transform.position; CurrentTarget.transform.parent = carrier.transform; Vector3[] tempPath = new Vector3[pickupPath.path.Length + 1]; tempPath[0] = carrier.transform.localPosition; for (int i = 1; i < tempPath.Length; i++) { tempPath[i] = pickupPath.path[i - 1]; } System.Action next = this.FinishPickup; iTween.RotateTo(CurrentTarget.transform.gameObject, iTween.Hash("islocal", true, "rotation", new Vector3(0f, 0f, 90f), "time", pickupAnimationTime)); iTween.MoveTo(carrier, iTween.Hash("movetopath", false, "path", tempPath, "position", gameObject.transform.position + Vector3.up * 5f, "time", pickupAnimationTime, "easetype", iTween.EaseType.easeInExpo, "oncomplete", next.Method.Name, "islocal", true, "oncompletetarget", this.gameObject)); }
public void OnDealDamage() { switch (currentState) { case EnemyState.WALKING: break; case EnemyState.ATTACK_PLAYER: HealthLogic playerHealth = CurrentTarget.GetComponent <HealthLogic>(); playerHealth.OnReceiveDamage(attackDamage); if (playerHealth.health <= 0) { SetState(EnemyState.WALKING); return; } if (transform.position.DistanceGreaterThan(playerAttackDistance, CurrentTarget.position)) { SetState(EnemyState.CHASING); } break; case EnemyState.ATTACK_BASE: baseHealth?.OnReceiveDamage(attackDamage); break; case EnemyState.CHASING: break; case EnemyState.DEAD: break; } }
/// <summary> /// Change the base color of the current query target based on the given color. /// </summary> /// <param name="color">Highlight tint</param> private void HighlightTarget(Color color) { Renderer[] renderers = CurrentTarget.GetComponents <Renderer>(); if ((renderers.Length > 0) && (renderers[0].materials.Length > 0)) { renderers[0].materials[0].color = color; } }
private void MainForm_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { CurrentTarget.Target = false; CurrentTarget.Refresh(); } }
public void DeselectTarget() { if (CurrentTarget != null) { CurrentTarget.Deselect(); Publish(new TargetSelected(null)); } }
protected override void DiscardCurrentTargetOverride() { CurrentTarget?.GetType().GetEvent(PropertyName + "Changed")?.GetRemoveMethod() .Invoke(CurrentTarget, new object[] { _actualHandler }); }
public void TargetReached() { Destroy(this.currentBall); currentBall = null; CurrentTarget.ReceiveDamage(this, GetComponent <UnitAttributes>().GetAttributeValue(Attribute.Attack)); OnAttackFinished.Invoke(); }
public override bool IsFindNextEnemy() { if (!CurrentTarget || !CurrentTarget.IsAlive || !CurrentTarget.IsEnemy(Camp)) { return(true); } return(false); }
protected override void MonitorCurrentTargetOverride() { if (CurrentTarget is INotifyPropertyChanged notifyPropertyChanged) { notifyPropertyChanged.PropertyChanged += _weakHandlerWrapper; } _propertyReader = PropertyReaderFactory.Create <object>(CurrentTarget.GetType(), PropertyName); }
public virtual bool IsFindNextEnemy() { if (!CurrentTarget || !CurrentTarget.IsAlive || !CurrentTarget.IsEnemy(Camp)) { return(true); } return(CurrentTarget.transform.position.SqrDistanceWith(transform.position) > fAttackMaxRange * fAttackMaxRange); }
protected override bool TryCastShot() { if (Comp != null) { return(Comp.TryUseCharge(CurrentTarget.ToTargetInfo(CurrentTarget.Thing.Map), Caster)); } return(false); }
private void WorkPanel_MouseDown(object sender, EventArgs e) { CurrentTarget = sender as PanelElement; PrevTarget.Target = false; CurrentTarget.Target = true; CurrentTarget.Refresh(); PrevTarget.Refresh(); PrevTarget = CurrentTarget; }
public void SetTarget(object Item) { Filter = (FilterItems)((IDesignHelper.ISideMenu)Item).Data; if (CurrentTarget is IDesignUpdate) { CurrentTarget.CollectionChanged(); } }
protected override void MonitorCurrentTargetOverride() { CurrentTarget?.GetType().GetEvent(PropertyName + "Changed")?.GetAddMethod() .Invoke(CurrentTarget, new object[] { _actualHandler }); _propertyReader = PropertyReaderFactory.Create <object>(CurrentTarget?.GetType(), PropertyName); }
public void FinishPickup() { Debug.Log("FinishPickup"); // TO DO fix NullRefereneException when picking up multiple guests in a row CurrentTarget.transform.parent = transform; Destroy(carrier, 1f); CurrentTarget.GetPickedUp(); HoldingGuest = true; }
public override void Shoot() { if (CurrentTarget != null) { CurrentTarget.GetComponent <Enemy>().TakeDamage(damage); } SoundEffectManager.PlaySound("Shoot"); }
public void KeepInBounds(decimal width, decimal height) { if (Location.IsOutOfBounds(width, height, out var dx, out var dy)) { Location = Location.Add(dx, dy); NextTarget = NextTarget.Add(dx, dy); CurrentTarget = CurrentTarget.Add(dx, dy); } }
private void FireFlamer() { if (flamerEffect.isPlaying == false) { flamerEffect.Play(); } CurrentTarget.TakeDamage(flamerDamage * Time.deltaTime); }