summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/OverlayKillAnimation.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assembly-CSharp/OverlayKillAnimation.cs')
-rw-r--r--Client/Assembly-CSharp/OverlayKillAnimation.cs150
1 files changed, 150 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/OverlayKillAnimation.cs b/Client/Assembly-CSharp/OverlayKillAnimation.cs
new file mode 100644
index 0000000..d6f711e
--- /dev/null
+++ b/Client/Assembly-CSharp/OverlayKillAnimation.cs
@@ -0,0 +1,150 @@
+using System;
+using System.Collections;
+using PowerTools;
+using UnityEngine;
+
+public class OverlayKillAnimation : MonoBehaviour
+{
+ public KillAnimType KillType;
+
+ public PoolablePlayer killerParts;
+
+ public PoolablePlayer victimParts;
+
+ private uint victimHat;
+
+ public AudioClip Stinger;
+
+ public AudioClip Sfx;
+
+ public float StingerVolume = 0.6f;
+
+ public void Begin(PlayerControl killer, GameData.PlayerInfo vInfo)
+ {
+ if (this.killerParts)
+ {
+ GameData.PlayerInfo kInfo = killer.Data;
+ PlayerControl.SetPlayerMaterialColors((int)kInfo.ColorId, this.killerParts.Body);
+ this.killerParts.Hands.ForEach(delegate(SpriteRenderer b)
+ {
+ PlayerControl.SetPlayerMaterialColors((int)kInfo.ColorId, b);
+ });
+ PlayerControl.SetHatImage(kInfo.HatId, this.killerParts.HatSlot);
+ switch (this.KillType)
+ {
+ case KillAnimType.Stab:
+ case KillAnimType.Neck:
+ PlayerControl.SetSkinImage(kInfo.SkinId, this.killerParts.SkinSlot);
+ break;
+ case KillAnimType.Tongue:
+ {
+ SkinData skinById = DestroyableSingleton<HatManager>.Instance.GetSkinById(kInfo.SkinId);
+ this.killerParts.SkinSlot.GetComponent<SpriteAnim>().Play(skinById.KillTongueImpostor, 1f);
+ break;
+ }
+ case KillAnimType.Shoot:
+ {
+ SkinData skinById2 = DestroyableSingleton<HatManager>.Instance.GetSkinById(kInfo.SkinId);
+ this.killerParts.SkinSlot.GetComponent<SpriteAnim>().Play(skinById2.KillShootImpostor, 1f);
+ break;
+ }
+ }
+ if (this.killerParts.PetSlot)
+ {
+ PetBehaviour petById = DestroyableSingleton<HatManager>.Instance.GetPetById(kInfo.PetId);
+ if (petById && petById.scaredClip)
+ {
+ this.killerParts.PetSlot.GetComponent<SpriteAnim>().Play(petById.idleClip, 1f);
+ this.killerParts.PetSlot.sharedMaterial = petById.rend.sharedMaterial;
+ PlayerControl.SetPlayerMaterialColors((int)kInfo.ColorId, this.killerParts.PetSlot);
+ }
+ else
+ {
+ this.killerParts.PetSlot.enabled = false;
+ }
+ }
+ }
+ if (vInfo != null && this.victimParts)
+ {
+ this.victimHat = vInfo.HatId;
+ PlayerControl.SetPlayerMaterialColors((int)vInfo.ColorId, this.victimParts.Body);
+ PlayerControl.SetHatImage(vInfo.HatId, this.victimParts.HatSlot);
+ SkinData skinById3 = DestroyableSingleton<HatManager>.Instance.GetSkinById(vInfo.SkinId);
+ switch (this.KillType)
+ {
+ case KillAnimType.Stab:
+ this.victimParts.SkinSlot.GetComponent<SpriteAnim>().Play(skinById3.KillStabVictim, 1f);
+ break;
+ case KillAnimType.Tongue:
+ this.victimParts.SkinSlot.GetComponent<SpriteAnim>().Play(skinById3.KillTongueVictim, 1f);
+ break;
+ case KillAnimType.Shoot:
+ this.victimParts.SkinSlot.GetComponent<SpriteAnim>().Play(skinById3.KillShootVictim, 1f);
+ break;
+ case KillAnimType.Neck:
+ this.victimParts.SkinSlot.GetComponent<SpriteAnim>().Play(skinById3.KillNeckVictim, 1f);
+ break;
+ }
+ if (this.victimParts.PetSlot)
+ {
+ PetBehaviour petById2 = DestroyableSingleton<HatManager>.Instance.GetPetById(vInfo.PetId);
+ if (petById2 && petById2.scaredClip)
+ {
+ this.victimParts.PetSlot.GetComponent<SpriteAnim>().Play(petById2.scaredClip, 1f);
+ this.victimParts.PetSlot.sharedMaterial = petById2.rend.sharedMaterial;
+ PlayerControl.SetPlayerMaterialColors((int)vInfo.ColorId, this.victimParts.PetSlot);
+ return;
+ }
+ this.victimParts.PetSlot.enabled = false;
+ }
+ }
+ }
+
+ public void SetHatFloor()
+ {
+ HatBehaviour hatById = DestroyableSingleton<HatManager>.Instance.GetHatById(this.victimHat);
+ if (!hatById)
+ {
+ return;
+ }
+ this.victimParts.HatSlot.sprite = hatById.FloorImage;
+ }
+
+ public void PlayKillSound()
+ {
+ if (Constants.ShouldPlaySfx())
+ {
+ SoundManager.Instance.PlaySound(this.Sfx, false, 1f).volume = 0.8f;
+ }
+ }
+
+ public IEnumerator WaitForFinish()
+ {
+ SpriteAnim[] anims = base.GetComponentsInChildren<SpriteAnim>();
+ if (anims.Length == 0)
+ {
+ yield return new WaitForSeconds(1f);
+ }
+ else
+ {
+ for (;;)
+ {
+ bool flag = false;
+ for (int i = 0; i < anims.Length; i++)
+ {
+ if (anims[i].IsPlaying(null))
+ {
+ flag = true;
+ break;
+ }
+ }
+ if (!flag)
+ {
+ break;
+ }
+ yield return null;
+ }
+ }
+ yield break;
+ }
+}