Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Mr BigSock
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gard Aleksander Furre
Mr BigSock
Merge requests
!34
Dodge
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Dodge
master
into
main
Overview
0
Commits
7
Pipelines
0
Changes
6
Merged
Robin Halseth Sandvik
requested to merge
master
into
main
2 years ago
Overview
0
Commits
7
Pipelines
0
Changes
6
Expand
Added new dodge ability (Bound to X for now)
Dodge costs a little stamina, it launches player towards cursor and gives 0.5s of IFrames.
Added support into Character for applying status effects (Invincibility, invisibility and stun for now)
Invisibility and stun have no implemented effects yet, but easy to hook onto.
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
a0f07491
7 commits,
2 years ago
6 files
+
297
−
34
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
Search (e.g. *.vue) (Ctrl+P)
MrBigsock/Assets/Code/Core/Abilities/AbilityDodge.cs
0 → 100644
+
51
−
0
Options
using
System.Collections
;
using
System
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.InputSystem
;
using
BigSock.Service
;
namespace
BigSock
{
/*
A basic dodge move that gives a push and a short invincibility.
*/
public
class
AbilityDodge
:
BaseAbility
{
public
static
readonly
float
BASE_FORCE
=
0.5f
;
public
static
readonly
TimeSpan
IFRAME_DURATION
=
new
TimeSpan
(
0
,
0
,
0
,
0
,
500
);
public
override
ulong
Id
=>
201
;
public
override
string
Name
=>
"Dodge"
;
public
override
string
Description
=>
"A basic dodge move."
;
public
AbilityDodge
()
{
StaminaCost
=
4
;
Cooldown
=
new
TimeSpan
(
0
,
0
,
0
,
1
,
0
);
}
/*
Activates the ability.
*/
protected
override
bool
Activate
(
Character
actor
,
Vector3
?
target
)
{
if
(
target
==
null
)
return
false
;
// Get direction.
var
temp
=
(
target
.
Value
-
actor
.
transform
.
position
);
temp
.
z
=
0
;
var
direction
=
(
Vector2
)
temp
.
normalized
;
// Get the force.
var
force
=
BASE_FORCE
*
actor
.
Stats
.
MoveSpeed
;
// Apply the push and iframes.
actor
.
KnockBack
(
force
,
direction
);
actor
.
AddStatusEffect
(
StatusEffectType
.
Invincible
,
IFRAME_DURATION
);
return
true
;
}
}
}
\ No newline at end of file
Loading