void Start() { m_collider = GetComponent <Collider>(); Recoil recoil = GetComponent <Recoil>(); recoil.OnLand += OnBlockLands; }
void Awake() { interactionSystem = GetComponent <InteractionSystem>(); mAnim = GetComponent <Animator>(); recoil = GetComponent <Recoil>(); }
private void Awake() { Log("Added Kin MonoBehaviour"); if (!PlayerData.instance.infectedKnightDreamDefeated) { return; } if (!LostLord.Instance.IsInHall) { return; } ModHooks.Instance.ObjectPoolSpawnHook += Projectile; On.EnemyDeathEffects.EmitInfectedEffects += OnEmitInfected; On.EnemyDeathEffects.EmitEffects += No; On.EnemyDeathEffects.EmitCorpse += EmitCorpse; On.InfectedEnemyEffects.RecieveHitEffect += RecieveHit; UnityEngine.SceneManagement.SceneManager.activeSceneChanged += OnDestroy2; _hm = gameObject.GetComponent <HealthManager>(); _stunControl = gameObject.LocateMyFSM("Stun Control"); _balloons = gameObject.LocateMyFSM("Spawn Balloon"); _anim = gameObject.GetComponent <tk2dSpriteAnimator>(); _control = gameObject.LocateMyFSM("IK Control"); _recoil = gameObject.GetComponent <Recoil>(); _enemyEffects = gameObject.GetComponent <InfectedEnemyEffects>(); }
/// <summary> /// Fires the one shot. /// </summary> /// <param name="_target">Target.</param> public void FireOneShot(Transform _target) { if (Ammunition.Enabled) { Ammunition.Fire(_target); } if (Recoil.Enabled) { Recoil.Start(); } if (LaunchSound.Enabled) { LaunchSound.Play(); } if (MuzzleFlash.Enabled) { MuzzleFlash.Start(); } if (Shell.Enabled) { Shell.Start(); } if (Effect.Enabled) { Effect.Start(OwnerComponent); } }
//Input.GetButtonDown("JoyButton3") void Start() { // Initiate animator object for 'scoping animations' animator = gameObject.GetComponentInParent <Animator>(); scope_script = recoil_gun1.GetComponent <Scope>(); // Initiate impact effects impactEffectEnemy = GameObject.FindGameObjectWithTag("ie_enemy"); impactEffectSolid = GameObject.FindGameObjectWithTag("ie_solid"); // Initiate and set up other variables switch (GUN_TYPE) { case W_AUTOMATIC: cam = GameObject.FindWithTag("Gun0").transform; recoilComponent = cam.parent.GetComponent <Recoil>(); muzzle_gun_0 = GameObject.Find("MuzzleGun0"); muzzle_gun_0.SetActive(false); break; case W_SNIPER: cam = GameObject.FindWithTag("Gun1").transform; recoilComponent = cam.parent.GetComponent <Recoil>(); muzzle_gun_1 = GameObject.Find("MuzzleGun1"); muzzle_gun_1.SetActive(false); break; case W_GLANUCHER: muzzle_gun_2.SetActive(false); break; } }
private void Awake() { FPCamera = FindObjectOfType <Camera>(); animator = GetComponent <Animator>(); ammo = GetComponent <Ammo>(); recoil = FindObjectOfType <Recoil>().GetComponent <Recoil>(); CreateBullet(10); }
// Use this for initialization void Start() { cooldownCount = 0; reloadCount = 0; currentAmmoInMagazine = magazineSize; isReloading = false; recoilComponent = Camera.main.GetComponent<Recoil>(); }
public override void Init(ICEWorldBehaviour _component) { base.Init(_component); LaunchSound.Init(_component); Ammunition.Init(_component); MuzzleFlash.Init(_component); Recoil.Init(_component); Effect.Init(_component); }
private void Actor_Hurt(Object sender, EventArgs e) { SoundManager.Instance.playSound("hurt1"); Actor hurtActor = (Actor)sender; Recoil recoil = new Recoil(actionLists[hurtActor], hurtActor); if (!actionLists[hurtActor].has(recoil)) { actionLists[hurtActor].pushFront(recoil); } }
void Start() { primaryResetTimer = new GenericTimer(primaryResetTime, true); secondaryResetTimer = new GenericTimer(secondaryResetTime, true); spell = GetComponent <AbstractWeaponEffect>(); recoil = GetComponent <Recoil>(); if (recoil == null) { recoil = gameObject.AddComponent <Recoil>(); } }
private void Start() { ammo = ammoMax; ammoText = GameObject.Find("Ammo").GetComponent <TextMeshProUGUI>(); ammoText.text = $"{ammo}/{ammoMax}"; _barrelTransform = GameObject.Find("Tracers").transform; _recoil = GameObject.Find("Weapon").GetComponent <Recoil>(); _enemyLayer = LayerMask.GetMask("Enemies"); _partTracers = _barrelTransform.GetComponent <ParticleSystem>(); _partFlare = GameObject.Find("Flare").GetComponent <ParticleSystem>(); }
/// <summary> /// Initialize /// </summary> void Start() { m_origin = transform.position; m_pickup = GetComponentInChildren <KeyPickup>(); m_rigidbody = GetComponent <Rigidbody>(); m_renderer = GetComponent <Renderer>(); m_collider = GetComponent <Collider>(); Recoil recoil = GetComponent <Recoil>(); recoil.OnLand += OnKeyLand; }
public void Dispose() { Game.Dispose(); Match.Dispose(); Wallhack.Dispose(); Recoil.Dispose(); Game = default; Match = default; Wallhack = default; Recoil = default; }
public void Update() { if (Automatic.Update()) { FireOneShot(m_TargetTransform); } MuzzleFlash.Update(); Shell.Update(); Effect.Update(); Recoil.Update(); }
private void Actor_Light_Attack(Object sender, EventArgs e) { Actor inputtingActor = (Actor)sender; //Punch punch = new Punch(actionLists[inputtingActor], inputtingActor); Attack attack = new Attack(actionLists[inputtingActor], inputtingActor); Recoil recoil = new Recoil(actionLists[inputtingActor], inputtingActor); if (!actionLists[inputtingActor].has(attack) && !actionLists[inputtingActor].has(recoil)) { actionLists[inputtingActor].pushFront(attack); } }
void Start() { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; var cam = GameObject.Find("/Player/MainCamera/Recoil/").transform; recoilComponent = cam.GetComponent <Recoil>(); muzzleFlashTimerStart = muzzleFlashTimer; whiteScreenFlashTimerStart = whiteScreenFlashTimer; AmmoShot = true; SetCountAmmo(); }
IEnumerator FindRecoil() { Recoil = GameObject.Find("/GameControl/Player/PlayerController/MainCamera/Recoil/"); if (Recoil == null) { yield return(null); } else { Recoil = GameObject.Find("/GameControl/Player/PlayerController/MainCamera/Recoil/"); recoilComponent = Recoil.GetComponent <Recoil>(); } }
private void Awake() { Log("Added Shade Lord Mono"); _control = gameObject.LocateMyFSM("Shade Control"); _target = HeroController.instance.gameObject; _anim = gameObject.GetComponent <tk2dSpriteAnimator>(); _hm = gameObject.GetComponent <HealthManager>(); _bc = gameObject.GetComponent <BoxCollider2D>(); _rb = gameObject.GetComponent <Rigidbody2D>(); _recoil = gameObject.GetComponent <Recoil>(); _mr = gameObject.GetComponent <MeshRenderer>(); _slash = gameObject.transform.Find("Slash").gameObject; }
/// <summary> /// Initialization /// </summary> void Start() { if (m_rigidbody == null) { m_rigidbody = GetComponent <Rigidbody>(); } if (m_camera == null) { m_camera = Camera.main; } m_recoil = GetComponent <Recoil>(); }
private void Awake() { Log("Added Hornet Mono"); if (!DoH.Instance.IsInHall) { return; } _hm = gameObject.GetComponent <HealthManager>(); _stunControl = gameObject.LocateMyFSM("Stun Control"); _control = gameObject.LocateMyFSM("Control"); _recoil = gameObject.GetComponent <Recoil>(); _anim = gameObject.GetComponent <tk2dSpriteAnimator>(); }
private void Awake() { _rb = gameObject.GetComponent <Rigidbody2D>(); _sr = gameObject.GetComponent <SpriteRenderer>(); _dmg = gameObject.AddComponent <DamageHero>(); _bc = gameObject.GetComponent <BoxCollider2D>(); _rc = gameObject.AddComponent <Recoil>(); _hm = gameObject.GetComponent <HealthManager>(); _aud = gameObject.AddComponent <AudioSource>(); _anim = gameObject.GetComponent <Animator>(); _hitEffects = gameObject.AddComponent <EnemyHitEffectsUninfected>(); _hitEffects.enabled = true; _target = HeroController.instance; }
public HumanoidEquipmentModule(Weapon[] weapons, WeaponProp[] props, MovingAgent.CharacterMainStates state, GameObject target, Recoil recoil, HumanoidAnimationModule animSystem, AgentParameters parameters) { m_currentState = state; m_target = target; m_recoil = recoil; m_animationSystem = animSystem; getAllWeapons(weapons, props); m_agentParameters = parameters; }
void Start() { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; var cam = GameObject.Find("/Player/MainCamera/Recoil/").transform; camTransform = Camera.main.transform; gunTransform = GameObject.Find("/Player/MainCamera/Recoil/Hover/Gun/").transform; camOriginalPos = camTransform.localPosition; gunOriginalPos = gunTransform.localPosition; recoilComponent = cam.GetComponent <Recoil>(); muzzleFlashTimerStart = muzzleFlashTimer; whiteScreenFlashTimerStart = whiteScreenFlashTimer; AmmoShot = true; SetCountAmmo(); }
public override LocalEmbed ToEmbed() { var embed = base.ToEmbed(); if (ErgonomicsFloat != 0) { embed.AddField("Ergonomics", ErgonomicsFloat.ToString("+0.00;-#.00"), true); } if (Accuracy != 0) { embed.AddField("Accuracy", Accuracy.ToString("+0.00;-#.00"), true); } if (Recoil != 0) { embed.AddField("Recoil", Recoil.ToString("+0.00;-#.00"), true); } embed.AddGridModifier(GridModifier); return(embed); }
private void Awake() { _instance = this; _anim = GetComponent <TisoAnimator>(); _audio = GetComponent <TisoAudio>(); _rand = new Random(); _rb = GetComponent <Rigidbody2D>(); _recoil = GetComponent <Recoil>(); _sr = GetComponent <SpriteRenderer>(); _phaseCtrl = GetComponent <PhaseControl>(); _phaseCtrl.TriggeredPhase2 += OnTriggeredPhase2; _phaseCtrl.TriggeredPhase3 += OnTriggeredPhase3; HeroController.instance.OnDeath += OnHeroDeath; _bee = TisoSpencer.PreloadedGameObjects["Bee"]; _hornet = TisoSpencer.PreloadedGameObjects["Hornet"]; _kin = TisoSpencer.PreloadedGameObjects["Kin"]; _mageLord = TisoSpencer.PreloadedGameObjects["Mage"].LocateMyFSM("Mage Lord"); }
private void AddComponents() { _rb = gameObject.GetOrAddComponent <Rigidbody2D>(); _rb.isKinematic = true; _rb.collisionDetectionMode = CollisionDetectionMode2D.Continuous; _collider = gameObject.GetOrAddComponent <BoxCollider2D>(); _collider.enabled = true; _collider.size = new Vector2(1, 2); gameObject.AddComponent <DamageHero>(); _recoil = gameObject.GetOrAddComponent <Recoil>(); _recoil.enabled = true; _recoil.SetAttr <bool>("freezeInPlace", false); _recoil.SetAttr <bool>("stopVelocityXWhenRecoilingUp", false); _recoil.SetAttr <bool>("preventRecoilUp", false); _recoil.SetAttr <float>("recoilSpeedBase", 15f); _recoil.SetAttr <float>("recoilDuration", 0.15f); _hitEff = gameObject.AddComponent <EnemyHitEffectsUninfected>(); _hitEff.enabled = true; _deathEff = gameObject.AddComponent <EnemyDeathEffectsUninfected>(); _deathEff.enabled = true; _dnReaction = gameObject.AddComponent <EnemyDreamnailReaction>(); _dnReaction.enabled = true; // Add extras to make meme dialog 5 less frequent string[] dnDialogue = { "TISO_DIALOG_1", "TISO_DIALOG_1", "TISO_DIALOG_1", "TISO_DIALOG_2", "TISO_DIALOG_2", "TISO_DIALOG_2", "TISO_DIALOG_3", "TISO_DIALOG_3", "TISO_DIALOG_3", "TISO_DIALOG_4", "TISO_DIALOG_4", "TISO_DIALOG_4", "TISO_DIALOG_5", }; _dnReaction.SetConvoTitle(dnDialogue[_rand.Next(dnDialogue.Length)]); gameObject.AddComponent <ExtraDamageable>().enabled = true; }
private void Recoil_cb_UnChecked(object sender, RoutedEventArgs e) { Recoil.Dispose(); Recoil = default; }
private void Recoil_cb_Checked(object sender, RoutedEventArgs e) { Recoil = new Recoil(Match); Recoil.Start(); }
void Start() { recoil = GetComponent<Recoil>(); }
// This function does damage to the enemy using the damage numbers given by the weapon type public static void HitEnemy(HealthManager targetHP, int damageDealt, HitInstance hitInstance, int soulGain, BulletBehaviour hpbb) { //TODO: this specifics might add up later, Moss Charger is just one of the few except and there maybe many more if (targetHP == null) { return; } int cardinalDirection = DirectionUtils.GetCardinalDirection(hitInstance.GetActualDirection(targetHP.transform)); GameObject blockHitPrefab = targetHP.GetAttr <GameObject>("blockHitPrefab"); bool specialEnemy = (targetHP.name.Contains("Charger")); if (targetHP.IsBlockingByDirection(cardinalDirection, AttackTypes.Nail) && !specialEnemy || damageDealt <= 0) { FSMUtility.SendEventToGameObject(targetHP.gameObject, "BLOCKED HIT", false); GameObject blockHit = blockHitPrefab.Spawn(); blockHit.transform.position = targetHP.transform.position; blockHit.transform.Rotate(new Vector3(0, 0, 90 * cardinalDirection)); return; } if (damageDealt <= 0) { return; } //bool specialEnemy = (targetHP.name.Contains("Moss Charger") || targetHP.name.Contains("Mushroom Brawler")); /* * if (targetHP.IsInvincible && !specialEnemy && !PlayerData.instance.equippedCharm_25) * { * GameObject blockHit = blockHitPrefab.Spawn(); * blockHit.transform.position = targetHP.transform.position; * return; * } */ if (targetHP.gameObject.name.Contains("Blocker")) //double damage baldurs { damageDealt = damageDealt * 4; } Recoil recoil = targetHP.gameObject.GetComponent <Recoil>(); //if (recoil != null && PlayerData.instance.equippedCharm_15) if (recoil != null) { recoil.RecoilByDirection(cardinalDirection, 0.25f); } /* * Mostly code copied from the healthmanager class itself. */ FSMUtility.SendEventToGameObject(targetHP.gameObject, "HIT", false); GameObject sendHitGO = targetHP.GetAttr <GameObject>("sendHitGO"); if (sendHitGO != null) { FSMUtility.SendEventToGameObject(targetHP.gameObject, "HIT", false); } GameObject HitPrefab = targetHP.GetAttr <GameObject>("strikeNailPrefab"); GameObject ImpactPrefab = targetHP.GetAttr <GameObject>("slashImpactPrefab"); Vector3? effectOrigin = targetHP.GetAttr <Vector3?>("effectOrigin"); if (HitPrefab != null && effectOrigin != null) { HitPrefab.Spawn(targetHP.transform.position + (Vector3)effectOrigin, Quaternion.identity).transform.SetPositionZ(0.0031f); } if (ImpactPrefab != null && effectOrigin != null) { ImpactPrefab.Spawn(targetHP.transform.position + (Vector3)effectOrigin, Quaternion.identity).transform.SetPositionZ(0.0031f); } SpriteFlash f = targetHP.gameObject.GetComponent <SpriteFlash>(); if (f != null) { f.flashWhiteQuick(); } //Log("SEVERITY: " + ds + " DAMAGE: " + damageDealt); FSMUtility.SendEventToGameObject(targetHP.gameObject, "TOOK DAMAGE", false); FSMUtility.SendEventToGameObject(targetHP.gameObject, "TAKE DAMAGE", false); FSMUtility.SendEventToGameObject(hitInstance.Source, "HIT LANDED", false); FSMUtility.SendEventToGameObject(hitInstance.Source, "DEALT DAMAGE", false); // Actually do damage to target. LoadAssets.sfxDictionary.TryGetValue("enemyhurt" + soundRandom.Next(1, 4) + ".wav", out AudioClip hurtSound); HeroController.instance.spellControl.gameObject.GetComponent <AudioSource>().PlayOneShot(hurtSound); if (targetHP.damageOverride) { targetHP.hp -= 1; } else { targetHP.hp -= damageDealt; // the actual damage //int sg = (ds.Equals(DamageSeverity.Minor)) ? 0 : soulGain; HeroController.instance.AddMPCharge(6); Stats.IncreaseAdrenalinePoints(damageDealt); } // Trigger Kill animation if (targetHP.hp <= 0f) { LoadAssets.sfxDictionary.TryGetValue("enemydead" + soundRandom.Next(1, 4) + ".wav", out AudioClip deadSound); HeroController.instance.spellControl.gameObject.GetComponent <AudioSource>().PlayOneShot(deadSound); targetHP.Die(cardinalDirection * 90, AttackTypes.Spell, true); HeroController.instance.AddMPCharge(4); GameManager.instance.FreezeMoment(1); return; } bool? hasAlternateHitAnimation = targetHP.GetAttr <bool?>("hasAlternateHitAnimation"); string alternateHitAnimation = targetHP.GetAttr <string>("alternateHitAnimation"); if (hasAlternateHitAnimation != null && (bool)hasAlternateHitAnimation && targetHP.GetComponent <tk2dSpriteAnimator>() && alternateHitAnimation != null) { targetHP.GetComponent <tk2dSpriteAnimator>().Play(alternateHitAnimation); } PlayMakerFSM stunControlFSM = targetHP.gameObject.GetComponents <PlayMakerFSM>().FirstOrDefault(component => component.FsmName == "Stun Control" || component.FsmName == "Stun"); if (stunControlFSM != null) { //stunControlFSM.SendEvent("STUN DAMAGE"); } /* * Uncomment below for a sick looking enter the gungeon style freeze frame or for camera shake. */ }
private void Start() { GetWeaponSettings(); if (weaponType != WeaponType.Melee && weaponType != WeaponType.Grenade) { BalisticProjectilesPool(); } if (GetComponent <Animator>()) { animator = GetComponent <Animator>(); } else { Debug.LogError("Please attach animator to your weapon object"); } if (GetComponent <AudioSource>()) { audioSource = GetComponentInParent <AudioSource>(); } else { Debug.LogError("Please attach AudioSource to your weapon object"); } cam = Camera.main; controller = FindObjectOfType <FPSController>(); normalSensX = controller.sensitivity.x; normalSensY = controller.sensitivity.y; normalFOV = cam.fieldOfView; weaponManager = FindObjectOfType <WeaponManager>(); scope = weaponManager.scopeImage; ammoText = GameObject.Find("AmmoText").GetComponent <Text>(); weaponNameText = GameObject.Find("WeaponText").GetComponent <Text>(); recoilComponent = FindObjectOfType <Recoil>(); sway = FindObjectOfType <Sway>(); if (weaponType != WeaponType.Melee && weaponType != WeaponType.Grenade) { if (shell) { ShellsPool(); } else { Debug.LogError("No shell gameobject attached to weapon settings object"); } if (MuzzleFlashParticlesFX) { temp_MuzzleFlashParticlesFX = Instantiate(MuzzleFlashParticlesFX, muzzleFlashTransform.position, muzzleFlashTransform.rotation, muzzleFlashTransform); } else { Debug.LogWarning("There is no shot particle system attached to weapon settings"); } } hitFXManager = FindObjectOfType <HitFXManager>(); ricochetSource = hitFXManager.gameObject.GetComponent <AudioSource>(); ricochetSounds = hitFXManager.ricochetSounds; inventory = FindObjectOfType <Inventory>(); input = FindObjectOfType <InputManager>(); if (weaponManager.UseNonPhysicalReticle) { if (GameObject.Find("StaticReticle") != null) { staticReticle = GameObject.Find("StaticReticle"); } } else { if (GameObject.Find("DynamicReticle") != null) { dynamicReticle = GameObject.Find("DynamicReticle").GetComponent <RectTransform>(); } } var item = new Item(ammoItemID, "ammo", "ammo", ItemType.ammo); item.ammo = 100; inventory.GiveItem(item); }
// This function does damage to the enemy using the damage numbers given by the weapon type public static void HitEnemy(HealthManager targetHP, int expectedDamage, HitInstance hitInstance, int soulGain) { int realDamage = expectedDamage; //TODO: this specifics might add up later, Moss Charger is just one of the few except and there maybe many more int cardinalDirection = DirectionUtils.GetCardinalDirection(hitInstance.GetActualDirection(targetHP.transform)); GameObject blockHitPrefab = targetHP.GetAttr <GameObject>("blockHitPrefab"); bool specialEnemy = (targetHP.name.Contains("Charger")); if (targetHP.IsBlockingByDirection(cardinalDirection, AttackTypes.Nail) && !specialEnemy || realDamage <= 0) { FSMUtility.SendEventToGameObject(targetHP.gameObject, "BLOCKED HIT", false); GameObject blockHit = blockHitPrefab.Spawn(); blockHit.transform.position = targetHP.transform.position; blockHit.transform.Rotate(new Vector3(0, 0, 90 * cardinalDirection)); return; } //bool specialEnemy = (targetHP.name.Contains("Moss Charger") || targetHP.name.Contains("Mushroom Brawler")); //if (targetHP.IsInvincible && !specialEnemy && !PlayerData.instance.equippedCharm_25) //{ // GameObject blockHit = blockHitPrefab.Spawn(); // blockHit.transform.position = targetHP.transform.position; // return; //} if (targetHP.gameObject.name.Contains("Blocker")) { realDamage = realDamage * 4; } Recoil recoil = targetHP.gameObject.GetComponent <Recoil>(); if (recoil != null && PlayerData.instance.equippedCharm_15) { recoil.RecoilByDirection(cardinalDirection, 0.8f); } if (realDamage <= 0) { return; } if (targetHP == null) { return; } /* * Play animations and such... * Mostly code copied from the healthmanager class itself. */ //Modding.Logger.Log("Cardinal is " + cardinalDirection); FSMUtility.SendEventToGameObject(targetHP.gameObject, "HIT", false); GameObject sendHitGO = targetHP.GetAttr <GameObject>("sendHitGO"); if (sendHitGO != null) { FSMUtility.SendEventToGameObject(targetHP.gameObject, "HIT", false); } GameObject HitPrefab = targetHP.GetAttr <GameObject>("strikeNailPrefab"); GameObject ImpactPrefab = targetHP.GetAttr <GameObject>("slashImpactPrefab"); Vector3? effectOrigin = targetHP.GetAttr <Vector3?>("effectOrigin"); if (HitPrefab != null && effectOrigin != null) { HitPrefab.Spawn(targetHP.transform.position + (Vector3)effectOrigin, Quaternion.identity).transform.SetPositionZ(0.0031f); } if (ImpactPrefab != null && effectOrigin != null) { ImpactPrefab.Spawn(targetHP.transform.position + (Vector3)effectOrigin, Quaternion.identity).transform.SetPositionZ(0.0031f); } FSMUtility.SendEventToGameObject(targetHP.gameObject, "TOOK DAMAGE", false); FSMUtility.SendEventToGameObject(targetHP.gameObject, "TAKE DAMAGE", false); FSMUtility.SendEventToGameObject(hitInstance.Source, "HIT LANDED", false); FSMUtility.SendEventToGameObject(hitInstance.Source, "DEALT DAMAGE", false); // Actually do damage to target. try { //TODO: change this audio source //HeroController.instance.spellControl.gameObject.GetComponent<AudioSource>().PlayOneShot(LoadAssets.enemyHurtSFX[soundRandom.Next(0, 2)]); LoadAssets.sfxDictionary.TryGetValue("enemyhurt" + soundRandom.Next(1, 4) + ".wav", out AudioClip ac); HeroController.instance.spellControl.gameObject.GetComponent <AudioSource>().PlayOneShot(ac); } catch (Exception e) { Modding.Logger.Log("Enemy Hurt Exception Thrown " + e); } if (targetHP.damageOverride) { targetHP.hp -= 1; } else { targetHP.hp -= realDamage; // the actual damage HeroController.instance.AddMPCharge(soulGain); } // Trigger Kill animation if (targetHP.hp <= 0f) { LoadAssets.sfxDictionary.TryGetValue("enemydead" + soundRandom.Next(1, 4) + ".wav", out AudioClip ac); HeroController.instance.spellControl.gameObject.GetComponent <AudioSource>().PlayOneShot(ac); targetHP.Die(cardinalDirection * 90, AttackTypes.Spell, true); HeroController.instance.AddMPCharge(3); return; } bool? hasAlternateHitAnimation = targetHP.GetAttr <bool?>("hasAlternateHitAnimation"); string alternateHitAnimation = targetHP.GetAttr <string>("alternateHitAnimation"); if (hasAlternateHitAnimation != null && (bool)hasAlternateHitAnimation && targetHP.GetComponent <tk2dSpriteAnimator>() && alternateHitAnimation != null) { targetHP.GetComponent <tk2dSpriteAnimator>().Play(alternateHitAnimation); } PlayMakerFSM stunControlFSM = targetHP.gameObject.GetComponents <PlayMakerFSM>().FirstOrDefault(component => component.FsmName == "Stun Control" || component.FsmName == "Stun"); if (stunControlFSM != null) { //stunControlFSM.SendEvent("STUN DAMAGE"); } /* * Uncomment below for a sick looking enter the gungeon style freeze frame or for camera shake. */ //GameManager.instance.FreezeMoment(1); //GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake"); SpriteFlash f = targetHP.gameObject.GetComponent <SpriteFlash>(); if (f != null) { f.flashInfected(); } }