-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
adb02ef
commit 3c2b045
Showing
13 changed files
with
272 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using DuckGame; | ||
using JetBrains.Annotations; | ||
|
||
namespace ogtdglib.AmmoTypes | ||
{ | ||
[PublicAPI] | ||
public abstract class BaseAmmotype:AmmoType | ||
{ | ||
private Nothing _nothing; | ||
|
||
private void InitNothing() | ||
{ | ||
if (_nothing is null) _nothing = new Nothing(); | ||
} | ||
|
||
protected string GetPath(string asset) | ||
{ | ||
InitNothing(); | ||
return _nothing.GetPath(asset); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<ClassDiagram MajorVersion="1" MinorVersion="1"> | ||
<Class Name="ogtdglib.Effects.Effect"> | ||
<Position X="6" Y="0.75" Width="1.5" /> | ||
<TypeIdentifier> | ||
<HashCode>AAAAABCAAAAAAAAAAAAAAAAAAAAACAAAIAAAAAAAAIA=</HashCode> | ||
<FileName>Effects\Effect.cs</FileName> | ||
</TypeIdentifier> | ||
</Class> | ||
<Class Name="ogtdglib.Effects.Effector"> | ||
<Position X="7.25" Y="4.5" Width="1.5" /> | ||
<TypeIdentifier> | ||
<HashCode>AAQBAAAAAAAAAQAAAAAAEAAAAAAAAAAAIAAAAAAAAAA=</HashCode> | ||
<FileName>Effects\Effector.cs</FileName> | ||
</TypeIdentifier> | ||
</Class> | ||
<Class Name="ogtdglib.Effects.LinkedEffect"> | ||
<Position X="5" Y="3.5" Width="1.5" /> | ||
<TypeIdentifier> | ||
<HashCode>AAAAABAAAAAAAAAAAAAAAABAAAAAAAAAAAAEAAAAAAA=</HashCode> | ||
<FileName>Effects\LinkedEffect.cs</FileName> | ||
</TypeIdentifier> | ||
</Class> | ||
<Class Name="ogtdglib.Effects.StopEffect"> | ||
<Position X="2.5" Y="0.5" Width="1.5" /> | ||
<TypeIdentifier> | ||
<HashCode>AAAAAAAoAAQAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAA=</HashCode> | ||
<FileName>Effects\StopEffect.cs</FileName> | ||
</TypeIdentifier> | ||
</Class> | ||
<Class Name="ogtdglib.Nothing" Collapsed="true"> | ||
<Position X="8.5" Y="0.75" Width="1.5" /> | ||
<TypeIdentifier> | ||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode> | ||
<FileName>Nothing.cs</FileName> | ||
</TypeIdentifier> | ||
</Class> | ||
<Class Name="ogtdglib.AmmoTypes.BaseAmmotype"> | ||
<Position X="13.25" Y="2.5" Width="1.5" /> | ||
<TypeIdentifier> | ||
<HashCode>AAAAAAAAAAAAABAAAAAAAAAAAAACABAAAAAAAAAAAAA=</HashCode> | ||
<FileName>AmmoTypes\BaseAmmotype.cs</FileName> | ||
</TypeIdentifier> | ||
</Class> | ||
<Class Name="DuckGame.AmmoType" Collapsed="true"> | ||
<Position X="13.25" Y="1.75" Width="1.5" /> | ||
<TypeIdentifier /> | ||
</Class> | ||
<Class Name="DuckGame.Thing" Collapsed="true"> | ||
<Position X="8" Y="3" Width="1.5" /> | ||
<TypeIdentifier /> | ||
</Class> | ||
<Class Name="ogtdglib.Effects.FrictionEffect"> | ||
<Position X="2.5" Y="4.75" Width="1.5" /> | ||
<TypeIdentifier> | ||
<HashCode>AAAAAAAAAAAAAAAAAAAAAABAAAgAAAAAAAAAAAAAAAA=</HashCode> | ||
<FileName>Effects\FrictionEffect.cs</FileName> | ||
</TypeIdentifier> | ||
</Class> | ||
<Font Name="Segoe UI" Size="9" /> | ||
</ClassDiagram> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using DuckGame; | ||
using JetBrains.Annotations; | ||
|
||
namespace ogtdglib.Effects | ||
{ | ||
[PublicAPI] | ||
public abstract class Effect | ||
{ | ||
public bool Decayed { get; protected set; } | ||
public Thing Owner { get; } | ||
protected uint Ticks { get; private set; } | ||
|
||
[PublicAPI] | ||
protected Effect(Thing owner) | ||
{ | ||
Owner = owner; | ||
} | ||
|
||
public void Step() | ||
{ | ||
Ticks += 1; | ||
OnStep(); | ||
} | ||
|
||
protected abstract void OnStep(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using DuckGame; | ||
using JetBrains.Annotations; | ||
|
||
namespace ogtdglib.Effects | ||
{ | ||
[PublicAPI] | ||
public sealed class Effector:Thing | ||
{ | ||
public Effect ItsEffect; | ||
public StateBinding EffectBinding = new StateBinding(nameof(ItsEffect)); | ||
|
||
public Effector(Effect itsEffect) | ||
{ | ||
ItsEffect = itsEffect; | ||
owner = ItsEffect.Owner; | ||
} | ||
|
||
public override void Initialize() | ||
{ | ||
Step(); | ||
} | ||
|
||
public void Step() | ||
{ | ||
ItsEffect.Step(); | ||
} | ||
|
||
public override void Update() | ||
{ | ||
if (!ItsEffect.Decayed) | ||
{ | ||
ItsEffect.Step(); | ||
} | ||
else | ||
{ | ||
Level.Remove(this); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using DuckGame; | ||
|
||
namespace ogtdglib.Effects | ||
{ | ||
public sealed class FrictionEffect:LinkedEffect | ||
{ | ||
private readonly float _friction; | ||
|
||
public FrictionEffect(Thing owner, Thing linkThing, float friction) : base(owner, linkThing) | ||
{ | ||
_friction = friction; | ||
} | ||
|
||
protected override void LinkedStep(Thing linkThing) | ||
{ | ||
linkThing.hSpeed *= _friction; | ||
linkThing.vSpeed *= _friction; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using DuckGame; | ||
|
||
namespace ogtdglib.Effects | ||
{ | ||
public abstract class LinkedEffect:Effect | ||
{ | ||
private readonly Thing _linkThing; | ||
|
||
protected LinkedEffect(Thing owner, Thing linkThing) : base(owner) | ||
{ | ||
_linkThing = linkThing; | ||
} | ||
|
||
protected sealed override void OnStep() | ||
{ | ||
if (_linkThing == null || _linkThing is MaterialThing materialThing && materialThing._destroyed) | ||
{ | ||
Decayed = true; | ||
return; | ||
} | ||
LinkedStep(_linkThing); | ||
} | ||
|
||
protected abstract void LinkedStep(Thing linkThing); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using DuckGame; | ||
|
||
namespace ogtdglib.Effects | ||
{ | ||
public sealed class StopEffect:LinkedEffect | ||
{ | ||
private readonly float _x; | ||
private readonly float _y; | ||
private readonly uint _ttd; | ||
|
||
public StopEffect(Thing owner, Thing linkThing, uint ttd) : base(owner, linkThing) | ||
{ | ||
_x = linkThing.x; | ||
_y = linkThing.y; | ||
_ttd = ttd; | ||
} | ||
|
||
protected override void LinkedStep(Thing linkThing) | ||
{ | ||
linkThing.hSpeed = 0f; | ||
linkThing.vSpeed = 0f; | ||
linkThing.x = _x; | ||
linkThing.y = _y; | ||
if (Ticks > _ttd) Decayed = true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using DuckGame; | ||
using JetBrains.Annotations; | ||
|
||
namespace ogtdglib | ||
{ | ||
[PublicAPI] | ||
public sealed class Nothing:Thing | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="JetBrains.Annotations" version="2018.2.1" targetFramework="net40" /> | ||
</packages> |