Add fun damage

This commit is contained in:
Jens Pitkänen 2019-08-04 21:38:57 +03:00
parent 86ecaaf7a3
commit 166a9f659d
5 changed files with 23 additions and 11 deletions

View File

@ -350,7 +350,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -250} m_AnchoredPosition: {x: 0, y: -200}
m_SizeDelta: {x: 250, y: 50} m_SizeDelta: {x: 250, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &181126609 --- !u!114 &181126609
@ -560,7 +560,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -100} m_AnchoredPosition: {x: 0, y: -70}
m_SizeDelta: {x: 600, y: 200} m_SizeDelta: {x: 600, y: 200}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &317620729 --- !u!114 &317620729
@ -585,10 +585,10 @@ MonoBehaviour:
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData: m_FontData:
m_Font: {fileID: 12800000, guid: f3ca06d8c094ade4180b1ebe0cecdf54, type: 3} m_Font: {fileID: 12800000, guid: f3ca06d8c094ade4180b1ebe0cecdf54, type: 3}
m_FontSize: 40 m_FontSize: 32
m_FontStyle: 0 m_FontStyle: 0
m_BestFit: 0 m_BestFit: 0
m_MinSize: 4 m_MinSize: 3
m_MaxSize: 72 m_MaxSize: 72
m_Alignment: 4 m_Alignment: 4
m_AlignByGeometry: 0 m_AlignByGeometry: 0
@ -908,7 +908,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -100} m_AnchoredPosition: {x: 0, y: -70}
m_SizeDelta: {x: 700, y: 200} m_SizeDelta: {x: 700, y: 200}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &783976060 --- !u!114 &783976060
@ -933,10 +933,10 @@ MonoBehaviour:
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData: m_FontData:
m_Font: {fileID: 12800000, guid: c2b8548a6d222b44cbdceae5b971a677, type: 3} m_Font: {fileID: 12800000, guid: c2b8548a6d222b44cbdceae5b971a677, type: 3}
m_FontSize: 40 m_FontSize: 32
m_FontStyle: 0 m_FontStyle: 0
m_BestFit: 0 m_BestFit: 0
m_MinSize: 4 m_MinSize: 3
m_MaxSize: 72 m_MaxSize: 72
m_Alignment: 4 m_Alignment: 4
m_AlignByGeometry: 0 m_AlignByGeometry: 0
@ -1178,7 +1178,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -250} m_AnchoredPosition: {x: 0, y: -200}
m_SizeDelta: {x: 250, y: 50} m_SizeDelta: {x: 250, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1382781933 --- !u!114 &1382781933

View File

@ -456,7 +456,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -250} m_AnchoredPosition: {x: 0, y: -200}
m_SizeDelta: {x: 250, y: 50} m_SizeDelta: {x: 250, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &570541436 --- !u!114 &570541436
@ -1219,7 +1219,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -250} m_AnchoredPosition: {x: 0, y: -200}
m_SizeDelta: {x: 250, y: 50} m_SizeDelta: {x: 250, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2030313146 --- !u!114 &2030313146

View File

@ -63,6 +63,7 @@ namespace Saltosion.OneWeapon.AI.Behaviours {
AnimatableTransform.position = Vector2.Lerp(Root, Target, AnimationProgress); AnimatableTransform.position = Vector2.Lerp(Root, Target, AnimationProgress);
if (AnimationProgress >= 1.0f) { if (AnimationProgress >= 1.0f) {
// Attack hit, deal damage and start return animation // Attack hit, deal damage and start return animation
TakeFunDamage();
AttackHit = true; AttackHit = true;
AnimationProgress = 0.0f; AnimationProgress = 0.0f;
} }
@ -79,6 +80,13 @@ namespace Saltosion.OneWeapon.AI.Behaviours {
return false; return false;
} }
private void TakeFunDamage() {
PlayerFun Player = Follow.Target.GetComponent<PlayerFun>();
if (Player != null) {
Player.TakeDamage();
}
}
private void OnDrawGizmosSelected() { private void OnDrawGizmosSelected() {
Gizmos.color = Color.red; Gizmos.color = Color.red;
Gizmos.DrawWireSphere(transform.position, MeleeRange); Gizmos.DrawWireSphere(transform.position, MeleeRange);

View File

@ -55,7 +55,7 @@ namespace Saltosion.OneWeapon {
DamageTextFun.color = FunColor; DamageTextFun.color = FunColor;
FunTextFun.color = FunColor; FunTextFun.color = FunColor;
int FunLevelInt = (int)Mathf.Min(Mathf.Floor(FunPercent * 6), 5); int FunLevelInt = (int)Mathf.Clamp(Mathf.Floor(FunPercent * 6), 0, 5);
FunTextGore.text = GoreTexts[FunLevelInt]; FunTextGore.text = GoreTexts[FunLevelInt];
FunTextFun.text = FunTexts[FunLevelInt]; FunTextFun.text = FunTexts[FunLevelInt];

View File

@ -53,6 +53,10 @@ namespace Saltosion.OneWeapon {
CurrentFun = Mathf.Min(MaxFun, NewFun); CurrentFun = Mathf.Min(MaxFun, NewFun);
} }
public void TakeDamage() {
AddFun(-5f);
}
public void ReceiveNewWeapon() { public void ReceiveNewWeapon() {
AddFun(WeaponFun); AddFun(WeaponFun);
} }