Add cool spinning hit effect for kill streak

This commit is contained in:
Sofia 2019-08-22 23:44:05 +03:00
parent a5be7dbcec
commit 7c49762506
4 changed files with 107 additions and 17 deletions

File diff suppressed because one or more lines are too long

View File

@ -183,7 +183,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1123576108763153474}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 855.25}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
@ -192,9 +192,9 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -208.59998, y: -106.6}
m_AnchoredPosition: {x: -78.599976, y: -106.600006}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
m_Pivot: {x: 1.15, y: 0.5}
--- !u!222 &332291705033973454
CanvasRenderer:
m_ObjectHideFlags: 0
@ -1343,7 +1343,7 @@ MonoBehaviour:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_text: Fun Streak
m_text: Hug Streak
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: f8aeb2d30df20474c9d9f4323c4f89e5, type: 2}
m_sharedMaterial: {fileID: -8949963558287436007, guid: f8aeb2d30df20474c9d9f4323c4f89e5,
@ -1808,7 +1808,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6152718410639027585}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 855.25}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
@ -1817,9 +1817,9 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -208.59998, y: -102.5}
m_AnchoredPosition: {x: -79.599976, y: -107.5}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
m_Pivot: {x: 1.15, y: 0.4}
--- !u!222 &8299560641149568175
CanvasRenderer:
m_ObjectHideFlags: 0

View File

@ -38,6 +38,11 @@ namespace Saltosion.OneWeapon.GUI {
private Gun LastGun;
private int LastKillCount = 2;
private float CurrentKSRot;
private float RotMultiplier;
private bool RotRising = false;
void Start() {
GunTextGore.text = "";
GunTextFun.text = "";
@ -105,6 +110,27 @@ namespace Saltosion.OneWeapon.GUI {
KSNumberFun.text = Number;
KSNumberGore.text = Number;
if (RotRising) {
CurrentKSRot += Time.deltaTime * 500;
if (CurrentKSRot >= 20) {
RotRising = false;
}
} else {
CurrentKSRot -= Time.deltaTime * 500;
if (CurrentKSRot <= -20) {
RotRising = true;
}
}
RotMultiplier -= Time.deltaTime * 6;
if (RotMultiplier <= 0) {
RotMultiplier = 0;
CurrentKSRot = 0;
}
Vector3 Rot = KSNumberGore.transform.localEulerAngles;
Rot.z = RotMultiplier * CurrentKSRot;
KSNumberGore.transform.localEulerAngles = Rot;
KSNumberFun.transform.localEulerAngles = Rot;
float StreakPercent = (PlayerFun.CurrentKillStreakTime / PlayerFun.KillStreakTimer);
Scale = StreakMeter.transform.localScale;
Scale.x = StreakPercent;
@ -126,6 +152,13 @@ namespace Saltosion.OneWeapon.GUI {
} else {
StreakMeter.color = GoreColor;
}
int delta = PlayerFun.KillStreak - LastKillCount;
if (delta > 0) {
RotMultiplier += 1f * delta;
}
LastKillCount = PlayerFun.KillStreak;
}
}
}

View File

@ -22,6 +22,7 @@ namespace Saltosion.OneWeapon.Player {
public bool DebugAdd10Fun = false;
public bool DebugSubtract10Fun = false;
public bool GodMode = false;
public bool DebugAddKill = false;
public float CurrentDamageBoost { private set; get; }
@ -56,6 +57,10 @@ namespace Saltosion.OneWeapon.Player {
NewFun -= 10;
DebugSubtract10Fun = false;
}
if (DebugAddKill) {
GainKill();
DebugAddKill = false;
}
CurrentFun = Mathf.Clamp(NewFun, 0, MaxFun);