-
-
Notifications
You must be signed in to change notification settings - Fork 9
Improve bind animations #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
893b81d
b962ff7
b21b1a2
5b5d95d
1f6ec4b
fdce032
3a42c82
1fd5ce7
f20f9ce
5edff7f
e2201b2
ea6de8b
2567a37
b335f55
0bb6f5c
3c8e537
902bc1d
d80d43b
ce83546
10f6a13
e288207
f4f0c48
b21f4c1
c56568e
32a885f
9d9f434
37b4038
ec01d3c
a9418d9
3c1c655
acd47b3
868cdeb
97dddc7
5726cbd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,9 +33,41 @@ public void SetShouldDoDamage(bool shouldDoDamage) { | |
| /// </summary> | ||
| /// <param name="target">The target game object to attach the component to.</param> | ||
| /// <param name="damage">The number of mask of damage it should deal.</param> | ||
| protected static void AddDamageHeroComponent(GameObject target, int damage = 1) { | ||
| var damageHero = target.AddComponent<DamageHero>(); | ||
| /// <returns>The <see cref="DamageHero"/> component that was added to the game object</returns> | ||
| protected static DamageHero AddDamageHeroComponent(GameObject target, int damage = 1) { | ||
| var damageHero = target.AddComponentIfNotPresent<DamageHero>(); | ||
| damageHero.damageDealt = damage; | ||
| damageHero.OnDamagedHero = new UnityEvent(); | ||
|
|
||
| return damageHero; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Removes a <see cref="DamageHero"/> component from the given game object. | ||
| /// </summary> | ||
| /// <param name="target">The target game object to detach the component from.</param> | ||
| protected static void RemoveDamageHeroComponent(GameObject target) { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just checking, this should stay
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct. I can't really think of anything besides cogflies/flames that might use something like this, but the possibility is there. |
||
| var damageHero = target.GetComponent<DamageHero>(); | ||
| if (damageHero == null) { | ||
| return; | ||
| } | ||
|
|
||
| Object.DestroyImmediate(damageHero); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Adds or removes a <see cref="DamageHero"/> component from the given game object, | ||
| /// depending on the PVP and team settings. | ||
| /// </summary> | ||
| /// <param name="target">The target game object to detatch the component to.</param> | ||
| /// <param name="damage">The number of mask of damage it should deal.</param> | ||
| /// <returns>The <see cref="DamageHero"/> component that was added if PVP was turned on</returns> | ||
| protected DamageHero? SetDamageHeroState(GameObject target, int damage = 1) { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you planning on using the return value from this method? Currently it is not used.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possibly, at least in other effects. Mostly I wanted to make it consistent with AddDamageHeroComponent. |
||
| if (ServerSettings.IsPvpEnabled && ShouldDoDamage) { | ||
| return AddDamageHeroComponent(target, damage); | ||
| } | ||
BobbyTheCatfish marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| RemoveDamageHeroComponent(target); | ||
| return null; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.