Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tree-o
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
Hall of Fame
Tree-o
Commits
7d11c437
Commit
7d11c437
authored
2 years ago
by
Sárközi Gergely János
Browse files
Options
Downloads
Patches
Plain Diff
add damage property to UnitDamagedEvent
parent
dd525048
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!108
Better camera position, various smaller fixes (closes #83)
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Assets/Scripts/Logic/Data/World/Unit.cs
+7
-2
7 additions, 2 deletions
Assets/Scripts/Logic/Data/World/Unit.cs
Assets/Scripts/Logic/Event/World/Unit/UnitDamagedEvent.cs
+3
-2
3 additions, 2 deletions
Assets/Scripts/Logic/Event/World/Unit/UnitDamagedEvent.cs
with
10 additions
and
4 deletions
Assets/Scripts/Logic/Data/World/Unit.cs
+
7
−
2
View file @
7d11c437
...
...
@@ -102,8 +102,13 @@ public class Unit {
}
internal
void
InflictDamage
(
Tower
attacker
,
float
damage
)
{
CurrentHealth
=
Math
.
Max
(
CurrentHealth
-
damage
,
0
);
World
.
Overview
.
Events
.
Raise
(
new
UnitDamagedEvent
(
this
,
attacker
));
if
(
damage
>=
CurrentHealth
)
{
damage
=
CurrentHealth
;
CurrentHealth
=
0
;
}
else
{
CurrentHealth
-=
damage
;
}
World
.
Overview
.
Events
.
Raise
(
new
UnitDamagedEvent
(
this
,
damage
,
attacker
));
}
internal
void
DestroyWithoutDamage
()
{
...
...
This diff is collapsed.
Click to expand it.
Assets/Scripts/Logic/Event/World/Unit/UnitDamagedEvent.cs
+
3
−
2
View file @
7d11c437
...
...
@@ -8,11 +8,12 @@ namespace Logic.Event.World.Unit {
public
class
UnitDamagedEvent
:
BaseEvent
,
IUnitEvent
{
public
IUnitTypeData
Type
=>
Unit
.
Type
;
public
Data
.
World
.
Unit
Unit
{
get
;
}
public
float
Damage
{
get
;
}
public
Data
.
World
.
Tower
Attacker
{
get
;
}
public
UnitDamagedEvent
(
Data
.
World
.
Unit
unit
,
Data
.
World
.
Tower
attacker
)
{
public
UnitDamagedEvent
(
Data
.
World
.
Unit
unit
,
float
damage
,
Data
.
World
.
Tower
attacker
)
{
Unit
=
unit
;
Damage
=
damage
;
Attacker
=
attacker
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment