using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BroMakerLib;
using BroMakerLib.CustomObjects.Bros;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Cobro")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Cobro")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f637a9e4-6c18-40e6-834a-0a75c00103c5")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Cobro;
[HeroPreset(/*Could not decode attribute arguments.*/)]
public class Cobro : CustomHero
{
public class ProjectileData
{
public int bulletCount;
public int maxBulletCount = 6;
}
private Projectile primaryProjectile;
private Projectile specialProjectile;
private Material normalMaterial;
private Material stealthMaterial;
private Material normalGunMaterial;
private Material stealthGunMaterial;
private float primaryAttackRange = 20f;
private float primaryAttackSpeed = 480f;
private float primaryProjectileLifetime = 0.19f;
private ProjectileData specialProjectileData;
public static AudioClip[] CobroGunSounds;
public static AudioClip[] MachineGunSounds;
public static AudioClip[] DashingMeleeSounds;
public static AudioClip[] CobroSmack;
public static AudioClip[] CobroSmack2;
private AudioClip emptyGunSound;
private int specialAmmo = 6;
private bool wasInvulnerable;
private bool UsingSpecial;
protected bool specialActive;
private int usingSpecialFrame;
private float specialAnimationTimer;
private bool isReversingSpecial;
private bool isDelayingPrimaryFire;
private float primaryFireDelayTimer;
public float muzzleFlashOffsetXOnZiplineLeft = 8f;
public float muzzleFlashOffsetYOnZiplineLeft = 2.5f;
public float muzzleFlashOffsetXOnZiplineRight = -9f;
public float muzzleFlashOffsetYOnZiplineRight = 2f;
public float muzzleFlashPrimaryOffsetXOnZiplineLeft = 9.5f;
public float muzzleFlashPrimaryOffsetYOnZiplineLeft = 1.5f;
public float muzzleFlashPrimaryOffsetXOnZiplineRight = -8f;
public float muzzleFlashPrimaryOffsetYOnZiplineRight = 1f;
private bool wasRunning;
protected bool throwingMook;
private CoorsCan coorscanPrefab;
protected override void Awake()
{
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
((CustomHero)this).Awake();
InitializeResources();
InitializeProjectiles();
InitializeAudioClips();
((TestVanDammeAnim)this).gunSpriteHangingFrame = 9;
coorscanPrefab = new GameObject("CoorsCan", new Type[4]
{
typeof(MeshFilter),
typeof(MeshRenderer),
typeof(SpriteSM),
typeof(CoorsCan)
}).GetComponent<CoorsCan>();
((Behaviour)coorscanPrefab).enabled = false;
}
private void InitializeResources()
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
normalMaterial = ((TestVanDammeAnim)this).material;
stealthMaterial = ResourcesController.GetMaterial(directoryName, "spriteSpecial.png");
normalGunMaterial = ((TestVanDammeAnim)this).gunSprite.meshRender.material;
stealthGunMaterial = ResourcesController.GetMaterial(directoryName, "gunSpriteSpecial.png");
ResourcesController.GetMaterial(directoryName, "avatar.png");
}
private void InitializeAudioClips()
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
if (MachineGunSounds == null)
{
MachineGunSounds = (AudioClip[])(object)new AudioClip[3];
MachineGunSounds[0] = ResourcesController.GetAudioClip(Path.Combine(directoryName, "sounds"), "MachineGun_1.wav");
MachineGunSounds[1] = ResourcesController.GetAudioClip(Path.Combine(directoryName, "sounds"), "MachineGun_2.wav");
MachineGunSounds[2] = ResourcesController.GetAudioClip(Path.Combine(directoryName, "sounds"), "MachineGun_3.wav");
}
if (CobroGunSounds == null)
{
CobroGunSounds = (AudioClip[])(object)new AudioClip[5];
CobroGunSounds[0] = ResourcesController.GetAudioClip(Path.Combine(directoryName, "sounds"), "CobroGun_2.wav");
CobroGunSounds[1] = ResourcesController.GetAudioClip(Path.Combine(directoryName, "sounds"), "CobroGun_3_Ricochet.wav");
CobroGunSounds[2] = ResourcesController.GetAudioClip(Path.Combine(directoryName, "sounds"), "CobroGun_4_Ricochet.wav");
CobroGunSounds[3] = ResourcesController.GetAudioClip(Path.Combine(directoryName, "sounds"), "CobroGun_5_Ricochet.wav");
CobroGunSounds[4] = ResourcesController.GetAudioClip(Path.Combine(directoryName, "sounds"), "CobroGun_7.wav");
}
if (DashingMeleeSounds == null)
{
DashingMeleeSounds = (AudioClip[])(object)new AudioClip[2];
DashingMeleeSounds[0] = ResourcesController.GetAudioClip(Path.Combine(directoryName, "sounds"), "CobroSmack.wav");
DashingMeleeSounds[1] = ResourcesController.GetAudioClip(Path.Combine(directoryName, "sounds"), "CobroSmack2.wav");
}
emptyGunSound = ResourcesController.GetAudioClip(Path.Combine(directoryName, "sounds"), "EmptyGun.wav");
}
protected override void Update()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
((BroBase)this).Update();
if (((Unit)this).invulnerable)
{
wasInvulnerable = true;
}
if (wasInvulnerable && !((Unit)this).invulnerable)
{
normalMaterial.SetColor("_TintColor", Color.gray);
stealthMaterial.SetColor("_TintColor", Color.gray);
((TestVanDammeAnim)this).gunSprite.meshRender.material.SetColor("_TintColor", Color.gray);
}
if (UsingSpecial || (isReversingSpecial && !((TestVanDammeAnim)this).doingMelee))
{
((TestVanDammeAnim)this).AnimateSpecial();
}
if (isDelayingPrimaryFire)
{
primaryFireDelayTimer += Time.deltaTime;
if (primaryFireDelayTimer >= 5f * ((TestVanDammeAnim)this).frameRate)
{
isDelayingPrimaryFire = false;
primaryFireDelayTimer = 0f;
}
}
if (!specialActive)
{
int num = ((TestVanDammeAnim)this).SpecialAmmo;
}
}
private void InitializeProjectiles()
{
ref Projectile reference = ref primaryProjectile;
TestVanDammeAnim heroPrefab = HeroController.GetHeroPrefab((HeroType)0);
reference = ((Unit)((heroPrefab is Rambro) ? heroPrefab : null)).projectile;
ref Projectile reference2 = ref specialProjectile;
TestVanDammeAnim heroPrefab2 = HeroController.GetHeroPrefab((HeroType)13);
reference2 = ((Unit)((heroPrefab2 is IndianaBrones) ? heroPrefab2 : null)).projectile;
specialProjectileData = new ProjectileData
{
bulletCount = 0,
maxBulletCount = 6
};
}
private bool CanUseSpecial()
{
return !((TestVanDammeAnim)this).hasBeenCoverInAcid && !UsingSpecial && ((BroforceObject)this).health > 0 && ((TestVanDammeAnim)this).SpecialAmmo > 0;
}
private void UseSpecialAmmo()
{
if (((TestVanDammeAnim)this).SpecialAmmo > 0)
{
int num = ((TestVanDammeAnim)this).SpecialAmmo;
((TestVanDammeAnim)this).SpecialAmmo = num - 1;
}
}
protected override void UseFire()
{
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
if (!((TestVanDammeAnim)this).usingSpecial && !specialActive && !((TestVanDammeAnim)this).doingMelee && !Object.op_Implicit((Object)(object)((Unit)this).attachedToZipline))
{
FirePrimaryWeapon();
}
else
{
if (((TestVanDammeAnim)this).usingSpecial || specialActive)
{
ReverseSpecialMode();
}
if (((TestVanDammeAnim)this).doingMelee)
{
((TestVanDammeAnim)this).CancelMelee();
}
}
if (!((Object)(object)((Unit)this).attachedToZipline != (Object)null))
{
return;
}
float num = ((Component)this).transform.localScale.x * primaryAttackRange;
float num2 = 8f;
float num3;
float num4;
if (((Component)this).transform.localScale.x > 0f)
{
num3 = 14f;
num4 = 8.5f;
}
else
{
num3 = -14f;
num4 = 8.5f;
}
float num5 = ((Component)this).transform.localScale.x * primaryAttackSpeed;
float num6 = Random.Range(-15, 15);
((TestVanDammeAnim)this).gunFrame = 3;
((TestVanDammeAnim)this).SetGunSprite(((TestVanDammeAnim)this).gunFrame, 0);
ProjectileController.SpawnProjectileLocally(primaryProjectile, (MonoBehaviour)(object)this, ((BroforceObject)this).X + num, ((BroforceObject)this).Y + num2, num5, num6 - 10f + Random.value * 35f, ((NetworkedUnit)this).playerNum).life = primaryProjectileLifetime;
Map.DisturbWildLife(((BroforceObject)this).X, ((BroforceObject)this).Y, 60f, ((NetworkedUnit)this).playerNum);
float num7 = ((BroforceObject)this).X + num3;
float num8 = ((BroforceObject)this).Y + num4;
if ((Object)(object)((Unit)this).attachedToZipline != (Object)null)
{
if (((Component)this).transform.localScale.x > 0f)
{
num7 += muzzleFlashPrimaryOffsetXOnZiplineRight;
num8 += muzzleFlashPrimaryOffsetYOnZiplineRight;
}
else
{
num7 += muzzleFlashPrimaryOffsetXOnZiplineLeft;
num8 += muzzleFlashPrimaryOffsetYOnZiplineLeft;
}
}
EffectsController.CreateMuzzleFlashEffect(num7, num8, -21f, num5 * 0.15f, num6 * 0.15f, ((Component)this).transform);
Sound.GetInstance().PlaySoundEffectAt(MachineGunSounds, 0.7f, ((Component)this).transform.position, 1f + ((TestVanDammeAnim)this).pitchShiftAmount, true, false, false, 0f);
}
protected override void PressSpecial()
{
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
if (((TestVanDammeAnim)this).doingMelee)
{
return;
}
if (!specialActive && CanUseSpecial())
{
UsingSpecial = true;
((Component)((TestVanDammeAnim)this).sprite).GetComponent<Renderer>().material = stealthMaterial;
((TestVanDammeAnim)this).gunSprite.meshRender.material = stealthGunMaterial;
}
else if (specialActive)
{
if (((TestVanDammeAnim)this).SpecialAmmo > 0)
{
SetupSpecialAttack();
FireSpecialWeapon();
}
else if (((TestVanDammeAnim)this).SpecialAmmo <= 0)
{
HeroController.FlashSpecialAmmo(((NetworkedUnit)this).playerNum);
Sound.GetInstance().PlaySoundEffectAt(emptyGunSound, 1f, ((Component)this).transform.position, 1f, true, false, false, 0f);
}
}
else if (!specialActive && ((TestVanDammeAnim)this).SpecialAmmo <= 0)
{
HeroController.FlashSpecialAmmo(((NetworkedUnit)this).playerNum);
Sound.GetInstance().PlaySoundEffectAt(emptyGunSound, 1f, ((Component)this).transform.position, 1f, true, false, false, 0f);
}
}
protected override void AnimateSpecial()
{
((TestVanDammeAnim)this).frameRate = 0.0334f;
if (wasRunning)
{
UsingSpecial = false;
isReversingSpecial = false;
}
else if (((TestVanDammeAnim)this).wallClimbing || ((TestVanDammeAnim)this).wallDrag)
{
if (UsingSpecial)
{
specialActive = true;
((TestVanDammeAnim)this).material = stealthMaterial;
((TestVanDammeAnim)this).gunSprite.meshRender.material = stealthGunMaterial;
((TestVanDammeAnim)this).SetGunPosition(3f, 0f);
((TestVanDammeAnim)this).ActivateGun();
UsingSpecial = false;
((TestVanDammeAnim)this).ChangeFrame();
}
}
else if (UsingSpecial)
{
((TestVanDammeAnim)this).DeactivateGun();
int num = Mathf.Clamp((int)(specialAnimationTimer / ((TestVanDammeAnim)this).frameRate), 0, 8);
((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)((23 + num) * ((TestVanDammeAnim)this).spritePixelWidth), (float)(9 * ((TestVanDammeAnim)this).spritePixelHeight));
specialAnimationTimer += Time.deltaTime;
if (num >= 8)
{
specialActive = true;
((TestVanDammeAnim)this).material = stealthMaterial;
((TestVanDammeAnim)this).gunSprite.meshRender.material = stealthGunMaterial;
((TestVanDammeAnim)this).SetGunPosition(3f, 0f);
((TestVanDammeAnim)this).ActivateGun();
UsingSpecial = false;
((TestVanDammeAnim)this).ChangeFrame();
specialAnimationTimer = 0f;
}
}
else if (isReversingSpecial)
{
((TestVanDammeAnim)this).DeactivateGun();
int num2 = Mathf.Clamp(5 - (int)(specialAnimationTimer / ((TestVanDammeAnim)this).frameRate), 0, 5);
((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)((23 + num2) * ((TestVanDammeAnim)this).spritePixelWidth), (float)(9 * ((TestVanDammeAnim)this).spritePixelHeight));
specialAnimationTimer += Time.deltaTime;
if (num2 <= 0)
{
isReversingSpecial = false;
((TestVanDammeAnim)this).ActivateGun();
((Component)this).GetComponent<Renderer>().material = normalMaterial;
((TestVanDammeAnim)this).gunSprite.meshRender.material = normalGunMaterial;
((TestVanDammeAnim)this).ChangeFrame();
isDelayingPrimaryFire = true;
primaryFireDelayTimer = 0f;
specialAnimationTimer = 0f;
}
}
}
protected override void SetGunPosition(float xOffset, float yOffset)
{
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
if (!specialActive)
{
if (!((Object)(object)((Unit)this).attachedToZipline != (Object)null))
{
((Component)((TestVanDammeAnim)this).gunSprite).transform.localPosition = new Vector3(xOffset + 0f, yOffset, -1f);
}
else if (((TestVanDammeAnim)this).right && (((Unit)this).attachedToZipline.Direction.x < 0f || ((Unit)this).attachedToZipline.IsHorizontalZipline))
{
((Component)((TestVanDammeAnim)this).gunSprite).transform.localPosition = new Vector3(xOffset + 2f, yOffset + 1f, -1f);
}
else if (((TestVanDammeAnim)this).left && (((Unit)this).attachedToZipline.Direction.x > 0f || ((Unit)this).attachedToZipline.IsHorizontalZipline))
{
((Component)((TestVanDammeAnim)this).gunSprite).transform.localPosition = new Vector3(xOffset - 2f, yOffset + 1f, -1f);
}
}
else if ((Object)(object)((Unit)this).attachedToZipline != (Object)null)
{
if (((TestVanDammeAnim)this).right && (((Unit)this).attachedToZipline.Direction.x < 0f || ((Unit)this).attachedToZipline.IsHorizontalZipline))
{
((Component)((TestVanDammeAnim)this).gunSprite).transform.localPosition = new Vector3(xOffset + 4f, yOffset + 1f, -1f);
}
else if (((TestVanDammeAnim)this).left && (((Unit)this).attachedToZipline.Direction.x > 0f || ((Unit)this).attachedToZipline.IsHorizontalZipline))
{
((Component)((TestVanDammeAnim)this).gunSprite).transform.localPosition = new Vector3(xOffset - 4f, yOffset + 1f, -1f);
}
}
else
{
((Component)((TestVanDammeAnim)this).gunSprite).transform.localPosition = new Vector3(xOffset, yOffset + 0.4f, -1f);
}
}
protected override void FireFlashAvatar()
{
if (!isReversingSpecial && !isDelayingPrimaryFire)
{
((TestVanDammeAnim)this).FireFlashAvatar();
}
}
private void SetupSpecialAttack()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
if (!CanUseSpecial())
{
return;
}
Vector3 localScale = ((Component)this).transform.localScale;
float num = ((((Component)this).transform.localScale.x > 0f) ? 15f : (-15f));
float num2 = 8.3f;
float num3 = ((Component)this).transform.localScale.x * 750f;
float num4 = Random.Range(-5, 5);
((TestVanDammeAnim)this).gunFrame = 3;
((TestVanDammeAnim)this).SetGunSprite(((TestVanDammeAnim)this).gunFrame, 0);
float num5 = ((BroforceObject)this).X + num;
float num6 = ((BroforceObject)this).Y + num2;
if ((Object)(object)((Unit)this).attachedToZipline != (Object)null)
{
if (((Component)this).transform.localScale.x > 0f)
{
num5 += muzzleFlashOffsetXOnZiplineRight;
num6 += muzzleFlashOffsetYOnZiplineRight;
}
else
{
num5 += muzzleFlashOffsetXOnZiplineLeft;
num6 += muzzleFlashOffsetYOnZiplineLeft;
}
}
EffectsController.CreateMuzzleFlashMediumEffect(num5, num6, -20f, num3 * 0.06f, num4 * 0.06f, ((Component)this).transform);
Sound.GetInstance().PlaySoundEffectAt(CobroGunSounds, 1f, ((Component)this).transform.position, 0.88f + ((TestVanDammeAnim)this).pitchShiftAmount, true, false, false, 0f);
Map.DisturbWildLife(((BroforceObject)this).X, ((BroforceObject)this).Y, 60f, ((NetworkedUnit)this).playerNum);
SortOfFollow.Shake(0.4f, 0.4f);
((TestVanDammeAnim)this).avatarGunFireTime = 0.06f;
HeroController.SetAvatarFire(((NetworkedUnit)this).playerNum, ((TestVanDammeAnim)this).usePrimaryAvatar);
((TestVanDammeAnim)this).pressSpecialFacingDirection = (int)((Component)this).transform.localScale.x;
((BroforceObject)this).yI = ((BroforceObject)this).yI + 10f;
((TestVanDammeAnim)this).xIBlast = (0f - ((Component)this).transform.localScale.x) * 15f;
}
private void FireSpecialWeapon()
{
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
if (((TestVanDammeAnim)this).SpecialAmmo > 0)
{
float num = ((BroforceObject)this).X + ((Component)this).transform.localScale.x * 26f;
float num2 = ((BroforceObject)this).Y + 8.3f;
float num3 = ((Component)this).transform.localScale.x * 750f;
float num4 = Random.Range(-10, 10);
ProjectileController.SpawnProjectileLocally(specialProjectile, (MonoBehaviour)(object)this, num, num2, num3, num4, ((NetworkedUnit)this).playerNum);
Map.DisturbWildLife(((BroforceObject)this).X, ((BroforceObject)this).Y, 60f, ((NetworkedUnit)this).playerNum);
UseSpecialAmmo();
}
else
{
HeroController.FlashSpecialAmmo(((NetworkedUnit)this).playerNum);
Sound.GetInstance().PlaySoundEffectAt(emptyGunSound, 1f, ((Component)this).transform.position, 1f, true, false, false, 0f);
}
}
private void ReverseSpecialMode()
{
UsingSpecial = false;
specialActive = false;
isReversingSpecial = true;
usingSpecialFrame = 8;
specialAnimationTimer = 0f;
}
private void FirePrimaryWeapon()
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
if (((TestVanDammeAnim)this).usingSpecial || specialActive || isReversingSpecial || isDelayingPrimaryFire)
{
if (((TestVanDammeAnim)this).usingSpecial || specialActive)
{
ReverseSpecialMode();
}
return;
}
float num = ((Component)this).transform.localScale.x * primaryAttackRange;
float num2 = 8f;
float num3;
float num4;
if (((Component)this).transform.localScale.x > 0f)
{
num3 = 14f;
num4 = 8.5f;
}
else
{
num3 = -14f;
num4 = 8.5f;
}
float num5 = ((Component)this).transform.localScale.x * primaryAttackSpeed;
float num6 = Random.Range(-15, 15);
((TestVanDammeAnim)this).gunFrame = 3;
((TestVanDammeAnim)this).SetGunSprite(((TestVanDammeAnim)this).gunFrame, 0);
ProjectileController.SpawnProjectileLocally(primaryProjectile, (MonoBehaviour)(object)this, ((BroforceObject)this).X + num, ((BroforceObject)this).Y + num2, num5, num6 - 10f + Random.value * 35f, ((NetworkedUnit)this).playerNum).life = primaryProjectileLifetime;
EffectsController.CreateMuzzleFlashEffect(((BroforceObject)this).X + num3, ((BroforceObject)this).Y + num4, -21f, num5 * 0.15f, num6 * 0.15f, ((Component)this).transform);
Sound.GetInstance().PlaySoundEffectAt(MachineGunSounds, 0.6f, ((Component)this).transform.position, 0.85f + ((TestVanDammeAnim)this).pitchShiftAmount, true, false, false, 0f);
}
protected override void RunGun()
{
if (((TestVanDammeAnim)this).WallDrag || ((TestVanDammeAnim)this).gunFrame <= 0)
{
return;
}
((TestVanDammeAnim)this).gunCounter = ((TestVanDammeAnim)this).gunCounter + ((Unit)this).t;
if (((TestVanDammeAnim)this).gunCounter > 0.0334f)
{
((TestVanDammeAnim)this).gunCounter = ((TestVanDammeAnim)this).gunCounter - 0.0334f;
((TestVanDammeAnim)this).gunFrame = ((TestVanDammeAnim)this).gunFrame - 1;
if (((TestVanDammeAnim)this).gunFrame == 3)
{
((TestVanDammeAnim)this).gunFrame = 0;
}
((TestVanDammeAnim)this).SetGunSprite(((TestVanDammeAnim)this).gunFrame, 0);
}
}
protected override void PressHighFiveMelee(bool forceHighFive = false)
{
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Invalid comparison between Unknown and I4
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: Unknown result type (might be due to invalid IL or missing references)
if (((BroforceObject)this).health <= 0 || ((TestVanDammeAnim)this).MustIgnoreHighFiveMeleePress())
{
return;
}
((TestVanDammeAnim)this).SetGestureAnimation((Gestures)0);
Grenade nearbyGrenade = Map.GetNearbyGrenade(20f, ((BroforceObject)this).X, ((BroforceObject)this).Y + ((TestVanDammeAnim)this).waistHeight);
((TestVanDammeAnim)this).FindNearbyMook();
TeleportDoor nearbyTeleportDoor = Map.GetNearbyTeleportDoor(((BroforceObject)this).X, ((BroforceObject)this).Y);
if ((Object)(object)nearbyTeleportDoor != (Object)null && ((TestVanDammeAnim)this).CanUseSwitch() && nearbyTeleportDoor.Activate((TestVanDammeAnim)(object)this))
{
return;
}
Switch nearbySwitch = Map.GetNearbySwitch(((BroforceObject)this).X, ((BroforceObject)this).Y);
if (GameModeController.IsDeathMatchMode || (int)GameModeController.GameMode == 3)
{
if ((Object)(object)nearbySwitch != (Object)null && ((TestVanDammeAnim)this).CanUseSwitch())
{
nearbySwitch.Activate((Unit)(object)this);
}
else
{
bool flag = false;
for (int i = -1; i < 4; i++)
{
if (i != ((NetworkedUnit)this).playerNum && Map.IsUnitNearby(i, ((BroforceObject)this).X + ((Component)this).transform.localScale.x * 16f, ((BroforceObject)this).Y + 8f, 28f, 14f, true, ref ((TestVanDammeAnim)this).meleeChosenUnit))
{
((TestVanDammeAnim)this).StartMelee();
flag = true;
}
}
if (!flag && (Object)(object)nearbySwitch != (Object)null && ((TestVanDammeAnim)this).CanUseSwitch())
{
nearbySwitch.Activate((Unit)(object)this);
}
}
}
if ((Object)(object)nearbyGrenade != (Object)null && (!(nearbyGrenade is CoorsCan coorsCan) || coorsCan.lastThrownCooldown <= 0f))
{
((TestVanDammeAnim)this).doingMelee = (((TestVanDammeAnim)this).dashingMelee = false);
((TestVanDammeAnim)this).ThrowBackGrenade(nearbyGrenade);
}
else
{
if (GameModeController.IsDeathMatchMode && ((TestVanDammeAnim)this).doingMelee)
{
return;
}
if (Map.IsCitizenNearby(((BroforceObject)this).X, ((BroforceObject)this).Y, 32, 32))
{
if (!((TestVanDammeAnim)this).doingMelee)
{
((TestVanDammeAnim)this).StartHighFive();
}
}
else if (forceHighFive && !((TestVanDammeAnim)this).doingMelee)
{
((TestVanDammeAnim)this).StartHighFive();
}
else if ((Object)(object)nearbySwitch != (Object)null && ((TestVanDammeAnim)this).CanUseSwitch())
{
nearbySwitch.Activate((Unit)(object)this);
}
else if ((Object)(object)((TestVanDammeAnim)this).meleeChosenUnit == (Object)null && Map.IsUnitNearby(-1, ((BroforceObject)this).X + ((Component)this).transform.localScale.x * 16f, ((BroforceObject)this).Y + 8f, 28f, 14f, false, ref ((TestVanDammeAnim)this).meleeChosenUnit))
{
((TestVanDammeAnim)this).StartMelee();
}
else if (((TestVanDammeAnim)this).CheckBustCage())
{
((TestVanDammeAnim)this).StartMelee();
}
else if (HeroController.IsAnotherPlayerNearby(((NetworkedUnit)this).playerNum, ((BroforceObject)this).X, ((BroforceObject)this).Y, 32f, 32f))
{
if (!((TestVanDammeAnim)this).doingMelee)
{
((TestVanDammeAnim)this).StartHighFive();
}
}
else
{
((TestVanDammeAnim)this).StartMelee();
}
}
}
protected override void StartCustomMelee()
{
if (!((TestVanDammeAnim)this).wallClimbing && !((TestVanDammeAnim)this).wallDrag && !((TestVanDammeAnim)this).jumpingMelee)
{
if (!Object.op_Implicit((Object)(object)((Unit)this).attachedToZipline) && ((BroBase)this).CanStartNewMelee())
{
((Unit)this).frame = 0;
((TestVanDammeAnim)this).counter = ((TestVanDammeAnim)this).counter - 0.0667f;
((TestVanDammeAnim)this).AnimateMelee();
throwingMook = (Object)(object)((TestVanDammeAnim)this).nearbyMook != (Object)null && ((Unit)((TestVanDammeAnim)this).nearbyMook).CanBeThrown();
}
else if (((BroBase)this).CanStartMeleeFollowUp())
{
((TestVanDammeAnim)this).meleeFollowUp = true;
}
((BroforceObject)this).xI = 0f;
((BroforceObject)this).yI = 0f;
((BroBase)this).StartMeleeCommon();
}
}
protected override void RunKnifeMeleeMovement()
{
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
if (((TestVanDammeAnim)this).wallClimbing || ((TestVanDammeAnim)this).wallDrag)
{
return;
}
if (((TestVanDammeAnim)this).dashingMelee)
{
if (((Unit)this).frame <= 1)
{
((BroforceObject)this).xI = 0f;
((BroforceObject)this).yI = 0f;
}
else if (((Unit)this).frame > 3)
{
((TestVanDammeAnim)this).ApplyFallingGravity();
}
else if (!((TestVanDammeAnim)this).isInQuicksand)
{
((BroforceObject)this).xI = ((TestVanDammeAnim)this).speed * 1f * ((Component)this).transform.localScale.x;
}
}
else if (((BroforceObject)this).xI != 0f || ((BroforceObject)this).yI != 0f)
{
((TestVanDammeAnim)this).CancelMelee();
}
}
protected override void StartMeleeCommon()
{
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
if (!((TestVanDammeAnim)this).wallClimbing && !((TestVanDammeAnim)this).wallDrag && !((TestVanDammeAnim)this).jumpingMelee && !((TestVanDammeAnim)this).meleeFollowUp && ((BroBase)this).CanStartNewMelee())
{
((Unit)this).frame = 0;
((TestVanDammeAnim)this).counter = ((TestVanDammeAnim)this).counter - 0.0667f;
throwingMook = (Object)(object)((TestVanDammeAnim)this).nearbyMook != (Object)null && ((Unit)((TestVanDammeAnim)this).nearbyMook).CanBeThrown();
((BroBase)this).ResetMeleeValues();
((BroBase)this).lerpToMeleeTargetPos = 0f;
((TestVanDammeAnim)this).doingMelee = true;
((TestVanDammeAnim)this).showHighFiveAfterMeleeTimer = 0f;
((TestVanDammeAnim)this).SetMeleeType();
((TestVanDammeAnim)this).DeactivateGun();
((BroBase)this).meleeStartPos = ((Component)this).transform.position;
((TestVanDammeAnim)this).AnimateMelee();
}
}
protected override void SetMeleeType()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Invalid comparison between Unknown and I4
if (!((TestVanDammeAnim)this).useNewKnifingFrames)
{
((TestVanDammeAnim)this).standingMelee = true;
((TestVanDammeAnim)this).jumpingMelee = false;
((TestVanDammeAnim)this).dashingMelee = false;
}
else if ((int)((Unit)this).actionState == 3 || ((BroforceObject)this).Y > ((TestVanDammeAnim)this).groundHeight + 1f)
{
((TestVanDammeAnim)this).standingMelee = false;
((TestVanDammeAnim)this).jumpingMelee = true;
((TestVanDammeAnim)this).dashingMelee = false;
}
else if (((TestVanDammeAnim)this).right || ((TestVanDammeAnim)this).left)
{
((TestVanDammeAnim)this).standingMelee = false;
((TestVanDammeAnim)this).jumpingMelee = false;
((TestVanDammeAnim)this).dashingMelee = true;
}
else
{
((TestVanDammeAnim)this).standingMelee = true;
((TestVanDammeAnim)this).jumpingMelee = false;
((TestVanDammeAnim)this).dashingMelee = false;
}
}
protected override void AnimateMelee()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Invalid comparison between Unknown and I4
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Invalid comparison between Unknown and I4
if ((((TestVanDammeAnim)this).wallClimbing || ((TestVanDammeAnim)this).wallDrag || (int)((Unit)this).actionState == 3) && (int)((Unit)this).actionState != 6)
{
((TestVanDammeAnim)this).CancelMelee();
return;
}
if (((Unit)this).frame == 3 && ((TestVanDammeAnim)this).dashingMelee)
{
((BroBase)this).PerformKnifeMeleeAttack(true, true);
}
((BroforceObject)this).xI = 0f;
((BroforceObject)this).yI = 0f;
((TestVanDammeAnim)this).frameRate = 0.0667f;
((TestVanDammeAnim)this).counter = ((TestVanDammeAnim)this).counter + Time.deltaTime;
if (((TestVanDammeAnim)this).counter >= ((TestVanDammeAnim)this).frameRate)
{
int frame = ((Unit)this).frame;
((Unit)this).frame = frame + 1;
((TestVanDammeAnim)this).counter = 0f;
}
if (((TestVanDammeAnim)this).dashingMelee)
{
int num = 6;
int num2 = 17;
int num3 = Mathf.Clamp(((Unit)this).frame, 0, 7);
((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)(num2 * ((TestVanDammeAnim)this).spritePixelWidth + num3 * ((TestVanDammeAnim)this).spritePixelWidth), (float)(num * ((TestVanDammeAnim)this).spritePixelHeight));
((TestVanDammeAnim)this).avatarGunFireTime = 0.07f;
HeroController.SetAvatarAngry(((NetworkedUnit)this).playerNum, ((TestVanDammeAnim)this).usePrimaryAvatar);
if (((Unit)this).frame >= 7)
{
((Unit)this).frame = 0;
((TestVanDammeAnim)this).CancelMelee();
}
return;
}
int num4 = 10;
int num5 = 11;
int num6 = Mathf.Clamp(((Unit)this).frame, 0, 20);
((TestVanDammeAnim)this).sprite.SetLowerLeftPixel((float)(num5 * ((TestVanDammeAnim)this).spritePixelWidth + num6 * ((TestVanDammeAnim)this).spritePixelWidth), (float)(num4 * ((TestVanDammeAnim)this).spritePixelHeight));
if (((Unit)this).frame == 18)
{
ThrowProjectile();
}
if (((Unit)this).frame >= 20)
{
((Unit)this).frame = 0;
((TestVanDammeAnim)this).CancelMelee();
}
if (((Unit)this).frame == 2 && (Object)(object)((TestVanDammeAnim)this).nearbyMook != (Object)null && ((Unit)((TestVanDammeAnim)this).nearbyMook).CanBeThrown() && (((TestVanDammeAnim)this).highFive || ((TestVanDammeAnim)this).standingMelee))
{
((TestVanDammeAnim)this).CancelMelee();
((TestVanDammeAnim)this).ThrowBackMook(((TestVanDammeAnim)this).nearbyMook);
((TestVanDammeAnim)this).nearbyMook = null;
}
}
private void ThrowProjectile()
{
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
CoorsCan coorsCan = ((!((TestVanDammeAnim)this).down || !((Unit)this).IsOnGround() || !((TestVanDammeAnim)this).ducking) ? (ProjectileController.SpawnGrenadeLocally((Grenade)(object)coorscanPrefab, (MonoBehaviour)(object)this, ((BroforceObject)this).X + Mathf.Sign(((Component)this).transform.localScale.x) * 6f, ((BroforceObject)this).Y + 10f, 0.001f, 0.011f, Mathf.Sign(((Component)this).transform.localScale.x) * 300f, 250f, ((NetworkedUnit)this).playerNum, 0) as CoorsCan) : (ProjectileController.SpawnGrenadeLocally((Grenade)(object)coorscanPrefab, (MonoBehaviour)(object)this, ((BroforceObject)this).X + Mathf.Sign(((Component)this).transform.localScale.x) * 6f, ((BroforceObject)this).Y + 10f, 0.001f, 0.011f, Mathf.Sign(((Component)this).transform.localScale.x) * 30f, 70f, ((NetworkedUnit)this).playerNum, 0) as CoorsCan));
((Behaviour)coorsCan).enabled = true;
}
protected override bool MustIgnoreHighFiveMeleePress()
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Invalid comparison between Unknown and I4
return (Object)(object)((TestVanDammeAnim)this).heldGrenade != (Object)null || (Object)(object)((TestVanDammeAnim)this).heldMook != (Object)null || ((TestVanDammeAnim)this).usingSpecial || Object.op_Implicit((Object)(object)((Unit)this).attachedToZipline) || ((TestVanDammeAnim)this).jumpingMelee || (int)((Unit)this).actionState == 3 || ((TestVanDammeAnim)this).doingMelee;
}
protected override void PerformKnifeMeleeAttack(bool shouldTryHitTerrain, bool playMissSound)
{
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
bool flag = default(bool);
Map.DamageDoodads(3, (DamageType)14, ((BroforceObject)this).X + (float)(((NetworkedUnit)this).Direction * 4), ((BroforceObject)this).Y, 0f, 0f, 6f, ((NetworkedUnit)this).playerNum, ref flag, (MonoBehaviour)null);
((BroBase)this).KickDoors(24f);
AudioClip val = ((!((Object)(object)((TestVanDammeAnim)this).gunSprite.meshRender.material == (Object)(object)normalGunMaterial)) ? DashingMeleeSounds[1] : DashingMeleeSounds[0]);
if (Object.op_Implicit((Object)(object)Map.HitClosestUnit((MonoBehaviour)(object)this, ((NetworkedUnit)this).playerNum, 4, (DamageType)14, 14f, 24f, ((BroforceObject)this).X + ((Component)this).transform.localScale.x * 8f, ((BroforceObject)this).Y + 8f, ((Component)this).transform.localScale.x * 200f, 500f, true, false, ((NetworkObject)this).IsMine, false, true)))
{
if ((Object)(object)val != (Object)null)
{
((TestVanDammeAnim)this).sound.PlaySoundEffectAt(val, 0.7f, ((Component)this).transform.position, 1f, true, false, false, 0f);
}
((TestVanDammeAnim)this).meleeHasHit = true;
}
else if (playMissSound)
{
((TestVanDammeAnim)this).sound.PlaySoundEffectAt(((TestVanDammeAnim)this).soundHolder.missSounds, 0.7f, ((Component)this).transform.position, 1f, true, false, false, 0f);
}
((TestVanDammeAnim)this).meleeChosenUnit = null;
if (shouldTryHitTerrain && ((BroBase)this).TryMeleeTerrain(0, 2))
{
((TestVanDammeAnim)this).meleeHasHit = true;
}
}
protected override bool TryMeleeTerrain(int offset = 0, int meleeDamage = 2)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
if (!Physics.Raycast(new Vector3(((BroforceObject)this).X - ((Component)this).transform.localScale.x * 4f, ((BroforceObject)this).Y + 4f, 0f), new Vector3(((Component)this).transform.localScale.x, 0f, 0f), ref ((TestVanDammeAnim)this).raycastHit, (float)(16 + offset), LayerMask.op_Implicit(((TestVanDammeAnim)this).groundLayer)))
{
return false;
}
Cage component = ((Component)((RaycastHit)(ref ((TestVanDammeAnim)this).raycastHit)).collider).GetComponent<Cage>();
if ((Object)(object)component == (Object)null && (Object)(object)((Component)((RaycastHit)(ref ((TestVanDammeAnim)this).raycastHit)).collider).transform.parent != (Object)null)
{
component = ((Component)((Component)((RaycastHit)(ref ((TestVanDammeAnim)this).raycastHit)).collider).transform.parent).GetComponent<Cage>();
}
if ((Object)(object)component != (Object)null)
{
MapController.Damage_Networked((MonoBehaviour)(object)this, ((Component)((RaycastHit)(ref ((TestVanDammeAnim)this).raycastHit)).collider).gameObject, ((BroforceObject)component).health, (DamageType)7, 0f, 40f, ((RaycastHit)(ref ((TestVanDammeAnim)this).raycastHit)).point.x, ((RaycastHit)(ref ((TestVanDammeAnim)this).raycastHit)).point.y);
return true;
}
MapController.Damage_Networked((MonoBehaviour)(object)this, ((Component)((RaycastHit)(ref ((TestVanDammeAnim)this).raycastHit)).collider).gameObject, meleeDamage, (DamageType)7, 0f, 40f, ((RaycastHit)(ref ((TestVanDammeAnim)this).raycastHit)).point.x, ((RaycastHit)(ref ((TestVanDammeAnim)this).raycastHit)).point.y);
_ = ((BroBase)this).currentMeleeType;
if (false)
{
((TestVanDammeAnim)this).sound.PlaySoundEffectAt(((TestVanDammeAnim)this).soundHolder.alternateMeleeHitSound, 0.3f, ((Component)this).transform.position, 1f, true, false, false, 0f);
}
else
{
((TestVanDammeAnim)this).sound.PlaySoundEffectAt(((TestVanDammeAnim)this).soundHolder.alternateMeleeHitSound, 0.3f, ((Component)this).transform.position, 1f, true, false, false, 0f);
}
EffectsController.CreateProjectilePopWhiteEffect(((BroforceObject)this).X + ((Unit)this).width * ((Component)this).transform.localScale.x, ((BroforceObject)this).Y + ((Unit)this).height + 4f);
return true;
}
protected override void OnDestroy()
{
((BroBase)this).OnDestroy();
}
}
public class CoorsCan : Grenade
{
public static Material storedMat;
private Rigidbody rigidbody;
private AudioClip explosionSound;
public Vector3 centerOfMass = new Vector3(0f, -0.3f, 0f);
private bool hasCollided;
private float soundThreshold = 0.5f;
private AudioClip[] canSounds;
public AudioClip[] canRollSounds;
private AudioSource audioSource;
public float impactThreshold = 1f;
private float nextImpactSoundTime;
private float impactSoundCooldown = 0.5f;
public float yMovementThreshold = 0.5f;
private Vector3 lastPosition;
public LayerMask collisionLayers;
private float currentVolume = 1f;
private float volumeReductionStep = 0.3f;
private float minVolume = 0.2f;
public float lastThrownCooldown = 0f;
protected override void Awake()
{
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
Renderer component = (Renderer)(object)((Component)this).gameObject.GetComponent<MeshRenderer>();
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string text = Path.Combine(directoryName, "sounds");
if ((Object)(object)storedMat == (Object)null)
{
storedMat = ResourcesController.GetMaterial(directoryName, "CoorsCan.png");
}
if ((Object)(object)((Component)this).GetComponent<Collider>() == (Object)null)
{
((Component)this).gameObject.AddComponent<BoxCollider>();
}
canSounds = (AudioClip[])(object)new AudioClip[4]
{
ResourcesController.GetAudioClip(text, "can1.wav"),
ResourcesController.GetAudioClip(text, "can2.wav"),
ResourcesController.GetAudioClip(text, "can3.wav"),
ResourcesController.GetAudioClip(text, "can4.wav")
};
component.material = storedMat;
((Shrapnel)this).sprite = ((Component)this).gameObject.GetComponent<SpriteSM>();
((Shrapnel)this).sprite.lowerLeftPixel = new Vector2(0f, 16f);
((Shrapnel)this).sprite.pixelDimensions = new Vector2(16f, 16f);
((SpriteBase)((Shrapnel)this).sprite).plane = (SPRITE_PLANE)0;
((SpriteBase)((Shrapnel)this).sprite).width = 18f;
((SpriteBase)((Shrapnel)this).sprite).height = 22f;
explosionSound = ResourcesController.GetAudioClip(text, "can1.wav");
((Grenade)this).Awake();
audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
audioSource.playOnAwake = false;
audioSource.loop = false;
base.fragileLayer = LayerMask.op_Implicit(1 << LayerMask.NameToLayer("DirtyHippie"));
base.trailRenderer = null;
((Shrapnel)this).bounceM = 0.2f;
base.disabledAtStart = false;
((Shrapnel)this).shrink = false;
base.trailType = (TrailType)0;
((Shrapnel)this).lifeLossOnBounce = false;
((Shrapnel)this).deathOnBounce = false;
((Shrapnel)this).destroyInsideWalls = false;
((Shrapnel)this).rotateAtRightAngles = false;
((Shrapnel)this).fades = false;
((Shrapnel)this).fadeUVs = false;
base.useAngularFriction = true;
((Shrapnel)this).shrapnelControlsMotion = false;
collisionLayers = LayerMask.op_Implicit(LayerMask.GetMask(new string[3] { "Ground", "DirtyHippie", "Switches" }));
}
protected override void Start()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
base.mainMaterial = ((Component)this).GetComponent<Renderer>().sharedMaterial;
((Grenade)this).Start();
((Shrapnel)this).groundLayer = Map.groundLayer;
Physics.CheckSphere(((Component)this).transform.position, (float)LayerMask.op_Implicit(collisionLayers));
((Grenade)this).RegisterGrenade();
if (base.disabledAtStart)
{
((BroforceObject)this).SetXY(((Component)this).transform);
((Shrapnel)this).life = (2f + ((Shrapnel)this).random.value) * ((Shrapnel)this).lifeM;
((Shrapnel)this).r = 0f;
((Behaviour)this).enabled = false;
}
audioSource = ((Component)this).GetComponent<AudioSource>();
lastPosition = ((Component)this).transform.position;
}
protected override void RegisterGrenade()
{
if (base.shootable)
{
Map.RegisterShootableGrenade((Grenade)(object)this);
}
Map.RegisterGrenade((Grenade)(object)this);
}
public override void ThrowGrenade(float XI, float YI, float newX, float newY, int _playerNum)
{
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
((Behaviour)this).enabled = true;
((Component)this).transform.parent = null;
((BroforceObject)this).SetXY(newX, newY);
if (Mathf.Abs(XI) > 100f)
{
((BroforceObject)this).xI = Mathf.Sign(XI) * 300f;
((BroforceObject)this).yI = 250f;
}
else
{
((BroforceObject)this).xI = XI;
((BroforceObject)this).yI = YI;
}
base.playerNum = _playerNum;
rigidbody.position = new Vector3(newX, newY);
if (Mathf.Abs(((BroforceObject)this).xI) > 100f)
{
((Shrapnel)this).rI = (0f - Mathf.Sign(((BroforceObject)this).xI)) * (float)Random.Range(20, 25);
}
else
{
((Shrapnel)this).rI = (0f - Mathf.Sign(((BroforceObject)this).xI)) * (float)Random.Range(10, 15);
}
rigidbody.AddForce(new Vector3(((BroforceObject)this).xI, ((BroforceObject)this).yI, 0f), (ForceMode)2);
rigidbody.AddTorque(new Vector3(0f, 0f, ((Shrapnel)this).rI), (ForceMode)2);
((Grenade)this).SetMinLife(0.7f);
lastThrownCooldown = 0.3f;
}
public override void Launch(float newX, float newY, float xI, float yI)
{
//IL_045d: Unknown result type (might be due to invalid IL or missing references)
//IL_0462: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)this == (Object)null)
{
return;
}
((BroforceObject)this).SetXY(newX, newY);
((BroforceObject)this).xI = xI;
((BroforceObject)this).yI = yI;
((Shrapnel)this).r = 0f;
((Shrapnel)this).life = 6f;
((Shrapnel)this).startLife = ((Shrapnel)this).life;
if ((Object)(object)((Shrapnel)this).sprite != (Object)null)
{
((Shrapnel)this).spriteWidth = ((SpriteBase)((Shrapnel)this).sprite).width;
((Shrapnel)this).spriteHeight = ((SpriteBase)((Shrapnel)this).sprite).height;
}
((Shrapnel)this).spriteWidthI = (0f - ((Shrapnel)this).spriteWidth) / ((Shrapnel)this).life * 1f;
((Shrapnel)this).spriteHeightI = (0f - ((Shrapnel)this).spriteHeight) / ((Shrapnel)this).life * 1f;
if (Mathf.Abs(xI) > 100f)
{
((Shrapnel)this).rI = (0f - Mathf.Sign(xI)) * (float)Random.Range(20, 25);
}
else
{
((Shrapnel)this).rI = (0f - Mathf.Sign(xI)) * (float)Random.Range(10, 15);
}
((Shrapnel)this).SetPosition();
if (!((Shrapnel)this).shrapnelControlsMotion && (Object)(object)((Component)this).GetComponent<Rigidbody>() == (Object)null)
{
BoxCollider val = ((Component)this).gameObject.GetComponent<BoxCollider>();
if ((Object)(object)val == (Object)null)
{
val = ((Component)this).gameObject.AddComponent<BoxCollider>();
}
val.size = new Vector3(9f, 3f, 5f);
rigidbody = ((Component)this).gameObject.AddComponent<Rigidbody>();
rigidbody.AddForce(new Vector3(xI, yI, 0f), (ForceMode)2);
rigidbody.constraints = (RigidbodyConstraints)56;
rigidbody.maxAngularVelocity = float.MaxValue;
rigidbody.AddTorque(new Vector3(0f, 0f, ((Shrapnel)this).rI), (ForceMode)2);
rigidbody.drag = 0.8f;
rigidbody.angularDrag = 0.7f;
rigidbody.mass = 230f;
Quaternion rotation = rigidbody.rotation;
((Quaternion)(ref rotation)).eulerAngles = new Vector3(0f, 0f, 90f);
rigidbody.rotation = rotation;
}
((Behaviour)this).enabled = true;
base.lastTrailX = newX;
base.lastTrailY = newY;
if (Map.InsideWall(newX, newY, ((Shrapnel)this).size, false))
{
if (xI > 0f && !Map.InsideWall(newX - 8f, newY, ((Shrapnel)this).size, false))
{
float num = 8f;
float num2 = 0f;
bool flag = false;
bool flag2 = false;
if (Map.ConstrainToBlocks((MonoBehaviour)(object)this, newX - 8f, newY, ((Shrapnel)this).size, ref num, ref num2, ref flag, ref flag2, false))
{
newX = newX - 8f + num;
newY += num2;
}
xI = (0f - xI) * 0.6f;
}
else if (xI > 0f)
{
float num3 = xI * 0.03f;
float num4 = yI * 0.03f;
bool flag3 = false;
bool flag4 = false;
if (Map.ConstrainToBlocks((MonoBehaviour)(object)this, newX, newY, ((Shrapnel)this).size, ref num3, ref num4, ref flag3, ref flag4, false))
{
((Shrapnel)this).Bounce(flag3, flag4);
}
newX += num3;
newY += num4;
xI = (0f - xI) * 0.6f;
}
if (xI < 0f && !Map.InsideWall(newX + 8f, newY, ((Shrapnel)this).size, false))
{
float num5 = -8f;
float num6 = 0f;
bool flag5 = false;
bool flag6 = false;
if (Map.ConstrainToBlocks((MonoBehaviour)(object)this, newX + 8f, newY, ((Shrapnel)this).size, ref num5, ref num6, ref flag5, ref flag6, false))
{
newX = newX + 8f + num5;
newY += num6;
}
xI = (0f - xI) * 0.6f;
}
else if (xI < 0f)
{
float num7 = xI * 0.03f;
float num8 = yI * 0.03f;
bool flag7 = false;
bool flag8 = false;
if (Map.ConstrainToBlocks((MonoBehaviour)(object)this, newX, newY, ((Shrapnel)this).size, ref num7, ref num8, ref flag7, ref flag8, false))
{
((Shrapnel)this).Bounce(flag7, flag8);
}
newX += num7;
newY += num8;
xI = (0f - xI) * 0.6f;
}
}
((Shrapnel)this).SetPosition();
((SpriteBase)((Shrapnel)this).sprite).offset = new Vector3(0f, -0.5f, 0f);
currentVolume = 1f;
}
private void OnCollisionEnter(Collision collision)
{
if (!hasCollided && (((LayerMask)(ref collisionLayers)).value & (1 << collision.gameObject.layer)) != 0 && Mathf.Abs(((BroforceObject)this).xI) > 1f)
{
PlayRandomCanSound();
hasCollided = true;
}
}
protected override bool Update()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
bool result = ((Grenade)this).Update();
((BroforceObject)this).X = rigidbody.position.x;
((BroforceObject)this).Y = rigidbody.position.y;
Collider[] array = Physics.OverlapSphere(rigidbody.position, 0.5f);
foreach (Collider val in array)
{
if ((Object)(object)((Component)val).gameObject != (Object)(object)((Component)this).gameObject)
{
hasCollided = true;
int layer = ((Component)val).gameObject.layer;
if (((1 << layer) & LayerMask.op_Implicit(collisionLayers)) != 0 && Mathf.Abs(((BroforceObject)this).xI) > 1f && Time.time >= nextImpactSoundTime)
{
PlayImpactSound();
nextImpactSoundTime = Time.time + impactSoundCooldown;
}
break;
}
}
if (hasCollided)
{
Map.AttractMooks(((BroforceObject)this).X, ((BroforceObject)this).Y, 200f, 100f);
Map.AttractAliens(((BroforceObject)this).X, ((BroforceObject)this).Y, 200f, 100f);
HitAllLivingUnits((MonoBehaviour)(object)this, base.playerNum, 0, (DamageType)23, 20f, 10f, ((BroforceObject)this).X, ((BroforceObject)this).Y, ((BroforceObject)this).xI, ((BroforceObject)this).yI, penetrates: false, knock: true);
hasCollided = false;
}
if (Mathf.Abs(((BroforceObject)this).yI) < 0.1f && Mathf.Abs(((BroforceObject)this).xI) > 0.1f)
{
PlayRollingSound();
}
if (lastThrownCooldown > 0f)
{
lastThrownCooldown -= ((Shrapnel)this).t;
}
return result;
}
private void PlayRollingSound()
{
if (canRollSounds.Length != 0)
{
AudioClip val = canRollSounds[Random.Range(0, canRollSounds.Length)];
audioSource.PlayOneShot(val);
}
}
private void PlayImpactSound()
{
if (canSounds.Length != 0)
{
AudioClip val = canSounds[Random.Range(0, canSounds.Length)];
audioSource.PlayOneShot(val);
}
}
public static bool HitAllLivingUnits(MonoBehaviour damageSender, int playerNum, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock)
{
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Expected I4, but got Unknown
if (Map.units == null)
{
return false;
}
bool result = false;
Mathf.CeilToInt((float)damage * 0f);
for (int num = Map.units.Count - 1; num >= 0; num--)
{
Unit val = Map.units[num];
if ((Object)(object)val != (Object)null && playerNum != ((NetworkedUnit)val).playerNum && !val.invulnerable && ((BroforceObject)val).health > 0 && Mathf.Abs(((BroforceObject)val).X - x) - xRange < val.width)
{
float num2 = 0f;
float num3 = 0f;
MookType mookType = val.GetMookType();
MookType val2 = mookType;
switch ((int)val2)
{
case 0:
case 1:
case 4:
case 7:
case 9:
case 10:
case 15:
case 16:
num2 = ((BroforceObject)val).Y + val.height * 0.78f;
num3 = val.height * 0.22f;
break;
case 2:
case 14:
case 18:
case 20:
num2 = ((BroforceObject)val).Y + val.height * 0.8f;
num3 = val.height * 0.2f;
break;
case 5:
case 8:
case 11:
case 13:
case 19:
case 21:
num2 = ((BroforceObject)val).Y + val.height * 0.74f;
num3 = val.height * 0.26f;
break;
}
if (Mathf.Abs(num2 - y) < num3)
{
((Shrapnel)(damageSender as CoorsCan)).Bounce(true, true);
if (!penetrates)
{
return true;
}
}
}
}
return result;
}
private void PlayRandomCanSound()
{
int num = Random.Range(0, canSounds.Length);
audioSource.clip = canSounds[num];
audioSource.volume = currentVolume;
audioSource.Play();
currentVolume = Mathf.Max(currentVolume - volumeReductionStep, minVolume);
}
public override void Death()
{
if (((Grenade)this).FiredLocally)
{
bool friendlyFire = base.friendlyFire;
}
if (!base.dontMakeEffects)
{
((Grenade)this).MakeEffects();
}
((Grenade)this).DestroyGrenade();
}
protected override void RunWarnings()
{
}
protected override void MakeEffects()
{
if ((Object)(object)base.sound == (Object)null)
{
base.sound = Sound.GetInstance();
}
}
}