Skip to content

Commit

Permalink
停電中はエンストする
Browse files Browse the repository at this point in the history
  • Loading branch information
TORISOUP committed Feb 6, 2016
1 parent 04b50a4 commit a903734
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions Inferno/InfernoScripts/Parupunte/Scripts/BlackOut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
using System.IO;
using System.Linq;
using System.Media;
using System.Text;
using System.Threading.Tasks;
using UniRx;

namespace Inferno.InfernoScripts.Parupunte.Scripts
{

class BlackOut : ParupunteScript
{
private SoundPlayer soundPlayerStart;
Expand All @@ -24,7 +23,7 @@ public BlackOut(ParupunteCore core) : base(core)

public override void OnStart()
{
ReduceCounter = new ReduceCounter(15 * 1000);
ReduceCounter = new ReduceCounter(20 * 1000);
AddProgressBar(ReduceCounter);
ReduceCounter.OnFinishedAsync.Subscribe(_ =>
{
Expand All @@ -39,6 +38,25 @@ public override void OnStart()
soundPlayerStart = null;
soundPlayerEnd = null;
});

//周辺車両をエンストさせる
this.OnUpdateAsObservable
.Subscribe(_ =>
{
var playerPos = core.PlayerPed.Position;
var playerVehicle = core.GetPlayerVehicle();
foreach (var v in core.CachedVehicles.Where(
x=>x.IsSafeExist()
&& x.IsInRangeOf(playerPos,1000)
&& x.IsAlive
&& x != playerVehicle))
{
v.EngineRunning = false;
v.EnginePowerMultiplier = 0.0f;
v.EngineTorqueMultiplier = 0.0f;

}
});
}


Expand Down

0 comments on commit a903734

Please sign in to comment.