Weapos Rejiggered
Modified weapon scripts to eliminate specialized projectile behavior - allows charged weapons to have projectiles and modify weapon stats when charged Added machine gun weapon & VFX Moved third party code to Plugins folder to improve compile times
This commit is contained in:
parent
2a0fe34611
commit
dbc522a224
2105 changed files with 7033 additions and 1141 deletions
|
|
@ -1,58 +0,0 @@
|
|||
using System;
|
||||
using UniRx.Operators;
|
||||
|
||||
namespace UniRx.Operators
|
||||
{
|
||||
internal class DefaultIfEmptyObservable<T> : OperatorObservableBase<T>
|
||||
{
|
||||
readonly IObservable<T> source;
|
||||
readonly T defaultValue;
|
||||
|
||||
public DefaultIfEmptyObservable(IObservable<T> source, T defaultValue)
|
||||
: base(source.IsRequiredSubscribeOnCurrentThread())
|
||||
{
|
||||
this.source = source;
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
protected override IDisposable SubscribeCore(IObserver<T> observer, IDisposable cancel)
|
||||
{
|
||||
return source.Subscribe(new DefaultIfEmpty(this, observer, cancel));
|
||||
}
|
||||
|
||||
class DefaultIfEmpty : OperatorObserverBase<T, T>
|
||||
{
|
||||
readonly DefaultIfEmptyObservable<T> parent;
|
||||
bool hasValue;
|
||||
|
||||
public DefaultIfEmpty(DefaultIfEmptyObservable<T> parent, IObserver<T> observer, IDisposable cancel) : base(observer, cancel)
|
||||
{
|
||||
this.parent = parent;
|
||||
this.hasValue = false;
|
||||
}
|
||||
|
||||
public override void OnNext(T value)
|
||||
{
|
||||
hasValue = true;
|
||||
observer.OnNext(value);
|
||||
}
|
||||
|
||||
public override void OnError(Exception error)
|
||||
{
|
||||
try { observer.OnError(error); }
|
||||
finally { Dispose(); }
|
||||
}
|
||||
|
||||
public override void OnCompleted()
|
||||
{
|
||||
if (!hasValue)
|
||||
{
|
||||
observer.OnNext(parent.defaultValue);
|
||||
}
|
||||
|
||||
try { observer.OnCompleted(); }
|
||||
finally { Dispose(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue