private IEnumerator OnStartAimAtCoroutine(TargetEffect effect) { Vector3 ps, up, dest, dir; float force = 0f; Rigidbody rb; if (!this.target) { yield break; } // Initialize force = 5f; up = this.myTransform.up; ps = this.target.position + (RandomExtension.OnUnitAxisCircle(up) * AIM_TARGET_APPEAR_RADIUS); // Set effect effect.SetOrientation(ps + (up * AIM_TARGET_HEIGHT), up); effect.Launch(this.turret.turretData.aimTargetSmooth, AIM_TARGET_FADE_SPEED); rb = effect.GetComponent <Rigidbody>(); while (this.target) { dest = this.target.position + (up * AIM_TARGET_HEIGHT); dir = dest - rb.position; rb.AddForce(dir * force, ForceMode.Acceleration); if (force < AIM_TARGET_SMOOTH_LIMIT) { force += 25f * Time.deltaTime; } yield return(Yielders.fixedUpdate); } }
public void ShootBallChargedAfterDelay() { Ball ball = m_ball; if (ball == null) { return; } var direction = new Vector2((float)Math.Cos(m_ballAngle), (float)Math.Sin(m_ballAngle)); float impulse = Parameters.ChargedShot.ShotImpulse; impulse *= ComputeSkillCoef("ChargedShotPower", Parameters.Skills.ChargedShotPowerBase, Parameters.Skills.ChargedShotPowerCoef); DettachBall(impulse * direction); BashEffect bashEffect = new BashEffect(); bashEffect.SetDuration(Parameters.ChargedShot.BallBashTimeMS); ball.AddEffect(bashEffect); TargetEffect targetEffect = new TargetEffect(this); targetEffect.SetDuration(Parameters.ChargedShot.BallBashTimeMS); targetEffect.Strength = ComputeSkillCoef("ChargedShotCurve", Parameters.Skills.ChargedShotCurveBase, Parameters.Skills.ChargedShotCurveCoef); ball.AddEffect(targetEffect); ScreenShake.Add(3, direction, 150); m_audioCmpBallShot.Play(); Engine.World.EventManager.ThrowEvent((int)EventId.PlayerShootBallCharged, this); }
/// <summary> /// Triggers the MinDurationEffect with the given TableElementData.<br/> /// The minimal duration is started, if the value portion of the TableElementData parameter is !=0. /// </summary> /// <param name="TableElementData">TableElementData for the TableElement which has triggered the effect.</param> public override void Trigger(Table.TableElementData TableElementData) { if (TargetEffect != null) { Table.TableElementData TED = TableElementData; if (TED.Value != 0) { TargetEffect.Trigger(TED); if (!Active || RetriggerBehaviour == RetriggerBehaviourEnum.RestartEffect) { Table.Pinball.Alarms.RegisterAlarm(MinDurationMs, MinDurationEnd); Active = true; } } else { if (Active) { //Min duration is active, put data in queue UntriggerData.Enqueue(TED.Clone()); } else { //Min duration has ended call target effect directly TargetEffect.Trigger(TED); } } } }
private void DurationEnd(object TableElementData) { Table.TableElementData TED = (Table.TableElementData)TableElementData; TED.Value = 0; TargetEffect.Trigger(TED); Active = false; }
private void MinDurationEnd() { while (UntriggerData.Count > 0) { TargetEffect.Trigger(UntriggerData.Dequeue()); } Active = false; }
/* --------------------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------------------*/ /* --------------------------------------- SUB ACTIONS ----------------------------------------*/ /* --------------------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------------------------*/ public void OnStartAimAt() { // Get effect this.targetEffect = PoolingManager.instance.Get <TargetEffect>(this.turret.turretData.targetPrefab); if (this.targetEffect) { this.turret.StartAndStopCoroutine(ref this.onAimCoroutine, this.OnStartAimAtCoroutine(this.targetEffect)); } }
private void TriggerTargetEffect(object AlarmParameter) { if (TargetEffect != null) { try { TargetEffect.Trigger((TableElementData)AlarmParameter); } catch (Exception E) { Log.Exception("The target effect {0} of the DelayEffect {1} has trown a exception.".Build(TargetEffectName, Name), E); TargetEffect = null; } } }
/// <summary> /// Triggers the DurationEffect with the given TableElementData.<br/> /// The duration is started, if the value portion of the TableElementData parameter is !=0. /// Trigger calls with a TableElement value=0 have no effect. /// </summary> /// <param name="TableElementData">TableElementData for the TableElement which has triggered the effect.</param> public override void Trigger(Table.TableElementData TableElementData) { if (TargetEffect != null) { if (!Active || RetriggerBehaviour == RetriggerBehaviourEnum.RestartEffect) { if (TableElementData.Value != 0) { TargetEffect.Trigger(TableElementData); Table.Pinball.Alarms.RegisterAlarm(DurationMs, DurationEnd, TableElementData.Clone()); } Active = true; } } }
private void DoBlink() { BlinkState = !BlinkState; if (BlinkState) { BlinkTableElementData.Value = BlinkOrgTableElementDataValue; Table.Pinball.Alarms.RegisterAlarm(DurationActiveMs, DoBlink); } else { BlinkTableElementData.Value = 0; if (BlinkEnabled) { Table.Pinball.Alarms.RegisterAlarm(DurationInactiveMs, DoBlink); } } TargetEffect.Trigger(BlinkTableElementData); }
public static void SendTargetParticles(IEntity target, int itemID, int speed, int duration, int hue, int renderMode, int effect, EffectLayer layer, int unknown) { if (target is Mobile) { ((Mobile)target).ProcessDelta(); } Map map = target.Map; if (map != null) { Packet particles = null, regular = null; IPooledEnumerable eable = map.GetClientsInRange(target.Location); foreach (NetState state in eable) { state.Mobile.ProcessDelta(); if (SendParticlesTo(state)) { if (particles == null) { particles = new TargetParticleEffect(target, itemID, speed, duration, hue, renderMode, effect, (int)layer, unknown); } state.Send(particles); } else if (itemID != 0) { if (regular == null) { regular = new TargetEffect(target, itemID, speed, duration, hue, renderMode); } state.Send(regular); } } eable.Free(); } //SendPacket( target.Location, target.Map, new TargetParticleEffect( target, itemID, speed, duration, hue, renderMode, effect, (int)layer, unknown ) ); }
/// <summary> /// Triggers the effect with the given TableElementData.<br/> /// Trigger calls of a TableElemenData value which is not equal 0, are forwarded directly to the target effect.<br/> /// Calls with a TableElementData Value of 0, are delayed by the Duration specifed in DurationMs before they are forwarded to the target effect. /// </summary> /// <param name="TableElementData">TableElementData for the TableElement which has triggered the effect.</param> public override void Trigger(Table.TableElementData TableElementData) { if (TargetEffect != null) { if (TableElementData.Value != 0) { TargetEffect.Trigger(TableElementData); } else { if (DurationMs > 0) { Table.Pinball.Alarms.RegisterAlarm(DurationMs, TriggerTargetEffect, TableElementData, true); } else { TargetEffect.Trigger(TableElementData); } } } }
public static void SendTargetParticles(IEntity target, int itemID, int speed, int duration, int hue, int renderMode, int effect, EffectLayer layer, int unknown) { if ((target is Mobile)) { ((Mobile)target).ProcessDelta(); } Map map1 = target.Map; if (map1 == null) { return; } Packet packet1 = null; Packet packet2 = null; IPooledEnumerable enumerable1 = map1.GetClientsInRange(target.Location); foreach (NetState state1 in enumerable1) { state1.Mobile.ProcessDelta(); if (Effects.SendParticlesTo(state1)) { if (packet1 == null) { packet1 = new TargetParticleEffect(target, itemID, speed, duration, hue, renderMode, effect, layer, unknown); } state1.Send(packet1); continue; } if (itemID != 0) { if (packet2 == null) { packet2 = new TargetEffect(target, itemID, speed, duration, hue, renderMode); } state1.Send(packet2); } } enumerable1.Free(); }
public void Cast(Transform user, List <Transform> targets) { if (SpellEffect != null) { IEffectTrigger spellEffectTrigger = SpellEffect.GetComponent <IEffectTrigger>(); if (spellEffectTrigger != null) { spellEffectTrigger.TriggerEffect(user); } } if (TargetEffect != null) { IEffectTrigger targetEffectTrigger = TargetEffect.GetComponent <IEffectTrigger>(); if (targetEffectTrigger != null) { foreach (var v in targets) { targetEffectTrigger.TriggerEffect(v); } } } PhotonClientMgr }
public void OnEndAimAt() { this.targetEffect?.HideAway(AIM_TARGET_FADE_SPEED); this.targetEffect = null; }
// Use this for initialization void Awake() { targetEffect = GetComponent <TargetEffect>(); necessaryKnife = GetComponent <NecessaryKnife>(); }