Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
206 commits
Select commit Hold shift + click to select a range
314edd4
Began on station system, added grid editor block category filtering
ManuelJager Dec 24, 2020
86b075b
Added station core and gauss cannon graphics
ManuelJager Dec 25, 2020
9ae8a8c
Adjusted image import settings
ManuelJager Dec 26, 2020
907289e
Update core & gauss-cannon turret pixel size
ManuelJager Dec 26, 2020
ff9e8f3
First gauss-cannon and station core implementation
ManuelJager Dec 26, 2020
e46fdcd
Added prefab references to gauss cannon asset
ManuelJager Dec 26, 2020
d68cf4d
Some renaming, addressed #106
ManuelJager Dec 27, 2020
0ff2d9c
Addressed #107
ManuelJager Dec 27, 2020
ffb99c3
Normal switch => C# 8 switch
ManuelJager Dec 27, 2020
0ba914d
Use any type of controller when judging whether a block is a controller
ManuelJager Dec 27, 2020
c8968c8
Addressed #108
ManuelJager Dec 27, 2020
6e85226
Added default player station blueprint
ManuelJager Dec 27, 2020
f7e9f57
Implemented player station
ManuelJager Dec 28, 2020
d9004df
Added research value modification
ManuelJager Dec 28, 2020
80e289d
Cleaned up research backend API, removed debug code
ManuelJager Dec 28, 2020
0674255
Update GaussCannon.asset
ManuelJager Dec 28, 2020
7f245fa
Further refined research backend API, implemented lazy value updating
ManuelJager Dec 29, 2020
643041e
Added Grid overlay abstraction, cleaned up source folder and namespaces
ManuelJager Dec 29, 2020
fb3b56c
Added automatic research items, split autofire behaviour from base tu…
ManuelJager Dec 30, 2020
41f0aef
Moved gameplay input code to its own folder
ManuelJager Dec 30, 2020
587786f
Fix previous commit missing meta files
ManuelJager Dec 30, 2020
a4a1ad1
Started work on gauss cannon charge animation
ManuelJager Jan 3, 2021
8686f2f
implemented gauss cannon pixelart animations
ManuelJager Jan 7, 2021
764a5af
Added main camera postprocessing profile, added beam to gauss cannon
ManuelJager Jan 8, 2021
1747f78
Added hitscan logic to turret
ManuelJager Jan 8, 2021
f56834b
Added railgun noise
ManuelJager Jan 8, 2021
2b8753c
Remade gauss cannon laser shader, switched to forward renderer, start…
ManuelJager Jan 9, 2021
7712d86
There was an attempt
ManuelJager Jan 9, 2021
860aa3c
Update GaussCannonCharge.vfx
ManuelJager Jan 9, 2021
ac3f5fc
Added arcs to gauss cannon charge
ManuelJager Jan 9, 2021
7880dc8
Implemented split gauss cannon layer
ManuelJager Jan 9, 2021
68a9edb
Moved materials and shaders to graphics folder, added gauss cannon fi…
ManuelJager Jan 10, 2021
1161aaf
Update gauss-cannon.aseprite
ManuelJager Jan 10, 2021
c7662f9
Added turret rotation
ManuelJager Jan 10, 2021
1d54a43
Refactored editor ghost layer
ManuelJager Jan 16, 2021
1e619ec
Added editor turret overlay generation, renamed editor folders
ManuelJager Jan 16, 2021
4dd4f76
Changed scripting backend, added missing turret asset changes
ManuelJager Jan 16, 2021
c34f74b
Added basic editor turret overlay implementation
ManuelJager Jan 18, 2021
719d5da
Added turret arcs in editor
ManuelJager Jan 18, 2021
6a959f7
Fixed errors caused when no block is selected in the editor
ManuelJager Jan 19, 2021
9ff920d
Added turret firing cone mesh
ManuelJager Jan 19, 2021
582b481
Implemented turret overlay ghost
ManuelJager Jan 19, 2021
b4ab68a
Added naughty attributes, started work on turret arc validation
ManuelJager Jan 21, 2021
b4fce91
Addressed #109
ManuelJager Jan 22, 2021
9d5d9b1
Renamed AnchoredBlueprintBlock -> ABpBlock, refactored editor turret …
ManuelJager Jan 22, 2021
678550c
Added antialiasing support to texture generation
ManuelJager Jan 28, 2021
e591b46
Addressed #110, restructured editor grid folder, added abstraction to…
ManuelJager Jan 28, 2021
0629e9a
Reworked strongly typed directory system
ManuelJager Jan 29, 2021
34d5b6d
Moved texture drawing code to its own namespace
ManuelJager Jan 29, 2021
4422b61
Added audio type filtering to sound bag
ManuelJager Jan 29, 2021
43e803c
Reworked audio API to eventually support dynamically loaded sounds
ManuelJager Jan 29, 2021
dd1687a
Migrated audio type property from sound config to sound, Implemented …
ManuelJager Jan 29, 2021
4cfabb0
Update Systems.cs
ManuelJager Jan 29, 2021
2d6ad8c
Fixed build errors, Added custom soundtrack folder button
ManuelJager Jan 29, 2021
86f527f
Reverted to Mono JIT scripting backend, addressed #112
ManuelJager Jan 30, 2021
1c013fd
Updated settings object equality checking, added sharpziplib
ManuelJager Jan 30, 2021
87b62b5
Switched to DotNetZip
ManuelJager Jan 30, 2021
8b935a4
Added System.Security.Permissions.dll, Added soundtrack json config r…
ManuelJager Jan 31, 2021
701157e
Started custom song implementation
ManuelJager Jan 31, 2021
761af02
Use Unity API to load songs
ManuelJager Feb 1, 2021
afc3350
Fixed invoking load enumerator when loading default soundtrack
ManuelJager Feb 2, 2021
871f329
Added configurable soundtrack loading
ManuelJager Feb 2, 2021
e0e1885
Added mid-game soundtrack switching
ManuelJager Feb 5, 2021
b8eef52
Added soundtrack progress bar
ManuelJager Feb 6, 2021
1945d1a
Fixed loading screen progress
ManuelJager Feb 6, 2021
ea34813
Started reworking soundtrack system
ManuelJager Feb 6, 2021
265d3a9
Addressed #113, #114
ManuelJager Feb 7, 2021
00d3d45
Added soundtrack notifications, addressed #116
ManuelJager Feb 7, 2021
fc1ae1c
Added saving blueprint as static blueprint in asset folder
ManuelJager Feb 8, 2021
487c56d
Set rotation of grid
ManuelJager Feb 9, 2021
3c520e1
Added formation spawning
ManuelJager Feb 13, 2021
3115a43
Renamed UI Properties, Added wave manager to first mission
ManuelJager Feb 14, 2021
15167fa
Added angle based image skewing
ManuelJager Feb 15, 2021
e855277
Added mission state overlay
ManuelJager Feb 16, 2021
c8c8798
Added wave control
ManuelJager Feb 17, 2021
04c49b6
Started debugging 117
ManuelJager Feb 18, 2021
9d3c31c
Addressed #117
ManuelJager Feb 20, 2021
3aa3526
Addressed #118
ManuelJager Feb 20, 2021
4deea34
Addressed #111
ManuelJager Feb 20, 2021
137f2bc
Addressed #119
ManuelJager Feb 20, 2021
7913706
Added editor button in gameplay UI
ManuelJager Feb 21, 2021
c729a7e
Element tracking, mission state animations
ManuelJager Feb 24, 2021
19fb6ca
Update .gitignore
ManuelJager Feb 25, 2021
c73b04c
Delete UserSettings directory
ManuelJager Feb 25, 2021
15361f0
Update ElementTracker.cs
ManuelJager Feb 25, 2021
2dddfa1
Addressed 121
ManuelJager Feb 27, 2021
b821ead
Merge branch 'Alpha5' of https://github.com/ManuelJager/ProjectExa in…
ManuelJager Feb 27, 2021
e2ea21f
Decoupled Block OnDisable to block destruction
ManuelJager Feb 28, 2021
0f3eb87
Added gameplay to editor transition
ManuelJager Feb 28, 2021
3964548
Move camera controller to Main scene, address editor transition stabi…
XGManuelJager Mar 14, 2021
fcf5d1f
Add dynamic research step modifiers, address #123
ManuelJager Mar 20, 2021
e5222f4
Add totals manager
ManuelJager Mar 21, 2021
c272c14
Fixed grid totals issues
ManuelJager Mar 22, 2021
02d2ec2
Phase out old grid totals implementation
ManuelJager Mar 23, 2021
0fdbd8e
Remove first mission dynamic modifier
ManuelJager Mar 23, 2021
8ca19a6
Removed unused fields
ManuelJager Mar 27, 2021
840ed8f
Added blueprint strength, reworked power generation and turning power…
ManuelJager Mar 27, 2021
5b47484
Added metadata view
ManuelJager Mar 27, 2021
9f3e568
Adjusted tooltip view, add block metadata values, add metals icon
ManuelJager Mar 28, 2021
4aaeedd
Added metals
ManuelJager Mar 28, 2021
cd74022
Refactored block costs
ManuelJager Apr 4, 2021
e7a80ce
Add block costs of destroyed ships to the current inventory
ManuelJager Apr 4, 2021
7f0f7b1
Add blueprint cost validator
ManuelJager Apr 5, 2021
796439a
Remove unused directives
ManuelJager Apr 5, 2021
34095b0
Add customizeable camera settings to grid editor
ManuelJager Apr 5, 2021
ecdda52
Update AdventPro-Regular SDF.asset
ManuelJager Apr 5, 2021
1c72f27
Refactored plugable validators
ManuelJager Apr 10, 2021
6baeef8
Further refactoring
ManuelJager Apr 10, 2021
ea7f394
Fixed plugable validator import order
ManuelJager Apr 10, 2021
2d9d1cb
Removed validator builder
ManuelJager Apr 11, 2021
78ebf24
Addressed #127
ManuelJager Apr 11, 2021
4768704
Addressed #125
ManuelJager Apr 11, 2021
5581584
Partially address #128 (Regarding pause menu)
ManuelJager Apr 15, 2021
804d902
Addressed #128
ManuelJager Apr 17, 2021
0edf27b
Address #130
ManuelJager Apr 17, 2021
97fed6e
Reduced unnecessary serialization
ManuelJager Apr 17, 2021
308fc4e
Add budget view to editor
ManuelJager Apr 18, 2021
093995d
Added editor budget field animation
ManuelJager Apr 24, 2021
6b5bf13
Addressed #134
ManuelJager May 6, 2021
e5d514d
feat: Initial Grid diffing implementation
ManuelJager May 8, 2021
6b22ead
Remove type check on grid member equality comparer
ManuelJager May 9, 2021
3040cd6
feat(Grid Diffing): Added grid diff to debug tooltip
ManuelJager May 9, 2021
5f551f2
refactor: remove unused turning rate code
ManuelJager May 9, 2021
3abd5e7
Added repair drone graphics
ManuelJager May 11, 2021
04ad5a0
Add v3 to repair drone graphics. Add listeners to grid diff
ManuelJager May 13, 2021
d7bb336
Add sort pending grid members by distance to centre
ManuelJager May 13, 2021
92dc45b
Remove grid diff sorting
ManuelJager May 13, 2021
cc890cb
Subtract block costs of edit operation after saving
ManuelJager May 14, 2021
1e60d3e
Fix namespacing of new files in grids source
ManuelJager May 15, 2021
f2a6f4a
Started work on adding turret arc rotation logic
ManuelJager May 15, 2021
9141506
Add initial turret arc implementation
ManuelJager May 16, 2021
37b42ac
refactor(Turrets): remove comments
ManuelJager May 16, 2021
997e4be
feature(Turrets): Finalize turret arc logic
ManuelJager May 16, 2021
1e1d974
refactor(BlockMetadat): Removed BlockGridMetadata in favour of queryi…
ManuelJager May 17, 2021
def79ab
refactor(Grids): Remove IChargeableTurretPlatform mentions
ManuelJager May 17, 2021
c6acad4
feature(Missions): Add resource multiplier to missions
ManuelJager May 21, 2021
fe05191
feature(MainUI-Play): Add mission description tooltips
ManuelJager May 21, 2021
bad18dc
feature(Tooling): Added basic block editor inspector
ManuelJager May 24, 2021
d45d4ef
feature, refactoring, UI(Gameplay): Rename GameSystems to GS, added b…
ManuelJager May 25, 2021
f0af885
fix(Grids): #136, feature(UI): Add gameover text
ManuelJager May 26, 2021
580cd9e
feature(Gameplay-UI): Add damage flinching effect when the core is da…
ManuelJager May 30, 2021
77097d4
Start working on game over menu animations
ManuelJager Jun 1, 2021
ff760db
Upgrade unity version
ManuelJager Jun 20, 2021
ba73999
Add score to mission end
ManuelJager Jun 20, 2021
638baec
Update UIAnimateable.cs
ManuelJager Jun 24, 2021
135f8cc
fix: 139
ManuelJager Jun 24, 2021
46106a7
Addressed #143
ManuelJager Jun 26, 2021
e743076
feature(research): Use block template filtering
ManuelJager Jun 26, 2021
3ad4e8f
update code formatting guidelines
ManuelJager Jun 27, 2021
c91f70d
feature: Add ship warning
ManuelJager Jun 29, 2021
a812910
Allow for the gauss cannon to resume charging
ManuelJager Jul 1, 2021
75e5ff9
fix: Gauss cannon arcs animation breaks after firing
ManuelJager Jul 1, 2021
209a819
List layers
ManuelJager Jul 1, 2021
2c6593a
Initial aseprite tools implementation
ManuelJager Jul 5, 2021
77271a6
Moved aseprite editor tools to work when inspecting .aseprite tools
ManuelJager Jul 8, 2021
10af750
Create Shield generator MK1 Sprite and prefab
ManuelJager Jul 9, 2021
ca66fc5
Create Shield Generator MK1 Templating
ManuelJager Jul 9, 2021
24e848f
Finish templating, remove template pratial implementation for all blo…
ManuelJager Jul 10, 2021
e2680fb
Fix template partial data query
ManuelJager Jul 11, 2021
ff036ac
Simplified block instances by removing most Block inheritors, removed…
ManuelJager Jul 11, 2021
e6f507f
Remove unused asset data of blocks
ManuelJager Jul 11, 2021
32bdfe4
Added generic damageable interface, so damage logic can be shared bet…
ManuelJager Jul 12, 2021
1ce6c51
Add shield generator to template bag
ManuelJager Jul 12, 2021
c19f01f
Small api changes, fix HealthPool damage calculation
ManuelJager Jul 15, 2021
a6cc0ec
Batch grid rebuilds
ManuelJager Jul 18, 2021
2c0d37c
Fix blocks not getting destroyed
ManuelJager Jul 18, 2021
9b9e895
Fix all blocks are destroyed when controller is destroyed
ManuelJager Jul 20, 2021
277f5f3
Delay grid cleanup to prevent inadvertently destroying blocks
ManuelJager Jul 20, 2021
0c5a013
Upgrade engine, fix error on inspection of .ase files when aseprite e…
ManuelJager Aug 4, 2021
d38c804
Start on revamped gauss cannon sprite, sort ase layers in editor tool…
ManuelJager Aug 5, 2021
b28a7fc
Exported gauss cannon
ManuelJager Aug 8, 2021
9fc81d7
gausscannon sprite update
ManuelJager Aug 20, 2021
aebb6df
Hook up animation to state
ManuelJager Aug 20, 2021
ab5534e
art(GaussCannon): Add animation curve on arcs, use emmisive material …
ManuelJager Aug 20, 2021
b53fa4b
fix(ShieldBubble): Disable collision on bubble
ManuelJager Aug 20, 2021
34d19b3
Add tolerance to ease evaluation for nice rounding of values
ManuelJager Aug 20, 2021
73e84f1
UI(FirstMission): Added blueprint dropdown
ManuelJager Aug 22, 2021
9e73536
Address #146
ManuelJager Aug 23, 2021
3792a15
Address: #147
ManuelJager Aug 28, 2021
54281fa
bug: Invalidate caches when the research for multiple block contexts …
ManuelJager Aug 28, 2021
142a22a
Add controller rotation test
ManuelJager Aug 28, 2021
b344923
Start station implementation
ManuelJager Aug 29, 2021
cefb421
refactor(Audio): Replace ID usages by Sound usages. audio(GaussCannon…
ManuelJager Aug 31, 2021
f63d36e
refactor(Audio): Change file structure
ManuelJager Aug 31, 2021
26cbd53
Add local audio player proxy
ManuelJager Aug 31, 2021
ae9c5fe
Add coil charge sound
ManuelJager Sep 1, 2021
f1adf15
audio(GaussCannon): Implement audio logic
ManuelJager Sep 3, 2021
ded5274
feature(GaussCannon): Add cooldown logic
ManuelJager Sep 3, 2021
3124139
Update WindDown.asset
ManuelJager Sep 3, 2021
f40b9dd
ux(Settings): Prevent navigation to settings menu twice
ManuelJager Sep 5, 2021
60ffe2f
feature(GaussCannon): Add basic animation
ManuelJager Sep 5, 2021
183cba5
feature(GaussCannon): Fully synced up animation to cursor animation
ManuelJager Sep 5, 2021
1b2bf40
Fixed rotation
ManuelJager Sep 15, 2021
3bbd68b
fix cursor error on startup, modify overlay charge
ManuelJager Sep 18, 2021
82ebe1f
Add vectrosity
ManuelJager Sep 19, 2021
6a367a9
Add vector lines to overlay
ManuelJager Sep 24, 2021
6524358
Add styling to rotation overlay
ManuelJager Sep 26, 2021
a2a8d93
Safe grid reconciliation, start on #142
ManuelJager Oct 10, 2021
d0dfdf3
Added inaccuracy to projectile
ManuelJager Oct 10, 2021
9079e44
Fix #142
ManuelJager Oct 23, 2021
1e8e054
Add drone bay sprite and data
ManuelJager Oct 24, 2021
2195f5a
Fix station asset and drone bay values
ManuelJager Oct 24, 2021
fb61220
Start drone implementation
ManuelJager Oct 25, 2021
e0ed95d
Added drone
ManuelJager Oct 30, 2021
85f1ea4
Added basic drone orchestration logic
ManuelJager Oct 31, 2021
b58a9a7
Update collision matrix
ManuelJager Oct 31, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/[Bb]uilds/
/[Ll]ogs/
/[Mm]emoryCaptures/
/[Uu]serSettings/

# Never ignore Asset meta data
!/[Aa]ssets/**/*.meta
Expand Down
2 changes: 2 additions & 0 deletions .wakatime-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ProjectExa

8 changes: 8 additions & 0 deletions Assets/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions Assets/Editor/DefaultColors.colors
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &1
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 12323, guid: 0000000000000000e000000000000000, type: 0}
m_Name: DefaultColors
m_EditorClassIdentifier:
m_Presets:
- m_Name:
m_Color: {r: 0.15686275, g: 0.15686275, b: 0.19607843, a: 1}
- m_Name:
m_Color: {r: 0.23529412, g: 0.23529412, b: 0.27450982, a: 1}
- m_Name:
m_Color: {r: 0.39215687, g: 0.39215687, b: 0.43137255, a: 1}
- m_Name:
m_Color: {r: 0.8627451, g: 0.8627451, b: 0.8627451, a: 1}
- m_Name:
m_Color: {r: 0.29411766, g: 0.7254902, b: 0.7058824, a: 1}
- m_Name:
m_Color: {r: 0.7058824, g: 0.27450982, b: 0.29411766, a: 1}
8 changes: 8 additions & 0 deletions Assets/Editor/DefaultColors.colors.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Assets/Plugins/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Vectrosity
331 changes: 218 additions & 113 deletions Assets/Plugins/DOTween/Modules/DOTweenModulePhysics.cs

Large diffs are not rendered by default.

144 changes: 86 additions & 58 deletions Assets/Plugins/DOTween/Modules/DOTweenModulePhysics2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,102 +9,130 @@

#pragma warning disable 1591

namespace DG.Tweening
{
public static class DOTweenModulePhysics2D
{
#region Shortcuts
namespace DG.Tweening {
public static class DOTweenModulePhysics2D {
#region Shortcuts

#region Rigidbody2D Shortcuts
#region Rigidbody2D Shortcuts

/// <summary>Tweens a Rigidbody2D's position to the given value.
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <summary>
/// Tweens a Rigidbody2D's position to the given value.
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations
/// </summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMove(this Rigidbody2D target, Vector2 endValue, float duration, bool snapping = false)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, endValue, duration);
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMove(this Rigidbody2D target, Vector2 endValue, float duration, bool snapping = false) {
var t = DOTween.To(() => target.position, target.MovePosition, endValue, duration);
t.SetOptions(snapping).SetTarget(target);

return t;
}

/// <summary>Tweens a Rigidbody2D's X position to the given value.
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <summary>
/// Tweens a Rigidbody2D's X position to the given value.
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations
/// </summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMoveX(this Rigidbody2D target, float endValue, float duration, bool snapping = false)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector2(endValue, 0), duration);
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMoveX(this Rigidbody2D target, float endValue, float duration, bool snapping = false) {
var t = DOTween.To(() => target.position, target.MovePosition, new Vector2(endValue, 0), duration);
t.SetOptions(AxisConstraint.X, snapping).SetTarget(target);

return t;
}

/// <summary>Tweens a Rigidbody2D's Y position to the given value.
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <summary>
/// Tweens a Rigidbody2D's Y position to the given value.
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations
/// </summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMoveY(this Rigidbody2D target, float endValue, float duration, bool snapping = false)
{
TweenerCore<Vector2, Vector2, VectorOptions> t = DOTween.To(() => target.position, target.MovePosition, new Vector2(0, endValue), duration);
public static TweenerCore<Vector2, Vector2, VectorOptions> DOMoveY(this Rigidbody2D target, float endValue, float duration, bool snapping = false) {
var t = DOTween.To(() => target.position, target.MovePosition, new Vector2(0, endValue), duration);
t.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);

return t;
}

/// <summary>Tweens a Rigidbody2D's rotation to the given value.
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static TweenerCore<float, float, FloatOptions> DORotate(this Rigidbody2D target, float endValue, float duration)
{
TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
/// <summary>
/// Tweens a Rigidbody2D's rotation to the given value.
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations
/// </summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="duration">The duration of the tween</param>
public static TweenerCore<float, float, FloatOptions> DORotate(this Rigidbody2D target, float endValue, float duration) {
var t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
t.SetTarget(target);

return t;
}

#region Special
#region Special

/// <summary>Tweens a Rigidbody2D's position to the given value, while also applying a jump effect along the Y axis.
/// Returns a Sequence instead of a Tweener.
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations.
/// <para>IMPORTANT: a rigidbody2D can't be animated in a jump arc using MovePosition, so the tween will directly set the position</para></summary>
/// <summary>
/// Tweens a Rigidbody2D's position to the given value, while also applying a jump effect along the Y axis.
/// Returns a Sequence instead of a Tweener.
/// Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations.
/// <para>
/// IMPORTANT: a rigidbody2D can't be animated in a jump arc using MovePosition, so the tween will directly set
/// the position
/// </para>
/// </summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="jumpPower">Power of the jump (the max height of the jump is represented by this plus the final Y offset)</param>
/// <param name="numJumps">Total number of jumps</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Sequence DOJump(this Rigidbody2D target, Vector2 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)
{
if (numJumps < 1) numJumps = 1;
public static Sequence DOJump(this Rigidbody2D target, Vector2 endValue, float jumpPower, int numJumps, float duration, bool snapping = false) {
if (numJumps < 1) {
numJumps = 1;
}

float startPosY = 0;
float offsetY = -1;
bool offsetYSet = false;
Sequence s = DOTween.Sequence();
var offsetYSet = false;
var s = DOTween.Sequence();

Tween yTween = DOTween.To(() => target.position, x => target.position = x, new Vector2(0, jumpPower), duration / (numJumps * 2))
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative()
.SetOptions(AxisConstraint.Y, snapping)
.SetEase(Ease.OutQuad)
.SetRelative()
.SetLoops(numJumps * 2, LoopType.Yoyo)
.OnStart(() => startPosY = target.position.y);
s.Append(DOTween.To(() => target.position, x => target.position = x, new Vector2(endValue.x, 0), duration)
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
).Join(yTween)
.SetTarget(target).SetEase(DOTween.defaultEaseType);
yTween.OnUpdate(() =>
{
if (!offsetYSet)
{
offsetYSet = true;
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;

s.Append(
DOTween.To(() => target.position, x => target.position = x, new Vector2(endValue.x, 0), duration)
.SetOptions(AxisConstraint.X, snapping)
.SetEase(Ease.Linear)
)
.Join(yTween)
.SetTarget(target)
.SetEase(DOTween.defaultEaseType);

yTween.OnUpdate(
() => {
if (!offsetYSet) {
offsetYSet = true;
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
}

Vector3 pos = target.position;
pos.y += DOVirtual.EasedValue(0, offsetY, yTween.ElapsedPercentage(), Ease.OutQuad);
target.MovePosition(pos);
}
Vector3 pos = target.position;
pos.y += DOVirtual.EasedValue(0, offsetY, yTween.ElapsedPercentage(), Ease.OutQuad);
target.MovePosition(pos);
});
);

return s;
}

#endregion Special
#endregion Special

#endregion Rigidbody2D Shortcuts
#endregion Rigidbody2D Shortcuts

#endregion Shortcuts
#endregion Shortcuts
}
}

Expand Down
Loading