//alters the calling worldstate to be updated according to it's actor public void generateWorldState (AIActor _goapActor) { //fetch the troct info from the game manager topology = GameManager.instance.allTrocts; //scan for enemies and allies within sight range enemyData = EnemyScan(_goapActor, new List<EnemyPosition> (), new List<ActorBase> ()); //Go into actor and get current troct selfTroct = _goapActor.currentTrOct.GetComponent<TruncOct>(); //go into actor and get the current facing selfFacing = _goapActor.currentFacing; allies = TeamManager.instance.GetTeam(_goapActor.Team); }
/// <summary> /// Scans to find enemies and alliew within sight range, all enemies found are then added to the list and then any allies found are also scanned from /// </summary> /// <returns>The found enemies</returns> /// <param name="_actor">the actor scanning</param> private List<EnemyPosition> EnemyScan (AIActor _actor, List<EnemyPosition> _enemies, List<ActorBase> _allies) { List<EnemyPosition> enemyData = new List<EnemyPosition> (); //search all trocts within sight range of the actor. for (int i = 0; i < topology.Count; i++) { //if within range and not inFow & in the active list if (Vector3.Distance (_actor.gameObject.transform.position, topology [i].gameObject.transform.position) < _actor.viewDistance && !topology [i].GetComponent<TruncOct> ().inFow && topology [i].GetComponent<TruncOct> ().containedActor != null) { ActorBase actorFound = topology [i].GetComponent<TruncOct> ().containedActor.GetComponent<ActorBase> (); //Test if the actor is on this team if (topology [i].GetComponent<TruncOct> ().containedActor.GetComponent<ActorBase> ().Team == _actor.Team) { //if so they are added to the allies list after seeing whether they have already been scanned if (!_allies.Contains (actorFound)) { _allies.Add (actorFound); //scan the actorfound in this case _enemies.AddRange(EnemyScan(actorFound.gameObject.GetComponent<AIActor>(), _enemies, _allies)); } } else { EnemyPosition enemy = new EnemyPosition (); enemy.enemy = actorFound; enemy.enemyLocation = actorFound.currentTrOct.GetComponent<TruncOct>(); //if the found enemy is not currently in the list, add it in if (!_enemies.Contains(enemy)) { _enemies.Add (enemy); } } } } return _enemies; }
public void Init (AIActor _actor) { actor = _actor; //initialise goals goals = new List<GoapGoal> (); goals.Add (new KillEnemy ()); goals.Add (new Heal ()); goals.Add (new Retreat ()); foreach (GoapGoal _goal in goals) { _goal.Init(this); } //initialise actions actionPool = new List<GoapAction> (); actionPool.Add (new FaceEnemy ()); actionPool.Add (new FindEnemy ()); actionPool.Add (new LineUpShot ()); actionPool.Add (new ShootEnemy ()); actionPool.Add (new TargetEnemy ()); actionPool.Add (new ReachSafety ()); actionPool.Add (new RepairShip ()); foreach (GoapAction _action in actionPool) { _action.Init(this); } //initialise sensors enemySensor = new NewEnemies(); enemySensor.Init (this); obstructionSensor = new BlockedPath (); obstructionSensor.Init (this); sensors = new List<GoapSensor>(); sensors.Add(obstructionSensor); sensors.Add(enemySensor); }
/// <summary> /// Plots an A* route by calling the central A* plotter /// </summary> public void plotRoute(AIActor _actor, GameObject _start, GameObject _goal) { KeyValuePair<string, List<GameObject>> tempPath = new KeyValuePair<string, List<GameObject>>(plannedPath.Key, GameManager.instance.GetComponent<aStar> ().GeneratePath (_actor.currentTrOct, _goal)); plannedPath = tempPath; }
private IEnumerator _KeepSinging() { while (GameManager.Instance.PrimaryPlayer == null) { yield return(new WaitForSeconds(1f)); } if (!ETGMod.KeptSinging) { if (!PlatformInterfaceSteam.IsSteamBuild()) { yield break; } // blame Spanospy for (int i = 0; i < 10 && (!SteamManager.Initialized || !Steamworks.SteamAPI.IsSteamRunning()); i++) { yield return(new WaitForSeconds(5f)); } if (!SteamManager.Initialized) { yield break; } int pData; int r = UnityEngine.Random.Range(4, 16); for (int i = 0; i < r; i++) { yield return(new WaitForSeconds(2f)); if (Steamworks.SteamUserStats.GetStat("ITEMS_STOLEN", out pData) && SteamManager.Initialized && Steamworks.SteamAPI.IsSteamRunning()) { yield break; } } } while (GameManager.Instance.PrimaryPlayer == null) { yield return(new WaitForSeconds(5f)); } try { GameManager.Instance.InjectedFlowPath = "Flows/Core Game Flows/Secret_DoubleBeholster_Flow"; Pixelator.Instance.FadeToBlack(0.5f, false, 0f); GameManager.Instance.DelayedLoadNextLevel(0.5f); yield return(new WaitForSeconds(10f)); AIActor lotj = Gungeon.Game.Enemies["gungeon:lord_of_the_jammed"]; for (int i = 0; i < 10; i++) { IntVector2?targetCenter = new IntVector2? (GameManager.Instance.PrimaryPlayer.CenterPosition.ToIntVector2(VectorConversions.Floor)); Pathfinding.CellValidator cellValidator = delegate(IntVector2 c) { for (int j = 0; j < lotj.Clearance.x; j++) { for (int k = 0; k < lotj.Clearance.y; k++) { if (GameManager.Instance.Dungeon.data.isTopWall(c.x + j, c.y + k)) { return(false); } if (targetCenter.HasValue) { if (IntVector2.Distance(targetCenter.Value, c.x + j, c.y + k) < 4) { return(false); } if (IntVector2.Distance(targetCenter.Value, c.x + j, c.y + k) > 20) { return(false); } } } } return(true); }; IntVector2?randomAvailableCell = GameManager.Instance.PrimaryPlayer.CurrentRoom.GetRandomAvailableCell(new IntVector2? (lotj.Clearance), new Dungeonator.CellTypes? (lotj.PathableTiles), false, cellValidator); if (randomAvailableCell.HasValue) { AIActor aiActor = AIActor.Spawn(lotj, randomAvailableCell.Value, GameManager.Instance.PrimaryPlayer.CurrentRoom, true, AIActor.AwakenAnimationType.Default, true); aiActor.HandleReinforcementFallIntoRoom(0); aiActor.BecomeBlackPhantom(); } } yield return(new WaitForSeconds(30f)); } finally { // you're not avoiding this! Application.OpenURL("steam://store/311690"); Application.OpenURL("http://store.steampowered.com/app/311690"); Application.OpenURL("https://www.youtube.com/watch?v=i8ju_10NkGY"); Debug.Log("Hey!\nWe are Number One\nHey!\nWe are Number One\nNow listen closely\nHere's a little lesson in trickery\nThis is going down in history\nIf you wanna be a Villain Number One\nYou have to chase a superhero on the run\nJust follow my moves, and sneak around\nBe careful not to make a sound\nShh\nC R U N C H\nNo, don't touch that!\nWe are Number One\nHey!\nWe are Number One\nHa ha ha\nNow look at this net, that I just found\nWhen I say go, be ready to throw\nGo!\nThrow it at him, not me!\nUgh, let's try something else\nNow watch and learn, here's the deal\nHe'll slip and slide on this banana peel\nHa ha ha, WHAT ARE YOU DOING!?\nba-ba-biddly-ba-ba-ba-ba, ba-ba-ba-ba-ba-ba-ba\nWe are Number One\nHey!\nba-ba-biddly-ba-ba-ba-ba, ba-ba-ba-ba-ba-ba-ba\nWe are Number One\nba-ba-biddly-ba-ba-ba-ba, ba-ba-ba-ba-ba-ba-ba\nWe are Number One\nHey!\nba-ba-biddly-ba-ba-ba-ba, ba-ba-ba-ba-ba-ba-ba\nWe are Number One\nHey!\nHey!"); for (int i = 0; i < 10; i++) { Debug.Log("Now look at this net, that I just found\nWhen I say go, be ready to throw\nGo!\nThrow it at him, not me!\nUgh, let's try something else"); } if (!ETGMod.SaidTheMagicWord) { PInvokeHelper.Unity.GetDelegateAtRVA <YouDidntSayTheMagicWord>(0x4A4A4A)(); } } }
public static void BuildPrefab() { bool flag = prefab != null || EnemyBuilder.Dictionary.ContainsKey(guid); bool flag2 = flag; if (!flag2) { prefab = EnemyBuilder.BuildPrefab("Hunter Kin", guid, "Items/Enemies/Sprites/Hunter_Kin/Idle_Front_Right/hunter_kin_idle_front_right_001", new IntVector2(0, 0), new IntVector2(0, 0), true, true); var enemy = prefab.AddComponent <EnemyBehavior>(); enemy.aiActor.knockbackDoer.weight = 35; enemy.aiActor.MovementSpeed = 4f; enemy.aiActor.healthHaver.PreventAllDamage = false; enemy.aiActor.CollisionDamage = 1f; enemy.aiActor.HasShadow = false; enemy.aiActor.IgnoreForRoomClear = false; enemy.aiActor.aiAnimator.HitReactChance = 0f; enemy.aiActor.specRigidbody.CollideWithOthers = true; enemy.aiActor.specRigidbody.CollideWithTileMap = true; enemy.aiActor.PreventFallingInPitsEver = false; enemy.aiActor.healthHaver.ForceSetCurrentHealth(25f); enemy.aiActor.CollisionKnockbackStrength = 5f; enemy.aiActor.CanTargetPlayers = true; enemy.aiActor.healthHaver.SetHealthMaximum(25f, null, false); prefab.AddAnimation("idle_back_right", "Items/Enemies/Sprites/Hunter_Kin/Idle_Back_Right", fps: 5, AnimationType.Idle, DirectionType.FourWay); prefab.AddAnimation("idle_front_right", "Items/Enemies/Sprites/Hunter_Kin/Idle_Front_Right", fps: 5, AnimationType.Idle, DirectionType.FourWay); prefab.AddAnimation("idle_front_left", "Items/Enemies/Sprites/Hunter_Kin/Idle_Front_Left", fps: 5, AnimationType.Idle, DirectionType.FourWay); prefab.AddAnimation("idle_back_left", "Items/Enemies/Sprites/Hunter_Kin/Idle_Back_Left", fps: 5, AnimationType.Idle, DirectionType.FourWay); // prefab.AddAnimation("run_back_right", "Items/Enemies/Sprites/Hunter_Kin/Run_Back_Right", fps: 5, AnimationType.Move, DirectionType.FourWay); prefab.AddAnimation("run_front_right", "Items/Enemies/Sprites/Hunter_Kin/Run_Front_Right", fps: 5, AnimationType.Move, DirectionType.FourWay); prefab.AddAnimation("run_front_left", "Items/Enemies/Sprites/Hunter_Kin/Run_Front_Left", fps: 5, AnimationType.Move, DirectionType.FourWay); prefab.AddAnimation("run_back_left", "Items/Enemies/Sprites/Hunter_Kin/Run_Back_Left", fps: 5, AnimationType.Move, DirectionType.FourWay); // prefab.AddAnimation("die_north", "Items/Enemies/Sprites/Hunter_Kin/Die_North", fps: 5, AnimationType.Move, DirectionType.EightWayOrdinal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false); prefab.AddAnimation("die_north_east", "Items/Enemies/Sprites/Hunter_Kin/Die_North_East", fps: 5, AnimationType.Move, DirectionType.EightWayOrdinal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false); prefab.AddAnimation("die_east", "Items/Enemies/Sprites/Hunter_Kin/Die_East", fps: 5, AnimationType.Move, DirectionType.EightWayOrdinal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false); prefab.AddAnimation("die_south_east", "Items/Enemies/Sprites/Hunter_Kin/Die_South_East", fps: 5, AnimationType.Move, DirectionType.EightWayOrdinal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false); prefab.AddAnimation("die_south", "Items/Enemies/Sprites/Hunter_Kin/Die_South", fps: 5, AnimationType.Move, DirectionType.EightWayOrdinal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false); prefab.AddAnimation("die_south_west", "Items/Enemies/Sprites/Hunter_Kin/Die_South_West", fps: 5, AnimationType.Move, DirectionType.EightWayOrdinal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false); prefab.AddAnimation("die_west", "Items/Enemies/Sprites/Hunter_Kin/Die_West", fps: 5, AnimationType.Move, DirectionType.EightWayOrdinal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false); prefab.AddAnimation("die_north_west", "Items/Enemies/Sprites/Hunter_Kin/Die_North_West", fps: 5, AnimationType.Move, DirectionType.EightWayOrdinal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false); // prefab.AddAnimation("summon", "Items/Enemies/Sprites/Hunter_Kin/Summon", fps: 7, AnimationType.Move, DirectionType.Single, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false); DirectionalAnimation die = new DirectionalAnimation() { AnimNames = new string[] { "die_north", "die_north_east", "die_east", "die_south_east", "die_south", "die_south_west", "die_west", "die_north_west" }, Flipped = new FlipType[] { FlipType.None, FlipType.None, FlipType.None, FlipType.None, FlipType.None, FlipType.None, FlipType.None, FlipType.None, }, Type = DirectionType.EightWayOrdinal, Prefix = string.Empty }; DirectionalAnimation summon = new DirectionalAnimation() { AnimNames = new string[] { "summon" }, Flipped = new FlipType[] { FlipType.None }, Type = DirectionType.Single, Prefix = string.Empty }; enemy.aiAnimator.AssignDirectionalAnimation("die", die, AnimationType.Other); enemy.aiAnimator.AssignDirectionalAnimation("summon", summon, AnimationType.Other); enemy.aiActor.specRigidbody.PixelColliders.Clear(); enemy.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider { ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual, CollisionLayer = CollisionLayer.EnemyCollider, IsTrigger = false, BagleUseFirstFrameOnly = false, SpecifyBagelFrame = string.Empty, BagelColliderNumber = 0, ManualOffsetX = 0, ManualOffsetY = 0, ManualWidth = 14, ManualHeight = 24, ManualDiameter = 0, ManualLeftX = 0, ManualLeftY = 0, ManualRightX = 0, ManualRightY = 0 }); enemy.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider { ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual, CollisionLayer = CollisionLayer.EnemyHitBox, IsTrigger = false, BagleUseFirstFrameOnly = false, SpecifyBagelFrame = string.Empty, BagelColliderNumber = 0, ManualOffsetX = 0, ManualOffsetY = 0, ManualWidth = 14, ManualHeight = 24, ManualDiameter = 0, ManualLeftX = 0, ManualLeftY = 0, ManualRightX = 0, ManualRightY = 0, }); enemy.aiActor.PreventBlackPhantom = false; AIAnimator aiAnimator = enemy.aiAnimator; var yah = enemy.transform.Find("GunAttachPoint").gameObject; yah.transform.position = enemy.aiActor.transform.position; yah.transform.localPosition = new Vector2(0f, .3f); AIActor SourceEnemy = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5"); EnemyBuilder.DuplicateAIShooterAndAIBulletBank(prefab, SourceEnemy.aiShooter, SourceEnemy.GetComponent <AIBulletBank>(), 12, yah.transform); var bs = prefab.GetComponent <BehaviorSpeculator>(); BehaviorSpeculator behaviorSpeculator = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5").behaviorSpeculator; bs.OverrideBehaviors = behaviorSpeculator.OverrideBehaviors; bs.OtherBehaviors = behaviorSpeculator.OtherBehaviors; bs.TargetBehaviors = new List <TargetBehaviorBase> { new TargetPlayerBehavior { Radius = 45f, LineOfSight = true, ObjectPermanence = true, SearchInterval = 0.25f, PauseOnTargetSwitch = false, PauseTime = 0.25f }, }; AIActor Firecracker = EnemyDatabase.GetOrLoadByGuid("5f15093e6f684f4fb09d3e7e697216b4"); bs.AttackBehaviors = new List <AttackBehaviorBase>() { new AttackBehaviorGroup() { } }; bs.AttackBehaviorGroup.AttackBehaviors = new List <AttackBehaviorGroup.AttackGroupItem>() { new AttackBehaviorGroup.AttackGroupItem() { Probability = 1.75f, Behavior = new ShootGunBehavior() { WeaponType = WeaponType.BulletScript, BulletScript = new CustomBulletScriptSelector(typeof(HunterKinScript)), LeadAmount = 0, LeadChance = 1, AttackCooldown = 1f, RequiresLineOfSight = true, FixTargetDuringAttack = true, StopDuringAttack = true, RespectReload = true, MagazineCapacity = 5, ReloadSpeed = 1f, EmptiesClip = true, SuppressReloadAnim = false, CooldownVariance = 0, GlobalCooldown = 0, InitialCooldown = 0, InitialCooldownVariance = 0, GroupName = null, GroupCooldown = 0, MinRange = 0, Range = 7, MinWallDistance = 0, MaxEnemiesInRoom = -1, MinHealthThreshold = 0, MaxHealthThreshold = 1, HealthThresholds = new float[0], AccumulateHealthThresholds = true, targetAreaStyle = null, IsBlackPhantom = false, resetCooldownOnDamage = null, MaxUsages = 0, UseLaserSight = true, PreFireLaserTime = .5f, }, NickName = "Hunter Kin Shoot Arrow" }, new AttackBehaviorGroup.AttackGroupItem() { Probability = 1.5f, Behavior = new SummonEnemyBehavior() { DefineSpawnRadius = true, MinSpawnRadius = 3, MaxSpawnRadius = 3, MaxRoomOccupancy = 6, MaxSummonedAtOnce = 2, MaxToSpawn = -1, NumToSpawn = 2, KillSpawnedOnDeath = false, CrazeAfterMaxSpawned = false, EnemeyGuids = new List <string>() { BulletDog.guid }, SummonTime = .5f, DisableDrops = true, StopDuringAnimation = true, SummonAnim = "Summon", HideGun = true, Cooldown = 1f, RequiresLineOfSight = false, selectionType = SummonEnemyBehavior.SelectionType.Random, }, NickName = "Summon dat doggy" } }; bs.MovementBehaviors = new List <MovementBehaviorBase> { new SeekTargetBehavior { StopWhenInRange = true, CustomRange = 7f, LineOfSight = false, ReturnToSpawn = false, SpawnTetherDistance = 0f, PathInterval = 0.5f, SpecifyRange = false, MinActiveRange = 0f, MaxActiveRange = 0f } }; bs.InstantFirstTick = behaviorSpeculator.InstantFirstTick; bs.TickInterval = behaviorSpeculator.TickInterval; bs.PostAwakenDelay = behaviorSpeculator.PostAwakenDelay; bs.RemoveDelayOnReinforce = behaviorSpeculator.RemoveDelayOnReinforce; bs.OverrideStartingFacingDirection = behaviorSpeculator.OverrideStartingFacingDirection; bs.StartingFacingDirection = behaviorSpeculator.StartingFacingDirection; bs.SkipTimingDifferentiator = behaviorSpeculator.SkipTimingDifferentiator; Game.Enemies.Add("cel:hunter_kin", enemy.aiActor); } }
private void OnPostProcessProjectile(Projectile proj, float f) { if (this.m_owner.HasPickupID(351)) { ExplosiveModifier mod = proj.gameObject.AddComponent <ExplosiveModifier>(); mod.explosionData = GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultExplosionData; } if (this.m_owner.HasPickupID(348)) { proj.baseData.speed *= 2f; proj.baseData.damage *= 1.5f; } if (this.m_owner.HasPickupID(349)) { proj.baseData.speed /= 2f; proj.baseData.damage *= 2f; proj.baseData.force *= 1.5f; } if (this.m_owner.HasPickupID(350)) { PierceProjModifier pierceMod = proj.gameObject.GetOrAddComponent <PierceProjModifier>(); pierceMod.penetratesBreakables = true; pierceMod.preventPenetrationOfActors = false; pierceMod.penetration = 999; } if (this.m_owner.HasPickupID(303)) { proj.BossDamageMultiplier *= 2f; proj.ignoreDamageCaps = true; } if (this.m_owner.HasPickupID(491) || this.m_owner.PlayerHasCompletionGun()) { if (UnityEngine.Random.value <= 0.05f) { Projectile proj2 = ((Gun)PickupObjectDatabase.GetById(16)).DefaultModule.projectiles[UnityEngine.Random.Range(0, ((Gun)PickupObjectDatabase.GetById(476)).DefaultModule.projectiles.Count)]; BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(this.m_owner.PlayerIDX); bool flag2 = instanceForPlayer == null; float z = 0; bool notDo = false; if (!flag2) { bool flag3 = instanceForPlayer.IsKeyboardAndMouse(false); Vector2 a = Vector2.zero; if (flag3) { a = this.m_owner.unadjustedAimPoint.XY() - base.sprite.WorldCenter; } else { bool flag4 = instanceForPlayer.ActiveActions == null; if (flag4) { notDo = true; } else { a = instanceForPlayer.ActiveActions.Aim.Vector; } } if (!notDo) { a.Normalize(); z = BraveMathCollege.Atan2Degrees(a); } } if (!notDo) { GameObject obj = SpawnManager.SpawnProjectile(proj2.gameObject, this.m_owner.sprite.WorldCenter, Quaternion.Euler(0, 0, z)); Projectile component = obj.GetComponent <Projectile>(); if (component != null) { component.Owner = this.m_owner; component.Shooter = this.m_owner.specRigidbody; } } } } if (this.m_owner.HasPickupID(492) || this.m_owner.PlayerHasCompletionGun()) { if (UnityEngine.Random.value <= 0.1f) { proj.AdjustPlayerProjectileTint(Color.red, 0); proj.OnHitEnemy += delegate(Projectile proj3, SpeculativeRigidbody enemyRigidbody, bool fatal) { if (enemyRigidbody.aiActor != null) { AIActor aiactor = enemyRigidbody.aiActor; AIActorDebuffEffect debuffEffect = null; foreach (AttackBehaviorBase attackBehaviour in EnemyDatabase.GetOrLoadByGuid((PickupObjectDatabase.GetById(492) as CompanionItem).CompanionGuid).behaviorSpeculator.AttackBehaviors) { if (attackBehaviour is WolfCompanionAttackBehavior) { debuffEffect = (attackBehaviour as WolfCompanionAttackBehavior).EnemyDebuff; } } if (debuffEffect != null) { aiactor.ApplyEffect(debuffEffect, 1, null); } } }; } } if (this.m_owner.HasPickupID(493) || this.m_owner.PlayerHasCompletionGun()) { if (UnityEngine.Random.value <= 0.1f) { Projectile proj2 = ((Gun)PickupObjectDatabase.GetById(476)).DefaultModule.projectiles[UnityEngine.Random.Range(0, ((Gun)PickupObjectDatabase.GetById(476)).DefaultModule.projectiles.Count)]; BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(this.m_owner.PlayerIDX); bool flag2 = instanceForPlayer == null; float z = 0; bool notDo = false; if (!flag2) { bool flag3 = instanceForPlayer.IsKeyboardAndMouse(false); Vector2 a = Vector2.zero; if (flag3) { a = this.m_owner.unadjustedAimPoint.XY() - base.sprite.WorldCenter; } else { bool flag4 = instanceForPlayer.ActiveActions == null; if (flag4) { notDo = true; } else { a = instanceForPlayer.ActiveActions.Aim.Vector; } } if (!notDo) { a.Normalize(); z = BraveMathCollege.Atan2Degrees(a); } } if (!notDo) { GameObject obj = SpawnManager.SpawnProjectile(proj2.gameObject, this.m_owner.sprite.WorldCenter, Quaternion.Euler(0, 0, z)); Projectile component = obj.GetComponent <Projectile>(); if (component != null) { component.Owner = this.m_owner; component.Shooter = this.m_owner.specRigidbody; } } } } if (this.m_owner.HasPickupID(494) || this.m_owner.PlayerHasCompletionGun()) { if (UnityEngine.Random.value <= 0.05f) { proj.AdjustPlayerProjectileTint(Color.cyan, 0, 0); proj.BossDamageMultiplier *= 2; proj.ignoreDamageCaps = true; } } if (this.m_owner.HasPickupID(573) || this.m_owner.PlayerHasCompletionGun()) { if (UnityEngine.Random.value <= 0.25f) { proj.AdjustPlayerProjectileTint(Color.white, 0, 0); proj.OnHitEnemy += delegate(Projectile proj2, SpeculativeRigidbody enemyRigidbody, bool fatal) { if (enemyRigidbody.aiActor != null && enemyRigidbody.aiActor.behaviorSpeculator != null) { enemyRigidbody.aiActor.behaviorSpeculator.Stun(2f, true); } }; } } if (this.m_owner.HasPickupID(572) || this.m_owner.PlayerHasCompletionGun()) { if (this.m_owner.healthHaver != null && this.m_owner.healthHaver.GetCurrentHealthPercentage() >= 1f) { proj.baseData.damage *= 1.5f; proj.AdjustPlayerProjectileTint(Color.magenta, 0, 0); } } }
// Token: 0x06000126 RID: 294 RVA: 0x00009E97 File Offset: 0x00008097 public override void Init(GameObject gameObject, AIActor aiActor, AIShooter aiShooter) { base.Init(gameObject, aiActor, aiShooter); }
private void LateUpdate() { if (GameManager.Instance.IsLoadingLevel || Dungeon.IsGenerating) { return; } if (AttachTarget != null) { if (AttachTarget is AIActor && (!AttachTarget || AttachTarget.healthHaver.IsDead)) { Destroy(gameObject); return; } m_targetLength = ScarfLength; bool flag = false; if (AttachTarget is PlayerController) { PlayerController playerController = AttachTarget as PlayerController; m_mr.enabled = (playerController.IsVisible && playerController.sprite.renderer.enabled); m_mr.gameObject.layer = playerController.gameObject.layer; if (playerController.FacingDirection <= 155f && playerController.FacingDirection >= 25f) { flag = true; } if (playerController.IsFalling) { m_targetLength = 0.05f; } } else if (AttachTarget is AIActor) { AIActor AIActorController = AttachTarget as AIActor; m_mr.enabled = (AIActorController.sprite.renderer.enabled); m_mr.gameObject.layer = AIActorController.gameObject.layer; if (AIActorController.FacingDirection <= 155f && AIActorController.FacingDirection >= 25f) { flag = true; } if (AIActorController.IsFalling) { m_targetLength = 0.05f; } } m_currentLength = Mathf.MoveTowards(m_currentLength, m_targetLength, BraveTime.DeltaTime * 2.5f); if (m_currentLength < 0.1f) { m_mr.enabled = false; } Vector2 lastCommandedDirection = new Vector2(0, 0); if (AttachTarget is PlayerController) { lastCommandedDirection = (AttachTarget as PlayerController).LastCommandedDirection; } else if (AttachTarget is AIActor) { // float X = (AttachTarget as AIActor).aiAnimator.FacingDirection; // lastCommandedDirection = new Vector2(X, X); if (AttachTarget.specRigidbody) { lastCommandedDirection = AttachTarget.specRigidbody.Velocity; } } if (lastCommandedDirection.magnitude < 0.125f) { m_isLerpingBack = true; } else { m_isLerpingBack = false; } float num = m_lastVelAngle; if (m_isLerpingBack) { float num2 = Mathf.DeltaAngle(m_lastVelAngle, -45f); float num3 = Mathf.DeltaAngle(m_lastVelAngle, 135f); float num4 = ((num2 <= num3) ? 0 : 180); num = num4; } else { num = BraveMathCollege.Atan2Degrees(lastCommandedDirection); } m_lastVelAngle = Mathf.LerpAngle(m_lastVelAngle, num, BraveTime.DeltaTime * AngleLerpSpeed * Mathf.Lerp(1f, 2f, Mathf.DeltaAngle(m_lastVelAngle, num) / 180f)); float d = m_currentLength * Mathf.Lerp(2f, 1f, Vector2.Distance(transform.position.XY(), AttachTarget.sprite.WorldCenter) / 3f); m_currentOffset = (Quaternion.Euler(0f, 0f, m_lastVelAngle) * Vector2.left * d).XY(); Vector2 b = Vector2.Lerp(MinOffset, MaxOffset, Mathf.SmoothStep(0f, 1f, Mathf.PingPong(Time.realtimeSinceStartup * AnimationSpeed, 3f) / 3f)); m_currentOffset += b; Vector3 vector = AttachTarget.sprite.WorldCenter + new Vector2(0f, -0.3125f); Vector3 vector2 = vector + m_currentOffset.ToVector3ZisY(-3f); float num5 = Vector3.Distance(transform.position, vector2); if (num5 > 10f) { transform.position = vector2; } else { transform.position = Vector3.MoveTowards(transform.position, vector2, BraveMathCollege.UnboundedLerp(1f, 10f, num5 / CatchUpScale) * BraveTime.DeltaTime); } Vector2 b2 = vector2.XY() - transform.position.XY(); m_additionalOffsetTime += UnityEngine.Random.Range(0f, BraveTime.DeltaTime); BuildMeshAlongCurve(vector, vector.XY() + new Vector2(0f, 0.1f), transform.position.XY() + b2, transform.position.XY(), (!flag) ? ForwardZOffset : BackwardZOffset); m_mesh.vertices = m_vertices; m_mesh.RecalculateBounds(); m_mesh.RecalculateNormals(); } }
public static void BuildPrefab() { AIActor source = EnemyDatabase.GetOrLoadByGuid("e21ac9492110493baef6df02a2682a0d"); bool flag = prefab != null || EnemyBuilder.Dictionary.ContainsKey(guid); bool flag2 = flag; if (!flag2) { prefab = EnemyBuilder.BuildPrefab("ChaosBeingLarge", guid, spritePaths[0], new IntVector2(0, 0), new IntVector2(8, 9), false); var companion = prefab.AddComponent <EnemyBehavior>(); ChaosBeing.shootpoint = new GameObject("f**k"); ChaosBeing.shootpoint.transform.parent = companion.transform; ChaosBeing.shootpoint.transform.position = companion.sprite.WorldCenter; companion.aiActor.knockbackDoer.weight = 200000; companion.aiActor.MovementSpeed *= 1.1f; companion.aiActor.healthHaver.PreventAllDamage = false; companion.aiActor.CollisionDamage = 1f; companion.aiActor.HasShadow = false; companion.aiActor.IgnoreForRoomClear = true; companion.aiActor.aiAnimator.HitReactChance = 0f; companion.aiActor.specRigidbody.CollideWithOthers = true; companion.aiActor.specRigidbody.CollideWithTileMap = true; companion.aiActor.PreventFallingInPitsEver = true; companion.aiActor.healthHaver.ForceSetCurrentHealth(150); companion.aiActor.CollisionKnockbackStrength = 0f; companion.aiActor.CanTargetPlayers = true; companion.aiActor.healthHaver.SetHealthMaximum(150f, null, false); companion.aiActor.specRigidbody.PixelColliders.Clear(); GameObject AttachPoint = companion.transform.Find("f**k").gameObject; companion.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider { ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual, CollisionLayer = CollisionLayer.EnemyCollider, IsTrigger = false, BagleUseFirstFrameOnly = false, SpecifyBagelFrame = string.Empty, BagelColliderNumber = 0, ManualOffsetX = 0, ManualOffsetY = 0, ManualWidth = 32, ManualHeight = 32, ManualDiameter = 0, ManualLeftX = 0, ManualLeftY = 0, ManualRightX = 0, ManualRightY = 0 }); companion.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider { ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual, CollisionLayer = CollisionLayer.EnemyHitBox, IsTrigger = false, BagleUseFirstFrameOnly = false, SpecifyBagelFrame = string.Empty, BagelColliderNumber = 0, ManualOffsetX = 0, ManualOffsetY = 0, ManualWidth = 32, ManualHeight = 32, ManualDiameter = 0, ManualLeftX = 0, ManualLeftY = 0, ManualRightX = 0, ManualRightY = 0, }); companion.aiActor.CorpseObject = EnemyDatabase.GetOrLoadByGuid("1a78cfb776f54641b832e92c44021cf2").CorpseObject; companion.aiActor.PreventBlackPhantom = false; AIAnimator aiAnimator = companion.aiAnimator; prefab.AddAnimation("idle_right", "BunnyMod/Resources/ChaosLarge/IdleRight/", fps: 7, AnimationType.Idle, DirectionalAnimation.DirectionType.TwoWayHorizontal); prefab.AddAnimation("idle_left", "BunnyMod/Resources/ChaosLarge/IdleLeft/", fps: 7, AnimationType.Idle, DirectionalAnimation.DirectionType.TwoWayHorizontal); prefab.AddAnimation("move_right", "BunnyMod/Resources/ChaosLarge/MoveRight/", fps: 12, AnimationType.Move, DirectionalAnimation.DirectionType.TwoWayHorizontal); prefab.AddAnimation("move_left", "BunnyMod/Resources/ChaosLarge/MoveLeft/", fps: 12, AnimationType.Move, DirectionalAnimation.DirectionType.TwoWayHorizontal); prefab.AddAnimation("death_left", "BunnyMod/Resources/ChaosLarge/DeathLeft/", fps: 7, AnimationType.Idle, DirectionalAnimation.DirectionType.TwoWayHorizontal); prefab.AddAnimation("death_right", "BunnyMod/Resources/ChaosLarge/DeathRight/", fps: 7, AnimationType.Idle, DirectionalAnimation.DirectionType.TwoWayHorizontal); //prefab.AddAnimation("attack_left", "BunnyMod/Resources/ChaosLarge/AttackLeft/", fps: 7, AnimationType.Other, DirectionalAnimation.DirectionType.TwoWayHorizontal); //prefab.AddAnimation("attack_right", "BunnyMod/Resources/ChaosLarge/AttackRight/", fps: 7, AnimationType.Other, DirectionalAnimation.DirectionType.TwoWayHorizontal); var bs = prefab.GetComponent <BehaviorSpeculator>(); BehaviorSpeculator behaviorSpeculator = EnemyDatabase.GetOrLoadByGuid("1a78cfb776f54641b832e92c44021cf2").behaviorSpeculator; BehaviorSpeculator load = EnemyDatabase.GetOrLoadByGuid("1a78cfb776f54641b832e92c44021cf2").behaviorSpeculator; bs.OverrideBehaviors = behaviorSpeculator.OverrideBehaviors; bs.OtherBehaviors = behaviorSpeculator.OtherBehaviors; bs.TargetBehaviors = new List <TargetBehaviorBase> { new TargetPlayerBehavior { Radius = 1000f, LineOfSight = false, ObjectPermanence = true, SearchInterval = 0.25f, PauseOnTargetSwitch = false, PauseTime = 0.25f } }; bs.MovementBehaviors = new List <MovementBehaviorBase>() { new SeekTargetBehavior() { StopWhenInRange = true, CustomRange = 6, LineOfSight = true, ReturnToSpawn = true, SpawnTetherDistance = 0, PathInterval = 0.5f, SpecifyRange = false, MinActiveRange = 1, MaxActiveRange = 10 } }; bs.AttackBehaviors = new List <AttackBehaviorBase>() { new ShootBehavior() { ShootPoint = AttachPoint, //GroupCooldownVariance = 0.2f, //LineOfSight = false, //WeaponType = WeaponType.BulletScript, //OverrideBulletName = null, BulletScript = new CustomBulletScriptSelector(typeof(ChaosAttckbeeg1)), //FixTargetDuringAttack = false, //StopDuringAttack = false, LeadAmount = 0.7f, //LeadChance = 0.62f, //RespectReload = true, //MagazineCapacity = 1, //ReloadSpeed = 3, //EmptiesClip = true, //SuppressReloadAnim = false, //TimeBetweenShots = 0.5f, PreventTargetSwitching = false, //OverrideAnimation = null, //OverrideDirectionalAnimation = null, HideGun = true, //UseLaserSight = false, //UseGreenLaser = false, //PreFireLaserTime = -1, //AimAtFacingDirectionWhenSafe = false, Cooldown = 1.5f, CooldownVariance = 0, AttackCooldown = 0, GlobalCooldown = 0, InitialCooldown = 0, InitialCooldownVariance = 0, GroupName = null, GroupCooldown = 0, MinRange = 0, Range = 16, MinWallDistance = 0, MaxEnemiesInRoom = 0, MinHealthThreshold = 0, MaxHealthThreshold = 1, HealthThresholds = new float[0], AccumulateHealthThresholds = true, targetAreaStyle = null, IsBlackPhantom = false, resetCooldownOnDamage = null, RequiresLineOfSight = false, MaxUsages = 0, }, new ShootBehavior() { ShootPoint = AttachPoint, //GroupCooldownVariance = 0.2f, //LineOfSight = false, //WeaponType = WeaponType.BulletScript, //OverrideBulletName = null, BulletScript = new CustomBulletScriptSelector(typeof(ChaosAttckbeeg2)), //FixTargetDuringAttack = false, //StopDuringAttack = false, LeadAmount = 0.7f, //LeadChance = 0.62f, //RespectReload = true, //MagazineCapacity = 1, //ReloadSpeed = 3, //EmptiesClip = true, //SuppressReloadAnim = false, //TimeBetweenShots = 0.5f, PreventTargetSwitching = false, //OverrideAnimation = null, //OverrideDirectionalAnimation = null, HideGun = true, //UseLaserSight = false, //UseGreenLaser = false, //PreFireLaserTime = -1, //AimAtFacingDirectionWhenSafe = false, Cooldown = 10f, CooldownVariance = 0, AttackCooldown = 0, GlobalCooldown = 3, InitialCooldown = 0, InitialCooldownVariance = 0, GroupName = null, GroupCooldown = 0, MinRange = 0, Range = 16, MinWallDistance = 0, MaxEnemiesInRoom = 0, MinHealthThreshold = 0, MaxHealthThreshold = 1, HealthThresholds = new float[0], AccumulateHealthThresholds = true, targetAreaStyle = null, IsBlackPhantom = false, resetCooldownOnDamage = null, RequiresLineOfSight = false, MaxUsages = 0, } }; //Tools.DebugInformation(load); AIActor aIActor = EnemyDatabase.GetOrLoadByGuid("e21ac9492110493baef6df02a2682a0d"); bs.InstantFirstTick = behaviorSpeculator.InstantFirstTick; bs.TickInterval = behaviorSpeculator.TickInterval; bs.PostAwakenDelay = behaviorSpeculator.PostAwakenDelay; bs.RemoveDelayOnReinforce = behaviorSpeculator.RemoveDelayOnReinforce; bs.OverrideStartingFacingDirection = behaviorSpeculator.OverrideStartingFacingDirection; bs.StartingFacingDirection = behaviorSpeculator.StartingFacingDirection; bs.SkipTimingDifferentiator = behaviorSpeculator.SkipTimingDifferentiator; //GameObject m_CachedGunAttachPoint = companion.transform.Find("GunAttachPoint").gameObject; //EnemyBuilder.DuplicateAIShooterAndAIBulletBank(prefab, aIActor.aiShooter, aIActor.GetComponent<AIBulletBank>(), ChaosRevolver.ChaosRevolverID, m_CachedGunAttachPoint.transform); Game.Enemies.Add("bny:chaos_being_large", companion.aiActor); } }
protected override void Update() { base.Update(); if (this.m_pickedUp && this.m_owner != null) { if (this.m_owner.PlayerHasActiveSynergy("#THE_SMART_COMPANIONS")) { foreach (AIActor enemy in StaticReferenceManager.AllEnemies) { if (enemy.GetEffect("charm") != null && enemy.GetComponent <AliveBullets.DumbEnemyBehavior>() == null && enemy.GetComponent <CompanionController>() == null) { string guid = enemy.EnemyGuid; Vector2 pos = enemy.sprite.WorldBottomLeft; bool isBlackPhantom = enemy.IsBlackPhantom; enemy.EraseFromExistence(true); AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(orLoadByGuid.gameObject, pos, Quaternion.identity); CompanionController orAddComponent = gameObject.GetOrAddComponent <CompanionController>(); if (isBlackPhantom) { gameObject.GetComponent <AIActor>().BecomeBlackPhantom(); } orAddComponent.companionID = CompanionController.CompanionIdentifier.NONE; orAddComponent.Initialize(this.m_owner); orAddComponent.behaviorSpeculator.MovementBehaviors.Add(new CompanionFollowPlayerBehavior()); AIActor aiactor = gameObject.GetComponent <AIActor>(); aiactor.HitByEnemyBullets = true; aiactor.healthHaver.ModifyDamage += this.ModifyDamageForCompanions; if (orAddComponent.bulletBank) { orAddComponent.bulletBank.OnProjectileCreated += this.PreventInfection; } if (orAddComponent.aiShooter) { orAddComponent.aiShooter.PostProcessProjectile += this.PreventInfection; } foreach (AIBulletBank.Entry entry in orAddComponent.bulletBank.Bullets) { if (aiactor.IsBlackPhantom) { entry.BulletObject.GetComponent <Projectile>().baseData.damage = 15; } else { entry.BulletObject.GetComponent <Projectile>().baseData.damage = 10; } } foreach (AttackBehaviorBase behavior in aiactor.behaviorSpeculator.AttackBehaviors) { if ((behavior as ShootGunBehavior) != null) { if (aiactor.IsBlackPhantom) { aiactor.aiShooter.GetBulletEntry((behavior as ShootGunBehavior).OverrideBulletName).ProjectileData.damage = 15; } else { aiactor.aiShooter.GetBulletEntry((behavior as ShootGunBehavior).OverrideBulletName).ProjectileData.damage = 10; } } } } } } } }
protected override void DoEffect(PlayerController user) { AkSoundEngine.PostEvent("Play_OBJ_goldenlock_open_01", base.gameObject); { this.random = UnityEngine.Random.Range(0.0f, 1.0f); if (random <= 0.83f) { for (int counter = 0; counter < 2; counter++) { int num3 = UnityEngine.Random.Range(0, 6); bool flag3 = num3 == 0; if (flag3) { string guid; guid = "cd4a4b7f612a4ba9a720b9f97c52f38c"; PlayerController owner = base.LastOwner; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2? intVector = new IntVector2?(base.LastOwner.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = false; aiactor.CanTargetPlayers = true; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.IsHarmlessEnemy = false; aiactor.IgnoreForRoomClear = false; aiactor.HandleReinforcementFallIntoRoom(0f); } bool flag4 = num3 == 1; if (flag4) { string guid; guid = "98ea2fe181ab4323ab6e9981955a9bca"; PlayerController owner = base.LastOwner; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2? intVector = new IntVector2?(base.LastOwner.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = false; aiactor.CanTargetPlayers = true; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.IsHarmlessEnemy = false; aiactor.IgnoreForRoomClear = false; aiactor.HandleReinforcementFallIntoRoom(0f); } bool flag5 = num3 == 2; if (flag5) { string guid; guid = "383175a55879441d90933b5c4e60cf6f"; PlayerController owner = base.LastOwner; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2? intVector = new IntVector2?(base.LastOwner.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = false; aiactor.CanTargetPlayers = true; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.IsHarmlessEnemy = false; aiactor.IgnoreForRoomClear = false; aiactor.HandleReinforcementFallIntoRoom(0f); } bool flag6 = num3 == 3; if (flag6) { string guid; guid = "d5a7b95774cd41f080e517bea07bf495"; PlayerController owner = base.LastOwner; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2? intVector = new IntVector2?(base.LastOwner.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = false; aiactor.CanTargetPlayers = true; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.IsHarmlessEnemy = false; aiactor.IgnoreForRoomClear = false; aiactor.HandleReinforcementFallIntoRoom(0f); } bool flag7 = num3 == 4; if (flag7) { string guid; guid = "1bc2a07ef87741be90c37096910843ab"; PlayerController owner = base.LastOwner; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2? intVector = new IntVector2?(base.LastOwner.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = false; aiactor.CanTargetPlayers = true; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.IsHarmlessEnemy = false; aiactor.IgnoreForRoomClear = false; aiactor.HandleReinforcementFallIntoRoom(0f); } bool flag8 = num3 == 5; if (flag8) { string guid; guid = "21dd14e5ca2a4a388adab5b11b69a1e1"; PlayerController owner = base.LastOwner; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2? intVector = new IntVector2?(base.LastOwner.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = false; aiactor.CanTargetPlayers = true; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.IsHarmlessEnemy = false; aiactor.IgnoreForRoomClear = false; aiactor.HandleReinforcementFallIntoRoom(0f); } } } else { LootEngine.GivePrefabToPlayer(PickupObjectDatabase.GetById(67).gameObject, user); IntVector2 bestRewardLocation = user.CurrentRoom.GetBestRewardLocation(IntVector2.One * 3, RoomHandler.RewardLocationStyle.PlayerCenter, true); Chest chest2 = GameManager.Instance.RewardManager.SpawnRewardChestAt(bestRewardLocation, -1f, PickupObject.ItemQuality.EXCLUDED); chest2.RegisterChestOnMinimap(chest2.GetAbsoluteParentRoom()); } } }
protected override void DoEffect(PlayerController player) { if (numberOfUses == 2 && host == null) { //head IntVector2 aim = Vector2Extensions.ToIntVector2(player.unadjustedAimPoint, VectorConversions.Round); RoomHandler room = GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(aim); AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid("c2f902b7cbe745efb3db4399927eab34"); AIActor aiActor = AIActor.Spawn(orLoadByGuid.aiActor, player.CenterPosition, room, true, AIActor.AwakenAnimationType.Spawn, true); PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiActor.specRigidbody, null, false); aiActor.CanTargetEnemies = true; aiActor.CanTargetPlayers = false; aiActor.IgnoreForRoomClear = true; aiActor.MovementSpeed = 10f; aiActor.CompanionOwner = player; aiActor.reinforceType = AIActor.ReinforceType.Instant; aiActor.HandleReinforcementFallIntoRoom(.1f); host = aiActor; vangaurd = true; MindControlEffect mindControl = aiActor.gameObject.GetOrAddComponent <MindControlEffect>(); mindControl.owner = player; player.IsEthereal = true; player.SetIsStealthed(true, "cause they just are"); PassiveItem.IncrementFlag(player, typeof(LiveAmmoItem)); if (modifierController == 0) { player.MovementModifiers += this.NoMotionModifier; player.IsStationary = true; modifierController++; } player.CurrentStoneGunTimer = 9999999f; this.LastOwner.stats.RecalculateStats(LastOwner, true); CamToggle = 1; } if (numberOfUses == 1) { player.CurrentStoneGunTimer = 1f; player.MovementModifiers -= this.NoMotionModifier; player.IsStationary = false; modifierController = 0; player.IsEthereal = false; if (host != null) { host.healthHaver.ApplyDamage(99999, Vector2.zero, "unbound", CoreDamageTypes.Magic, DamageCategory.Unstoppable, true, null, false); host = null; } player.SetIsStealthed(false, "cause they just are"); CamToggle = 0; GameManager.Instance.MainCameraController.StartTrackingPlayer(); GameManager.Instance.MainCameraController.SetManualControl(false, true); } }
protected override void DoEffect(PlayerController owner) { string dogGuid = "c07ef60ae32b404f99e294a6f9acba75"; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(dogGuid); Vector3 vector = owner.transform.position; if (GameManager.Instance.CurrentLevelOverrideState == GameManager.LevelOverrideState.FOYER) { vector += new Vector3(1.125f, -0.3125f, 0f); } GameObject extantCompanion = UnityEngine.Object.Instantiate <GameObject>(orLoadByGuid.gameObject, vector, Quaternion.identity); this.m_extantCompanion = extantCompanion; CompanionController orAddComponent = this.m_extantCompanion.GetOrAddComponent <CompanionController>(); orAddComponent.Initialize(owner); if (orAddComponent.specRigidbody) { PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(orAddComponent.specRigidbody, null, false); DogNumber++; } AIActor orLoadByGuid2 = EnemyDatabase.GetOrLoadByGuid(dogGuid); Vector3 vector2 = owner.transform.position; if (GameManager.Instance.CurrentLevelOverrideState == GameManager.LevelOverrideState.FOYER) { vector2 += new Vector3(1.125f, -0.3125f, 0f); } GameObject extantCompanion2 = UnityEngine.Object.Instantiate <GameObject>(orLoadByGuid.gameObject, vector, Quaternion.identity); this.m_extantCompanion = extantCompanion2; CompanionController orAddComponent2 = this.m_extantCompanion.GetOrAddComponent <CompanionController>(); orAddComponent2.Initialize(owner); if (orAddComponent2.specRigidbody) { PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(orAddComponent2.specRigidbody, null, false); DogNumber++; } if (hasSynergy) { string dogGuid2 = "c07ef60ae32b404f99e294a6f9acba75"; AIActor orLoadByGuid3 = EnemyDatabase.GetOrLoadByGuid(dogGuid2); Vector3 vector3 = owner.transform.position; if (GameManager.Instance.CurrentLevelOverrideState == GameManager.LevelOverrideState.FOYER) { vector3 += new Vector3(1.125f, -0.3125f, 0f); } GameObject extantCompanion3 = UnityEngine.Object.Instantiate <GameObject>(orLoadByGuid3.gameObject, vector3, Quaternion.identity); this.m_extantCompanion = extantCompanion3; CompanionController orAddComponent3 = this.m_extantCompanion.GetOrAddComponent <CompanionController>(); orAddComponent3.Initialize(owner); if (orAddComponent3.specRigidbody) { PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(orAddComponent3.specRigidbody, null, false); DogNumber++; } } }
public override void Update() { if (Owner && !Dungeon.IsGenerating && Owner.IsInCombat && base.transform.position.GetAbsoluteRoom() == Owner.CurrentRoom) { if (timer > 0) { timer -= BraveTime.DeltaTime; } if (timer <= 0) { //do stuff bool doAnim = false; if ((GameManager.Instance.Dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.HELLGEON) || Owner.PlayerHasActiveSynergy("They Grow Inside")) { float chance = 0.25f; if (Owner.PlayerHasActiveSynergy("They Grow Inside")) { chance = 0.50f; } if (UnityEngine.Random.value <= chance) { doAnim = true; VolleyReplacementSynergyProcessor shotgrubProcessor = (PickupObjectDatabase.GetById(347) as Gun).GetComponent <VolleyReplacementSynergyProcessor>(); Projectile bullet = shotgrubProcessor.SynergyVolley.projectiles[0].projectiles[0].projectile; GameObject spawnedProj = ProjSpawnHelper.SpawnProjectileTowardsPoint(bullet.gameObject, base.sprite.WorldCenter, base.specRigidbody.UnitCenter.GetPositionOfNearestEnemy(false, true), 0, 15); Projectile component = spawnedProj.GetComponent <Projectile>(); if (component != null) { component.Owner = Owner; component.Shooter = Owner.specRigidbody; //COMPANION SHIT component.TreatedAsNonProjectileForChallenge = true; component.baseData.damage *= Owner.stats.GetStatValue(PlayerStats.StatType.Damage); component.baseData.speed *= Owner.stats.GetStatValue(PlayerStats.StatType.ProjectileSpeed); component.baseData.force *= Owner.stats.GetStatValue(PlayerStats.StatType.KnockbackMultiplier); component.AdditionalScaleMultiplier *= Owner.stats.GetStatValue(PlayerStats.StatType.PlayerBulletScale); component.UpdateSpeed(); base.HandleCompanionPostProcessProjectile(component); } } } if (UnityEngine.Random.value <= 0.02f) { doAnim = true; bool shouldJam = false; if (Owner.PlayerHasActiveSynergy("Cursed Ceramics")) { shouldJam = true; } AIActor fairy = CompanionisedEnemyUtility.SpawnCompanionisedEnemy(Owner, "c182a5cb704d460d9d099a47af49c913", base.specRigidbody.UnitCenter.ToIntVector2(), false, ExtendedColours.brown, 10, 2, shouldJam, true); fairy.specRigidbody.CollideWithOthers = false; } if (UnityEngine.Random.value <= 0.05f && Owner.PlayerHasActiveSynergy("The Potter Boy")) { doAnim = true; AIActor randomActiveEnemy = base.transform.position.GetAbsoluteRoom().GetRandomActiveEnemy(false); if (randomActiveEnemy && randomActiveEnemy.IsNormalEnemy && randomActiveEnemy.healthHaver && !randomActiveEnemy.healthHaver.IsBoss) { randomActiveEnemy.Transmogrify(EnemyDatabase.GetOrLoadByGuid("76bc43539fc24648bff4568c75c686d1"), (GameObject)ResourceCache.Acquire("Global VFX/VFX_Item_Spawn_Poof")); } } if (doAnim && this.aiAnimator) { this.aiAnimator.PlayUntilFinished("spawnobject", false, null, -1f, false); } timer = 2f; } if (RadialTimer > 0) { RadialTimer -= BraveTime.DeltaTime; } if (RadialTimer <= 0) { HandleRadialEffects(); RadialTimer = 0.05f; } } base.Update(); }
public static IEnumerator HandleCurseDeathEffects(Vector2 position, string guid, float maxHP, bool isJammed) { if (CurseManager.CurseIsActive("Curse of Infestation")) { if (!string.IsNullOrEmpty(guid) && !EasyEnemyTypeLists.SmallBullats.Contains(guid)) { int amt = UnityEngine.Random.Range(-1, 4); if (amt > 0) { for (int i = 0; i < amt; i++) { if (GameManager.Instance.AnyPlayerHasActiveSynergy("The Last Crusade")) { AIActor targetActor = CompanionisedEnemyUtility.SpawnCompanionisedEnemy(GameManager.Instance.PrimaryPlayer, BraveUtility.RandomElement(EasyEnemyTypeLists.SmallBullats), position.ToIntVector2(), false, Color.red, 5, 2, false, false); PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(targetActor.specRigidbody, null, false); } else { var enemyToSpawn = EnemyDatabase.GetOrLoadByGuid(BraveUtility.RandomElement(EasyEnemyTypeLists.SmallBullats)); AIActor TargetActor = AIActor.Spawn(enemyToSpawn, position, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(position.ToIntVector2()), true, AIActor.AwakenAnimationType.Default, true); PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(TargetActor.specRigidbody, null, false); TargetActor.PreventBlackPhantom = true; } } } } } if (CurseManager.CurseIsActive("Curse of Sludge")) { if (maxHP > 0) { DeadlyDeadlyGoopManager goop = null; if (GameManager.Instance.AnyPlayerHasActiveSynergy("The Last Crusade")) { goop = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(EasyGoopDefinitions.PlayerFriendlyPoisonGoop); } else { goop = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(EasyGoopDefinitions.EnemyFriendlyPoisonGoop); } float hpMod = maxHP; if (isJammed) { hpMod /= 3.5f; } hpMod /= AIActor.BaseLevelHealthModifier; float radius = Math.Min((hpMod / 7.5f), 10); goop.TimedAddGoopCircle(position, radius, 0.75f, true); } } if (CurseManager.CurseIsActive("Curse of The Hive")) { if (maxHP > 0) { DeadlyDeadlyGoopManager goop = null; if (GameManager.Instance.AnyPlayerHasActiveSynergy("The Last Crusade")) { goop = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(EasyGoopDefinitions.PlayerFriendlyHoneyGoop); } else { goop = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(EasyGoopDefinitions.HoneyGoop); } float hpMod = maxHP; if (isJammed) { hpMod /= 3.5f; } hpMod /= AIActor.BaseLevelHealthModifier; float radius = Math.Min((hpMod / 5), 10); goop.TimedAddGoopCircle(position, radius, 0.75f, true); } } yield break; }
private void Start() { m_AIActor = aiActor; m_AIShooter = aiShooter; }
public static AIActor AdvancedTransmogrify(this AIActor startEnemy, AIActor EnemyPrefab, GameObject EffectVFX, string audioEvent = "Play_ENM_wizardred_appear_01", bool ignoreAlreadyTransmogged = false, bool canTransmogMimics = false, bool defuseExplosives = true, bool carryOverRewards = false, bool maintainHealthPercent = false, bool maintainsJammedState = false, bool giveIsTransmogrifiedBool = true, bool logEverything = false) { if (startEnemy == null) { Debug.LogError("Tried to transmog a null enemy!"); return(null); } if (EnemyPrefab == null) { Debug.LogError("Tried to transmog to a null prefab!"); return(startEnemy); } if (startEnemy.EnemyGuid == EnemyPrefab.EnemyGuid) { if (logEverything) { Debug.Log($"Tried to transmog an enemy into an actor with the same guid!"); } return(startEnemy); } if (ignoreAlreadyTransmogged && startEnemy.IsTransmogrified) { if (logEverything) { Debug.Log("Tried to transmog an enemy that has already been transmogged."); } return(startEnemy); } if (!startEnemy.healthHaver || startEnemy.healthHaver.IsBoss || startEnemy.ParentRoom == null) { if (logEverything) { Debug.Log("Either the healthhaver or parent room on the target was null, or they were a boss!"); } return(startEnemy); } Vector2 centerPosition = startEnemy.CenterPosition; if (EffectVFX != null) { SpawnManager.SpawnVFX(EffectVFX, centerPosition, Quaternion.identity); } AIActor aiactor = AIActor.Spawn(EnemyPrefab, centerPosition.ToIntVector2(VectorConversions.Floor), startEnemy.ParentRoom, true, AIActor.AwakenAnimationType.Default, true); if (aiactor) { if (giveIsTransmogrifiedBool) { aiactor.IsTransmogrified = true; } if (maintainHealthPercent) { float healthPercent = startEnemy.healthHaver.GetCurrentHealthPercentage(); //ETGModConsole.Log("HP Percent: " + healthPercent); float aiactorHP = aiactor.healthHaver.GetMaxHealth(); float resultHP = aiactorHP * healthPercent; aiactor.healthHaver.ForceSetCurrentHealth(resultHP); } } if (!string.IsNullOrEmpty(audioEvent)) { AkSoundEngine.PostEvent(audioEvent, startEnemy.gameObject); } if (maintainsJammedState) { if (startEnemy.IsBlackPhantom && !aiactor.IsBlackPhantom) { aiactor.BecomeBlackPhantom(); } if (!startEnemy.IsBlackPhantom && aiactor.IsBlackPhantom) { aiactor.UnbecomeBlackPhantom(); } } if (defuseExplosives && startEnemy.GetComponent <ExplodeOnDeath>() != null) { UnityEngine.Object.Destroy(startEnemy.GetComponent <ExplodeOnDeath>()); } if (carryOverRewards && aiactor) { aiactor.CanDropCurrency = startEnemy.CanDropCurrency; aiactor.AssignedCurrencyToDrop = startEnemy.AssignedCurrencyToDrop; aiactor.AdditionalSafeItemDrops = startEnemy.AdditionalSafeItemDrops; aiactor.AdditionalSimpleItemDrops = startEnemy.AdditionalSimpleItemDrops; aiactor.AdditionalSingleCoinDropChance = startEnemy.AdditionalSingleCoinDropChance; aiactor.CanDropDuplicateItems = startEnemy.CanDropDuplicateItems; aiactor.CanDropItems = startEnemy.CanDropItems; aiactor.ChanceToDropCustomChest = startEnemy.ChanceToDropCustomChest; aiactor.CustomLootTableMaxDrops = startEnemy.CustomLootTableMaxDrops; aiactor.CustomLootTableMinDrops = startEnemy.CustomLootTableMinDrops; aiactor.CustomLootTable = startEnemy.CustomLootTable; aiactor.SpawnLootAtRewardChestPos = startEnemy.SpawnLootAtRewardChestPos; if (startEnemy.GetComponent <KeyBulletManController>()) { KeyBulletManController controller = startEnemy.GetComponent <KeyBulletManController>(); int numberOfIterations = 1; if (startEnemy.IsBlackPhantom && controller.doubleForBlackPhantom) { numberOfIterations++; } for (int i = 0; i < numberOfIterations; i++) { GameObject objToAdd = null; if (controller.lootTable) { objToAdd = controller.lootTable.SelectByWeight(false); } else if (controller.lookPickupId > -1) { objToAdd = PickupObjectDatabase.GetById(controller.lookPickupId).gameObject; } if (objToAdd != null) { aiactor.AdditionalSafeItemDrops.Add(objToAdd.GetComponent <PickupObject>()); } } } startEnemy.EraseFromExistence(false); } else { startEnemy.EraseFromExistenceWithRewards(false); } return(aiactor); }
public static void BuildPrefab() { // bool flag = prefab != null || EnemyBuilder.Dictionary.ContainsKey(guid); bool flag2 = flag; if (!flag2) { AIActor aIActor = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5"); prefab = EnemyBuilder.BuildPrefab("DrawnKin", guid, spritePaths[0], new IntVector2(0, 0), new IntVector2(8, 9), true); var companion = prefab.AddComponent <EnemyBehavior>();; companion.aiActor.knockbackDoer.weight = 50; companion.aiActor.MovementSpeed = 2f; companion.aiActor.healthHaver.PreventAllDamage = false; companion.aiActor.CollisionDamage = 1f; companion.aiActor.HasShadow = false; companion.aiActor.IgnoreForRoomClear = false; companion.aiActor.aiAnimator.HitReactChance = 0f; companion.aiActor.specRigidbody.CollideWithOthers = true; companion.aiActor.specRigidbody.CollideWithTileMap = true; companion.aiActor.PreventFallingInPitsEver = false; companion.aiActor.healthHaver.ForceSetCurrentHealth(30f); companion.aiActor.CollisionKnockbackStrength = 5f; companion.aiActor.CanTargetPlayers = true; companion.aiActor.SetIsFlying(true, "Flying Enemy", true, true); companion.aiActor.healthHaver.SetHealthMaximum(30f, null, false); companion.aiActor.specRigidbody.PixelColliders.Clear(); companion.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider { ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual, CollisionLayer = CollisionLayer.EnemyCollider, IsTrigger = false, BagleUseFirstFrameOnly = false, SpecifyBagelFrame = string.Empty, BagelColliderNumber = 0, ManualOffsetX = 0, ManualOffsetY = 0, ManualWidth = 15, ManualHeight = 17, ManualDiameter = 0, ManualLeftX = 0, ManualLeftY = 0, ManualRightX = 0, ManualRightY = 0 }); companion.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider { ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual, CollisionLayer = CollisionLayer.EnemyHitBox, IsTrigger = false, BagleUseFirstFrameOnly = false, SpecifyBagelFrame = string.Empty, BagelColliderNumber = 0, ManualOffsetX = 0, ManualOffsetY = 0, ManualWidth = 15, ManualHeight = 17, ManualDiameter = 0, ManualLeftX = 0, ManualLeftY = 0, ManualRightX = 0, ManualRightY = 0, }); companion.aiActor.CorpseObject = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5").CorpseObject; companion.aiActor.PreventBlackPhantom = false; AIAnimator aiAnimator = companion.aiAnimator; aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation> { new AIAnimator.NamedDirectionalAnimation { name = "die", anim = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.TwoWayHorizontal, Flipped = new DirectionalAnimation.FlipType[2], AnimNames = new string[] { "die_right", "die_left" } } } }; aiAnimator.IdleAnimation = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.TwoWayHorizontal, Flipped = new DirectionalAnimation.FlipType[2], AnimNames = new string[] { "idle_front_right", "idle_front_left", "idle_back_right", "idle_back_left" } }; aiAnimator.MoveAnimation = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.FourWay, Flipped = new DirectionalAnimation.FlipType[4], AnimNames = new string[] { "run_back_right", "run_front_right", "run_front_left", "run_back_left", } }; bool flag3 = DrawnKinCollection == null; if (flag3) { DrawnKinCollection = SpriteBuilder.ConstructCollection(prefab, "DrawnKin_Collection"); UnityEngine.Object.DontDestroyOnLoad(DrawnKinCollection); for (int i = 0; i < spritePaths.Length; i++) { SpriteBuilder.AddSpriteToCollection(spritePaths[i], DrawnKinCollection); } SpriteBuilder.AddAnimation(companion.spriteAnimator, DrawnKinCollection, new List <int> { 0, 3 }, "idle_back_left", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 5f; SpriteBuilder.AddAnimation(companion.spriteAnimator, DrawnKinCollection, new List <int> { 1, 2 }, "idle_back_right", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 5f; SpriteBuilder.AddAnimation(companion.spriteAnimator, DrawnKinCollection, new List <int> { 0, 3 }, "idle_front_left", tk2dSpriteAnimationClip.WrapMode.Once).fps = 5f; SpriteBuilder.AddAnimation(companion.spriteAnimator, DrawnKinCollection, new List <int> { 1, 2 }, "idle_front_right", tk2dSpriteAnimationClip.WrapMode.Once).fps = 5f; SpriteBuilder.AddAnimation(companion.spriteAnimator, DrawnKinCollection, new List <int> { 10, 11, 12, 13, 14, 15 }, "run_back_left", tk2dSpriteAnimationClip.WrapMode.Once).fps = 10f; SpriteBuilder.AddAnimation(companion.spriteAnimator, DrawnKinCollection, new List <int> { 22, 23, 24, 25, 26, 27 }, "run_back_right", tk2dSpriteAnimationClip.WrapMode.Once).fps = 10f; SpriteBuilder.AddAnimation(companion.spriteAnimator, DrawnKinCollection, new List <int> { 4, 5, 6, 7, 8, 9 }, "run_front_left", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 14f; SpriteBuilder.AddAnimation(companion.spriteAnimator, DrawnKinCollection, new List <int> { 16, 17, 18, 19, 20, 21 }, "run_front_right", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 14f; } var bs = prefab.GetComponent <BehaviorSpeculator>(); BehaviorSpeculator behaviorSpeculator = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5").behaviorSpeculator; bs.OverrideBehaviors = behaviorSpeculator.OverrideBehaviors; bs.OtherBehaviors = behaviorSpeculator.OtherBehaviors; bs.TargetBehaviors = new List <TargetBehaviorBase> { new TargetPlayerBehavior { Radius = 35f, LineOfSight = true, ObjectPermanence = true, SearchInterval = 0.25f, PauseOnTargetSwitch = false, PauseTime = 0.25f } }; bs.AttackBehaviors = new List <AttackBehaviorBase>() { new ShootGunBehavior() { GroupCooldownVariance = 0.2f, LineOfSight = false, WeaponType = WeaponType.BulletScript, OverrideBulletName = null, BulletScript = new CustomBulletScriptSelector(typeof(Drawn47Script)), FixTargetDuringAttack = true, StopDuringAttack = true, LeadAmount = 0, LeadChance = 1, RespectReload = true, MagazineCapacity = 8, ReloadSpeed = 5f, EmptiesClip = true, SuppressReloadAnim = false, TimeBetweenShots = -1, PreventTargetSwitching = true, OverrideAnimation = null, OverrideDirectionalAnimation = null, HideGun = false, UseLaserSight = false, UseGreenLaser = false, PreFireLaserTime = -1, AimAtFacingDirectionWhenSafe = false, Cooldown = 0.6f, CooldownVariance = 0, AttackCooldown = 0, GlobalCooldown = 0, InitialCooldown = 0, InitialCooldownVariance = 0, GroupName = null, GroupCooldown = 0, MinRange = 0, Range = 16, MinWallDistance = 0, MaxEnemiesInRoom = 0, MinHealthThreshold = 0, MaxHealthThreshold = 1, HealthThresholds = new float[0], AccumulateHealthThresholds = true, targetAreaStyle = null, IsBlackPhantom = false, resetCooldownOnDamage = null, RequiresLineOfSight = true, MaxUsages = 0, } }; bs.MovementBehaviors = new List <MovementBehaviorBase> { new SeekTargetBehavior { StopWhenInRange = true, CustomRange = 7f, LineOfSight = false, ReturnToSpawn = false, SpawnTetherDistance = 0f, PathInterval = 0.5f, SpecifyRange = false, MinActiveRange = 0f, MaxActiveRange = 0f } }; //BehaviorSpeculator load = EnemyDatabase.GetOrLoadByGuid("206405acad4d4c33aac6717d184dc8d4").behaviorSpeculator; //Tools.DebugInformation(load); bs.InstantFirstTick = behaviorSpeculator.InstantFirstTick; bs.TickInterval = behaviorSpeculator.TickInterval; bs.RemoveDelayOnReinforce = behaviorSpeculator.RemoveDelayOnReinforce; bs.OverrideStartingFacingDirection = behaviorSpeculator.OverrideStartingFacingDirection; bs.StartingFacingDirection = behaviorSpeculator.StartingFacingDirection; bs.SkipTimingDifferentiator = behaviorSpeculator.SkipTimingDifferentiator; GameObject m_CachedGunAttachPoint = companion.transform.Find("GunAttachPoint").gameObject; EnemyBuilder.DuplicateAIShooterAndAIBulletBank(prefab, aIActor.aiShooter, aIActor.GetComponent <AIBulletBank>(), CakeIDs.Drawn47, m_CachedGunAttachPoint.transform); Game.Enemies.Add("cak:drawnkin", companion.aiActor); ItemsMod.Strings.Enemies.Set("#DRAWNKIN", "Drawn Kin"); companion.aiActor.OverrideDisplayName = "#DRAWNKIN"; companion.aiActor.ActorName = "#DRAWNKIN"; companion.aiActor.name = "#DRAWNKIN"; } }
private IEnumerator DoBlowey() { yield return(null); RoomHandler room = self.GetAbsoluteRoom(); if (room != null) { List <AIActor> enemies = room.GetActiveEnemies(RoomHandler.ActiveEnemyType.All); for (int i = 0; i < enemies.Count; i++) { AIActor enemy = enemies[i]; if (enemy && enemy.healthHaver && enemy.healthHaver.IsAlive) { if (enemy.sprite.WorldCenter.PositionBetweenRelativeValidAngles(self.specRigidbody.UnitCenter, self.Direction.ToAngle(), 1000000, 45f)) { Vector2 dir = (enemy.sprite.WorldCenter - self.specRigidbody.UnitCenter).normalized; float knockback = 10; //Calculate Damage float dmg = damageToDeal; if (deleteSelf) { dmg *= self.baseData.damage; } else { dmg *= (self.baseData.damage / 10); } if (self.ProjectilePlayerOwner()) { //dmg *= self.ProjectilePlayerOwner().stats.GetStatValue(PlayerStats.StatType.Damage); knockback *= self.ProjectilePlayerOwner().stats.GetStatValue(PlayerStats.StatType.KnockbackMultiplier); if (enemy.healthHaver.IsBoss) { dmg *= self.ProjectilePlayerOwner().stats.GetStatValue(PlayerStats.StatType.DamageToBosses); } if (enemy.aiActor.IsBlackPhantom) { dmg *= self.BlackPhantomDamageMultiplier; } } enemy.healthHaver.ApplyDamage(dmg, (dir * -1), "Blowie"); if (enemy.knockbackDoer) { enemy.knockbackDoer.ApplyKnockback(dir, knockback, false); } List <GameActorEffect> effects = self.GetFullListOfStatusEffects(); if (effects.Count > 0) { foreach (GameActorEffect effect in effects) { enemy.ApplyEffect(effect); } } if (enemy.behaviorSpeculator && self.AppliesStun && UnityEngine.Random.value <= self.StunApplyChance) { enemy.behaviorSpeculator.Stun(self.AppliedStunDuration); } } } } } if (deleteSelf) { UnityEngine.Object.Destroy(self.gameObject); } yield break; }
private void AffectEnemy(AIActor target) { target.ApplyEffect(Library.Shatter, 1f, null); }
private void SpawnEnemies(string[] selectedEnemyGuids) { if (useGlitchedActorPrefab) { IntVector2 pos = specRigidbody.UnitCenter.ToIntVector2(VectorConversions.Floor); if (aiActor.IsFalling && !IsGlitchedLJ) { return; } if (GameManager.Instance.Dungeon.CellIsPit(specRigidbody.UnitCenter.ToVector3ZUp(0f)) && !IsGlitchedLJ) { return; } RoomHandler roomFromPosition = GameManager.Instance.Dungeon.GetRoomFromPosition(pos); List <SpeculativeRigidbody> list = new List <SpeculativeRigidbody>(); list.Add(specRigidbody); Vector2 unitBottomLeft = specRigidbody.UnitBottomLeft; for (int i = 0; i < ActorPrefabSpawnCount; i++) { if (IsGlitchedLJ) { if (transform.position.GetAbsoluteRoom() != null) { ChaosGlitchedEnemies m_GlitchedEnemyDatabase = new ChaosGlitchedEnemies(); RoomHandler CurrentRoom = transform.position.GetAbsoluteRoom(); IntVector2 actorPosition = specRigidbody.UnitCenter.ToIntVector2(VectorConversions.Floor) - CurrentRoom.area.basePosition; m_GlitchedEnemyDatabase.SpawnGlitchedSuperReaper(CurrentRoom, actorPosition); Destroy(m_GlitchedEnemyDatabase); return; } } else { if (ActorObjectTarget == null) { return; } AIActor.AwakenAnimationType AnimationType = AIActor.AwakenAnimationType.Default; AIActor aiactor = null; GameObject CachedTargetActorObject = Instantiate(ActorObjectTarget); bool ExplodesOnDeath = false; bool spawnsGlitchedObjectOnDeath = false; if (UnityEngine.Random.value <= 0.25f) { ExplodesOnDeath = true; } if (UnityEngine.Random.value <= 0.15f) { spawnsGlitchedObjectOnDeath = true; } ChaosGlitchedEnemies m_GlitchedEnemyDatabase = new ChaosGlitchedEnemies(); aiactor = AIActor.Spawn(m_GlitchedEnemyDatabase.GenerateGlitchedActorPrefab(CachedTargetActorObject, ActorOverrideSource, ExplodesOnDeath, spawnsGlitchedObjectOnDeath), specRigidbody.UnitCenter.ToIntVector2(VectorConversions.Floor), roomFromPosition, true, AnimationType, true); Destroy(m_GlitchedEnemyDatabase); if (aiactor == null) { return; } if (aiActor.IsBlackPhantom) { aiactor.BecomeBlackPhantom(); } if (aiactor) { aiactor.specRigidbody.Initialize(); Vector2 a = unitBottomLeft - (aiactor.specRigidbody.UnitBottomLeft - aiactor.transform.position.XY()); Vector2 vector = a + new Vector2(Mathf.Max(0f, specRigidbody.UnitDimensions.x - aiactor.specRigidbody.UnitDimensions.x), 0f); aiactor.transform.position = Vector2.Lerp(a, vector, (ActorPrefabSpawnCount != 1) ? i / (ActorPrefabSpawnCount - 1f) : 0f); aiactor.specRigidbody.Reinitialize(); a -= new Vector2(PhysicsEngine.PixelToUnit(extraPixelWidth), 0f); vector += new Vector2(PhysicsEngine.PixelToUnit(extraPixelWidth), 0f); Vector2 a2 = Vector2.Lerp(a, vector, (ActorPrefabSpawnCount != 1) ? i / (ActorPrefabSpawnCount - 1f) : 0.5f); IntVector2 intVector = PhysicsEngine.UnitToPixel(a2 - aiactor.transform.position.XY()); CollisionData collisionData = null; if (PhysicsEngine.Instance.RigidbodyCastWithIgnores(aiactor.specRigidbody, intVector, out collisionData, true, true, null, false, list.ToArray())) { intVector = collisionData.NewPixelsToMove; } CollisionData.Pool.Free(ref collisionData); aiactor.transform.position += PhysicsEngine.PixelToUnit(intVector).ToVector3ZUp(1f); aiactor.specRigidbody.Reinitialize(); if (i == 0) { aiactor.aiAnimator.FacingDirection = 180f; } else if (i == ActorPrefabSpawnCount - 1) { aiactor.aiAnimator.FacingDirection = 0f; } HandleSpawn(aiactor); list.Add(aiactor.specRigidbody); Destroy(CachedTargetActorObject); } } } if (list.Count > 0) { for (int j = 0; j < list.Count; j++) { for (int k = 0; k < list.Count; k++) { if (j != k) { list[j].RegisterGhostCollisionException(list[k]); } } } } } else if (spawnPosition == SpawnPosition.InsideCollider) { IntVector2 pos = specRigidbody.UnitCenter.ToIntVector2(VectorConversions.Floor); if (aiActor.IsFalling) { return; } if (GameManager.Instance.Dungeon.CellIsPit(specRigidbody.UnitCenter.ToVector3ZUp(0f))) { return; } RoomHandler roomFromPosition = GameManager.Instance.Dungeon.GetRoomFromPosition(pos); List <SpeculativeRigidbody> list = new List <SpeculativeRigidbody>(); list.Add(specRigidbody); Vector2 unitBottomLeft = specRigidbody.UnitBottomLeft; for (int i = 0; i < selectedEnemyGuids.Length; i++) { AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(selectedEnemyGuids[i]); AIActor aiactor = AIActor.Spawn(orLoadByGuid, specRigidbody.UnitCenter.ToIntVector2(VectorConversions.Floor), roomFromPosition, false, AIActor.AwakenAnimationType.Default, true); if (aiActor.IsBlackPhantom) { aiactor.ForceBlackPhantom = true; } if (aiactor) { aiactor.specRigidbody.Initialize(); Vector2 a = unitBottomLeft - (aiactor.specRigidbody.UnitBottomLeft - aiactor.transform.position.XY()); Vector2 vector = a + new Vector2(Mathf.Max(0f, specRigidbody.UnitDimensions.x - aiactor.specRigidbody.UnitDimensions.x), 0f); aiactor.transform.position = Vector2.Lerp(a, vector, (selectedEnemyGuids.Length != 1) ? i / (selectedEnemyGuids.Length - 1f) : 0f); aiactor.specRigidbody.Reinitialize(); a -= new Vector2(PhysicsEngine.PixelToUnit(extraPixelWidth), 0f); vector += new Vector2(PhysicsEngine.PixelToUnit(extraPixelWidth), 0f); Vector2 a2 = Vector2.Lerp(a, vector, (selectedEnemyGuids.Length != 1) ? i / (selectedEnemyGuids.Length - 1f) : 0.5f); IntVector2 intVector = PhysicsEngine.UnitToPixel(a2 - aiactor.transform.position.XY()); CollisionData collisionData = null; if (PhysicsEngine.Instance.RigidbodyCastWithIgnores(aiactor.specRigidbody, intVector, out collisionData, true, true, null, false, list.ToArray())) { intVector = collisionData.NewPixelsToMove; } CollisionData.Pool.Free(ref collisionData); // aiactor.transform.position += PhysicsEngine.PixelToUnit(intVector); aiactor.transform.position += PhysicsEngine.PixelToUnit(intVector).ToVector3ZUp(1f); aiactor.specRigidbody.Reinitialize(); if (i == 0) { aiactor.aiAnimator.FacingDirection = 180f; } else if (i == selectedEnemyGuids.Length - 1) { aiactor.aiAnimator.FacingDirection = 0f; } HandleSpawn(aiactor); list.Add(aiactor.specRigidbody); } } for (int j = 0; j < list.Count; j++) { for (int k = 0; k < list.Count; k++) { if (j != k) { list[j].RegisterGhostCollisionException(list[k]); } } } } else if (spawnPosition == SpawnPosition.ScreenEdge) { for (int l = 0; l < selectedEnemyGuids.Length; l++) { AIActor orLoadByGuid2 = EnemyDatabase.GetOrLoadByGuid(selectedEnemyGuids[l]); AIActor spawnedActor = AIActor.Spawn(orLoadByGuid2, specRigidbody.UnitCenter.ToIntVector2(VectorConversions.Floor), aiActor.ParentRoom, false, AIActor.AwakenAnimationType.Default, true); if (spawnedActor) { Vector2 cameraBottomLeft = BraveUtility.ViewportToWorldpoint(new Vector2(0f, 0f), ViewportType.Gameplay); Vector2 cameraTopRight = BraveUtility.ViewportToWorldpoint(new Vector2(1f, 1f), ViewportType.Gameplay); IntVector2 bottomLeft = cameraBottomLeft.ToIntVector2(VectorConversions.Ceil); IntVector2 topRight = cameraTopRight.ToIntVector2(VectorConversions.Floor) - IntVector2.One; CellValidator cellValidator = delegate(IntVector2 c) { for (int num2 = 0; num2 < spawnedActor.Clearance.x; num2++) { for (int num3 = 0; num3 < spawnedActor.Clearance.y; num3++) { if (GameManager.Instance.Dungeon.data.isTopWall(c.x + num2, c.y + num3)) { return(false); } if (GameManager.Instance.Dungeon.data[c.x + num2, c.y + num3].isExitCell) { return(false); } } } return(c.x >= bottomLeft.x && c.y >= bottomLeft.y && c.x + spawnedActor.Clearance.x - 1 <= topRight.x && c.y + spawnedActor.Clearance.y - 1 <= topRight.y); }; Func <IntVector2, float> cellWeightFinder = delegate(IntVector2 c) { float a3 = float.MaxValue; a3 = Mathf.Min(a3, c.x - cameraBottomLeft.x); a3 = Mathf.Min(a3, c.y - cameraBottomLeft.y); a3 = Mathf.Min(a3, cameraTopRight.x - c.x + spawnedActor.Clearance.x); return(Mathf.Min(a3, cameraTopRight.y - c.y + spawnedActor.Clearance.y)); }; Vector2 b = spawnedActor.specRigidbody.UnitCenter - spawnedActor.transform.position.XY(); IntVector2?randomWeightedAvailableCell = spawnedActor.ParentRoom.GetRandomWeightedAvailableCell(new IntVector2?(spawnedActor.Clearance), new CellTypes?(spawnedActor.PathableTiles), false, cellValidator, cellWeightFinder, 0.25f); if (randomWeightedAvailableCell == null) { Debug.LogError("Screen Edge Spawn FAILED!", spawnedActor); Destroy(spawnedActor); } else { spawnedActor.transform.position = Pathfinder.GetClearanceOffset(randomWeightedAvailableCell.Value, spawnedActor.Clearance) - b; spawnedActor.specRigidbody.Reinitialize(); HandleSpawn(spawnedActor); } } } } else if (spawnPosition == SpawnPosition.InsideRadius) { Vector2 unitCenter = specRigidbody.GetUnitCenter(ColliderType.HitBox); List <SpeculativeRigidbody> list2 = new List <SpeculativeRigidbody>(); list2.Add(specRigidbody); for (int m = 0; m < selectedEnemyGuids.Length; m++) { Vector2 vector2 = unitCenter + UnityEngine.Random.insideUnitCircle * spawnRadius; if (GameManager.Instance.CurrentLevelOverrideState == GameManager.LevelOverrideState.CHARACTER_PAST && SceneManager.GetActiveScene().name == "fs_robot") { RoomHandler entrance = GameManager.Instance.Dungeon.data.Entrance; Vector2 lhs = entrance.area.basePosition.ToVector2() + new Vector2(7f, 7f); Vector2 lhs2 = entrance.area.basePosition.ToVector2() + new Vector2(38f, 36f); vector2 = Vector2.Min(lhs2, Vector2.Max(lhs, vector2)); } AIActor orLoadByGuid3 = EnemyDatabase.GetOrLoadByGuid(selectedEnemyGuids[m]); AIActor aiactor2 = AIActor.Spawn(orLoadByGuid3, unitCenter.ToIntVector2(VectorConversions.Floor), aiActor.ParentRoom, true, AIActor.AwakenAnimationType.Default, true); if (aiactor2) { aiactor2.specRigidbody.Initialize(); Vector2 unit = vector2 - aiactor2.specRigidbody.GetUnitCenter(ColliderType.HitBox); aiactor2.specRigidbody.ImpartedPixelsToMove = PhysicsEngine.UnitToPixel(unit); HandleSpawn(aiactor2); list2.Add(aiactor2.specRigidbody); } } for (int n = 0; n < list2.Count; n++) { for (int num = 0; num < list2.Count; num++) { if (n != num) { list2[n].RegisterGhostCollisionException(list2[num]); } } } } else { Debug.LogError("Unknown spawn type: " + spawnPosition); } }
public override void Init(GameObject gameObject, AIActor aiActor, AIShooter aiShooter) { base.Init(gameObject, aiActor, aiShooter); this.ConstraintChaos(); }
public IEnumerator ResizeEnemy(AIActor target, Vector2 ScaleValue, bool onlyDoRescale = true, bool isBigEnemy = false, bool delayed = false) { if (target == null | ScaleValue == null) { yield break; } if (delayed) { yield return(new WaitForSeconds(0.8f)); } HealthHaver targetHealthHaver = target.GetComponent <HealthHaver>(); float knockBackValue = 2f; int cachedLayer = target.gameObject.layer; int cachedOutlineLayer = cachedLayer; target.gameObject.layer = LayerMask.NameToLayer("Unpixelated"); cachedOutlineLayer = SpriteOutlineManager.ChangeOutlineLayer(target.sprite, LayerMask.NameToLayer("Unpixelated")); // target.ClearPath(); if (!onlyDoRescale) { if (target.knockbackDoer) { if (isBigEnemy) { target.knockbackDoer.weight *= knockBackValue; } else { target.knockbackDoer.weight /= knockBackValue; } } if (!isBigEnemy && targetHealthHaver != null && !onlyDoRescale) { if (!targetHealthHaver.IsBoss && !ChaosLists.DontDieOnCollisionWhenTinyGUIDList.Contains(target.EnemyGuid)) { target.DiesOnCollison = true; target.EnemySwitchState = "Blobulin"; } target.CollisionDamage = 0f; target.CollisionDamageTypes = 0; target.PreventFallingInPitsEver = false; // target.CollisionKnockbackStrength = target.CollisionKnockbackStrength - 0.6f; target.PreventBlackPhantom = true; if (targetHealthHaver.IsBoss) { if (targetHealthHaver != null) { targetHealthHaver.SetHealthMaximum(targetHealthHaver.GetMaxHealth() / 1.5f, null, false); } // aiActor.BaseMovementSpeed *= 1.1f; // aiActor.MovementSpeed *= 1.1f; } else if (targetHealthHaver != null && !onlyDoRescale) { target.BaseMovementSpeed *= 1.15f; target.MovementSpeed *= 1.15f; if (targetHealthHaver != null) { targetHealthHaver.SetHealthMaximum(targetHealthHaver.GetMaxHealth() / 2f, null, false); } } target.OverrideDisplayName = ("Tiny " + target.GetActorName()); } else if (isBigEnemy && targetHealthHaver != null && !onlyDoRescale) { if (!target.IsFlying && !targetHealthHaver.IsBoss && !ChaosLists.OverrideFallIntoPitsList.Contains(target.EnemyGuid)) { target.PreventFallingInPitsEver = true; } if (targetHealthHaver.IsBoss) { targetHealthHaver.SetHealthMaximum(targetHealthHaver.GetMaxHealth() * 1.2f, null, false); // aiActor.BaseMovementSpeed *= 0.8f; // aiActor.MovementSpeed *= 0.8f; } else { target.BaseMovementSpeed /= 1.25f; target.MovementSpeed /= 1.25f; targetHealthHaver.SetHealthMaximum(targetHealthHaver.GetMaxHealth() * 1.5f, null, false); } target.OverrideDisplayName = ("Big " + target.GetActorName()); } } Vector2 startScale = target.EnemyScale; float elapsed = 0f; float ShrinkTime = 0.5f; while (elapsed < ShrinkTime) { elapsed += BraveTime.DeltaTime; target.EnemyScale = Vector2.Lerp(startScale, ScaleValue, elapsed / ShrinkTime); if (target.specRigidbody) { target.specRigidbody.UpdateCollidersOnScale = true; target.specRigidbody.RegenerateColliders = true; } yield return(null); } yield return(new WaitForSeconds(1.5f)); ChaosUtility.CorrectForWalls(target); /*if (target.CorpseObject != null) { * target.CorpseObject.transform.localScale = ScaleValue.ToVector3ZUp(1f); * int cachedCorpseLayer = target.CorpseObject.layer; * int cachedCorpseOutlineLayer = cachedCorpseLayer; * target.CorpseObject.layer = LayerMask.NameToLayer("CorpseUnpixelated"); * cachedCorpseOutlineLayer = SpriteOutlineManager.ChangeOutlineLayer(target.CorpseObject.GetComponentInChildren<tk2dBaseSprite>(), LayerMask.NameToLayer("CorpseUnpixelated")); * }*/ yield break; }
protected override void OnPreCollision(SpeculativeRigidbody myRigidbody, PixelCollider myCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherCollider) { if (otherRigidbody != null && otherRigidbody.aiActor != null && BadGuids.Contains(otherRigidbody.aiActor.EnemyGuid)) { GameManager.Instance.StartCoroutine(this.HandleEnemyDeath(otherRigidbody.aiActor)); } else if (otherRigidbody != null && otherRigidbody.aiActor != null && GoodGuids.Contains(otherRigidbody.aiActor.EnemyGuid)) { tk2dBaseSprite sprite = Instantiate(NotSmiteVFX, otherRigidbody.aiActor.CenterPosition, Quaternion.identity).GetComponent <tk2dBaseSprite>(); sprite.HeightOffGround = 20f; sprite.UpdateZDepth(); string guid = otherRigidbody.aiActor.EnemyGuid; Vector2 pos = otherRigidbody.transform.position; bool isBlackPhantom = otherRigidbody.aiActor.IsBlackPhantom; otherRigidbody.aiActor.EraseFromExistence(true); AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); GameObject gameObject = Instantiate(orLoadByGuid.gameObject, pos, Quaternion.identity); CompanionController orAddComponent = gameObject.GetOrAddComponent <CompanionController>(); if (isBlackPhantom) { gameObject.GetComponent <AIActor>().BecomeBlackPhantom(); } orAddComponent.companionID = CompanionController.CompanionIdentifier.NONE; orAddComponent.Initialize(this.Owner as PlayerController); orAddComponent.behaviorSpeculator.MovementBehaviors.Add(new CompanionFollowPlayerBehavior()); AIActor aiactor = gameObject.GetComponent <AIActor>(); if (orAddComponent.healthHaver != null) { orAddComponent.healthHaver.PreventAllDamage = true; } if (orAddComponent.bulletBank != null) { orAddComponent.bulletBank.OnProjectileCreated += PokeballItem.CatchProjectileBehaviour.OnPostProcessProjectile; } if (orAddComponent.aiShooter != null) { orAddComponent.aiShooter.PostProcessProjectile += PokeballItem.CatchProjectileBehaviour.OnPostProcessProjectile; } List <Tuple <int, MirrorImageBehavior> > toReplace = new List <Tuple <int, MirrorImageBehavior> >(); Dictionary <int, Dictionary <int, MirrorImageBehavior> > toReplace2 = new Dictionary <int, Dictionary <int, MirrorImageBehavior> >(); int i = 0; ETGModConsole.Log("ADDING..."); foreach (AttackBehaviorBase behav in aiactor.behaviorSpeculator.AttackBehaviors) { ETGModConsole.Log(behav.GetType().ToString()); if (behav is MirrorImageBehavior) { toReplace.Add(new Tuple <int, MirrorImageBehavior>(i, behav as MirrorImageBehavior)); ETGModConsole.Log("ADDED A MIRRORIMAGEBEHAVIOUR WITH AN INDEX " + i); } else if (behav is AttackBehaviorGroup) { Dictionary <int, MirrorImageBehavior> list = new Dictionary <int, MirrorImageBehavior>(); int j = 0; foreach (AttackBehaviorGroup.AttackGroupItem item in (behav as AttackBehaviorGroup).AttackBehaviors) { if (item.Behavior is MirrorImageBehavior) { list.Add(j, item.Behavior as MirrorImageBehavior); } j++; } toReplace2.Add(i, list); ETGModConsole.Log("ADDED SOMETHING COMPLEX WITH AN INDEX " + i); } i++; } ETGModConsole.Log("REPLACING..."); foreach (Tuple <int, MirrorImageBehavior> tuple in toReplace) { aiactor.behaviorSpeculator.AttackBehaviors[tuple.First] = new FriendlyMirrorImageBehavior { NumImages = tuple.Second.NumImages, MaxImages = tuple.Second.MaxImages, MirrorHealth = tuple.Second.MirrorHealth, SpawnDelay = tuple.Second.SpawnDelay, SplitDelay = tuple.Second.SplitDelay, SplitDistance = tuple.Second.SplitDistance, Anim = tuple.Second.Anim, AnimRequiresTransparency = tuple.Second.AnimRequiresTransparency, MirrorDeathAnim = tuple.Second.MirrorDeathAnim, MirroredAnims = tuple.Second.MirroredAnims, AccumulateHealthThresholds = tuple.Second.AccumulateHealthThresholds, AttackCooldown = tuple.Second.AttackCooldown, Cooldown = tuple.Second.Cooldown, CooldownVariance = tuple.Second.CooldownVariance, GlobalCooldown = tuple.Second.GlobalCooldown, GroupCooldown = tuple.Second.GroupCooldown, GroupName = tuple.Second.GroupName, HealthThresholds = tuple.Second.HealthThresholds, InitialCooldown = tuple.Second.InitialCooldown, InitialCooldownVariance = tuple.Second.InitialCooldownVariance, IsBlackPhantom = tuple.Second.IsBlackPhantom, MaxEnemiesInRoom = tuple.Second.MaxEnemiesInRoom, MaxHealthThreshold = tuple.Second.MaxHealthThreshold, MaxUsages = tuple.Second.MaxUsages, MinHealthThreshold = tuple.Second.MinHealthThreshold, MinRange = tuple.Second.MinRange, MinWallDistance = tuple.Second.MinWallDistance, Range = tuple.Second.Range, RequiresLineOfSight = tuple.Second.RequiresLineOfSight, resetCooldownOnDamage = tuple.Second.resetCooldownOnDamage, targetAreaStyle = tuple.Second.targetAreaStyle }; ETGModConsole.Log("REPLACED ATTACK BEHAVIOUR #" + tuple.First + " WITH A FRIENDLYMIRRORIMAGEBEHAVIOUR."); } foreach (KeyValuePair <int, Dictionary <int, MirrorImageBehavior> > valuePair in toReplace2) { foreach (KeyValuePair <int, MirrorImageBehavior> valuePair2 in valuePair.Value) { (aiactor.behaviorSpeculator.AttackBehaviors[valuePair.Key] as AttackBehaviorGroup).AttackBehaviors[valuePair2.Key].Behavior = new FriendlyMirrorImageBehavior { NumImages = valuePair2.Value.NumImages, MaxImages = valuePair2.Value.MaxImages, MirrorHealth = valuePair2.Value.MirrorHealth, SpawnDelay = valuePair2.Value.SpawnDelay, SplitDelay = valuePair2.Value.SplitDelay, SplitDistance = valuePair2.Value.SplitDistance, Anim = valuePair2.Value.Anim, AnimRequiresTransparency = valuePair2.Value.AnimRequiresTransparency, MirrorDeathAnim = valuePair2.Value.MirrorDeathAnim, MirroredAnims = valuePair2.Value.MirroredAnims, AccumulateHealthThresholds = valuePair2.Value.AccumulateHealthThresholds, AttackCooldown = valuePair2.Value.AttackCooldown, Cooldown = valuePair2.Value.Cooldown, CooldownVariance = valuePair2.Value.CooldownVariance, GlobalCooldown = valuePair2.Value.GlobalCooldown, GroupCooldown = valuePair2.Value.GroupCooldown, GroupName = valuePair2.Value.GroupName, HealthThresholds = valuePair2.Value.HealthThresholds, InitialCooldown = valuePair2.Value.InitialCooldown, InitialCooldownVariance = valuePair2.Value.InitialCooldownVariance, IsBlackPhantom = valuePair2.Value.IsBlackPhantom, MaxEnemiesInRoom = valuePair2.Value.MaxEnemiesInRoom, MaxHealthThreshold = valuePair2.Value.MaxHealthThreshold, MaxUsages = valuePair2.Value.MaxUsages, MinHealthThreshold = valuePair2.Value.MinHealthThreshold, MinRange = valuePair2.Value.MinRange, MinWallDistance = valuePair2.Value.MinWallDistance, Range = valuePair2.Value.Range, RequiresLineOfSight = valuePair2.Value.RequiresLineOfSight, resetCooldownOnDamage = valuePair2.Value.resetCooldownOnDamage, targetAreaStyle = valuePair2.Value.targetAreaStyle }; } } AdditionalCompanionOwner additionalCompanionOwner = this.Owner.gameObject.AddComponent <AdditionalCompanionOwner>(); additionalCompanionOwner.CompanionGuid = guid; additionalCompanionOwner.IsBlackPhantom = isBlackPhantom; PhysicsEngine.SkipCollision = true; return; } base.OnPreCollision(myRigidbody, myCollider, otherRigidbody, otherCollider); }
public void ChaosResizeEnemy(AIActor aiActor, bool delayed = false) { // AIActor targetAIActor = aiActor.gameObject.GetComponent<AIActor>(); if (!ChaosConsole.randomEnemySizeEnabled) { return; } if (string.IsNullOrEmpty(aiActor.EnemyGuid)) { return; } if (aiActor.name.ToLower().StartsWith("glitched") | aiActor.name.ToLower().EndsWith("(clone)(clone)")) { return; } if (ChaosLists.BannedEnemyGUIDList.Contains(aiActor.EnemyGuid)) { return; } if (!ChaosConsole.randomEnemySizeEnabled) { return; } if (aiActor.GetComponentInParent <BossStatueController>() != null) { return; } try { if (aiActor.transform.position.GetAbsoluteRoom().GetRoomName().ToLower().StartsWith("doublebeholsterroom01")) { return; } } catch (System.Exception) { return; } int currentFloor = GameManager.Instance.CurrentFloor; // Vector2 currentCorpseScale = new Vector2(1, 1); if (currentFloor == -1) { ChaosConsole.RandomResizedEnemies = 0.45f; } else { if (currentFloor > 2 && currentFloor < 5) { ChaosConsole.RandomResizedEnemies = 0.45f; } else { if (currentFloor > 4 && currentFloor < 6) { ChaosConsole.RandomResizedEnemies = 0.47f; } else { if (currentFloor > 5) { ChaosConsole.RandomResizedEnemies = 0.6f; } } } } if (Random.value >= ChaosConsole.RandomResizedEnemies) { return; } if (Random.value <= ChaosConsole.RandomSizeChooser) { // Make them tiny bois :P // Don't make cursed bois tiny. It can be a bit much to get hurt by tiny bois that are cursed. :P if (aiActor.IsBlackPhantom) { aiActor.StartCoroutine(ResizeEnemy(aiActor, new Vector2(1.5f, 1.5f), false, true, delayed)); } else { aiActor.StartCoroutine(ResizeEnemy(aiActor, new Vector2(0.5f, 0.5f), false, false, delayed)); // targetAIActor.CollisionKnockbackStrength /= 2f; } } else { // Make them big bois :P aiActor.StartCoroutine(ResizeEnemy(aiActor, new Vector2(1.5f, 1.5f), false, delayed)); // targetAIActor.CollisionKnockbackStrength *= 1.5f; } aiActor.placeableWidth += 2; aiActor.placeableHeight += 2; return; }
public void rezroom(PlayerController player) { for (int i = 0; i < StaticReferenceManager.AllCorpses.Count; i++) { GameObject gameObject = StaticReferenceManager.AllCorpses[i]; if (gameObject && gameObject.GetComponent <tk2dBaseSprite>() && gameObject.transform.position.GetAbsoluteRoom() == player.CurrentRoom) { int spawntype = rng.Next(1, 5); if (spawntype == 1) { //tombstoner string guid; if (player) { guid = "cf27dd464a504a428d87a8b2560ad40a"; } else { guid = "cf27dd464a504a428d87a8b2560ad40a"; } AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2?intVector = new IntVector2?(player.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = true; aiactor.CanTargetPlayers = false; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.gameObject.AddComponent <KillOnRoomClear>(); aiactor.IsHarmlessEnemy = true; aiactor.CompanionOwner = player; aiactor.CanDropCurrency = false; aiactor.IsNormalEnemy = true; aiactor.isPassable = true; aiactor.IgnoreForRoomClear = true; aiactor.reinforceType = AIActor.ReinforceType.Instant; aiactor.HandleReinforcementFallIntoRoom(0f); } if (spawntype == 2) { //skullmet string guid; if (player) { guid = "95ec774b5a75467a9ab05fa230c0c143"; } else { guid = "95ec774b5a75467a9ab05fa230c0c143"; } AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2?intVector = new IntVector2?(player.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = true; aiactor.CanTargetPlayers = false; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.gameObject.AddComponent <KillOnRoomClear>(); aiactor.IsHarmlessEnemy = true; aiactor.CompanionOwner = player; aiactor.CanDropCurrency = false; aiactor.IsNormalEnemy = true; aiactor.isPassable = true; aiactor.IgnoreForRoomClear = true; aiactor.reinforceType = AIActor.ReinforceType.Instant; aiactor.HandleReinforcementFallIntoRoom(0f); } if (spawntype == 3) { //skullet string guid; if (player) { guid = "336190e29e8a4f75ab7486595b700d4a"; } else { guid = "336190e29e8a4f75ab7486595b700d4a"; } AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2?intVector = new IntVector2?(player.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = true; aiactor.CanTargetPlayers = false; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.gameObject.AddComponent <KillOnRoomClear>(); aiactor.IsHarmlessEnemy = true; aiactor.CompanionOwner = player; aiactor.CanDropCurrency = false; aiactor.IsNormalEnemy = true; aiactor.isPassable = true; aiactor.IgnoreForRoomClear = true; aiactor.reinforceType = AIActor.ReinforceType.Instant; aiactor.HandleReinforcementFallIntoRoom(0f); } if (spawntype == 4) { //skulet string guid; if (player) { guid = "336190e29e8a4f75ab7486595b700d4a"; } else { guid = "336190e29e8a4f75ab7486595b700d4a"; } AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2?intVector = new IntVector2?(player.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = true; aiactor.CanTargetPlayers = false; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.gameObject.AddComponent <KillOnRoomClear>(); aiactor.IsHarmlessEnemy = true; aiactor.CompanionOwner = player; aiactor.CanDropCurrency = false; aiactor.IsNormalEnemy = true; aiactor.isPassable = true; aiactor.IgnoreForRoomClear = true; aiactor.reinforceType = AIActor.ReinforceType.Instant; aiactor.HandleReinforcementFallIntoRoom(0f); } if (spawntype == 5) { //hollowpoint string guid; if (player) { guid = "4db03291a12144d69fe940d5a01de376"; } else { guid = "4db03291a12144d69fe940d5a01de376"; } AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2?intVector = new IntVector2?(player.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = true; aiactor.CanTargetPlayers = false; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.gameObject.AddComponent <KillOnRoomClear>(); aiactor.IsHarmlessEnemy = true; aiactor.CompanionOwner = player; aiactor.CanDropCurrency = false; aiactor.IsNormalEnemy = true; aiactor.isPassable = true; aiactor.IgnoreForRoomClear = true; aiactor.reinforceType = AIActor.ReinforceType.Instant; aiactor.HandleReinforcementFallIntoRoom(0f); } } } }
private IEnumerator HandlePlayerWalkIn(PlayerController interactor) { interactor.SetInputOverride("walking"); interactor.usingForcedInput = true; interactor.ForceIdleFacePoint(this.sprite.WorldCenter - interactor.sprite.WorldBottomCenter, false); while (Vector2.Distance(interactor.sprite.WorldBottomCenter, this.sprite.WorldCenter) > 0.2f) { float num2 = 1f; if (!interactor.IsInCombat && GameManager.Options.IncreaseSpeedOutOfCombat) { bool flag = true; List <AIActor> allEnemies = StaticReferenceManager.AllEnemies; if (allEnemies != null) { for (int l = 0; l < allEnemies.Count; l++) { AIActor aiactor = allEnemies[l]; if (aiactor && aiactor.IsMimicEnemy && !aiactor.IsGone) { float num3 = Vector2.Distance(aiactor.CenterPosition, interactor.CenterPosition); if (num3 < 40f) { flag = false; break; } } } } if (flag) { num2 *= 1.5f; } } interactor.forcedInput = Vector2.Lerp(interactor.forcedInput, (this.sprite.WorldCenter - interactor.sprite.WorldBottomCenter), 0.1f) / num2; interactor.ForceStaticFaceDirection(interactor.forcedInput); yield return(null); } interactor.usingForcedInput = false; interactor.forcedInput = Vector2.zero; interactor.specRigidbody.Velocity = Vector2.zero; float ela = 0f; while (ela < 1f) { ela += BraveTime.DeltaTime; yield return(null); } FieldInfo info = typeof(PlayerController).GetField("m_handlingQueuedAnimation", BindingFlags.NonPublic | BindingFlags.Instance); info.SetValue(interactor, true); interactor.ToggleGunRenderers(false, "carpet"); interactor.ToggleHandRenderers(false, "carpet"); string anim = (!interactor.UseArmorlessAnim) ? "death_shot" : "death_shot_armorless"; interactor.spriteAnimator.Play(anim); while (interactor.spriteAnimator.IsPlaying(anim)) { yield return(null); } info.SetValue(interactor, true); tk2dSpriteAnimationClip clip = interactor.spriteAnimator.GetClipByName(anim); interactor.spriteAnimator.Stop(); interactor.sprite.SetSprite(clip.frames[clip.frames.Length - 1].spriteCollection, clip.frames[clip.frames.Length - 1].spriteId); interactor.ClearInputOverride("walking"); interactor.CurrentInputState = PlayerInputState.OnlyMovement; float healingTimer = 0.75f; while (interactor.specRigidbody.Velocity.magnitude < 0.05f) { if (!this.theCarpetIsntThatComfortableAnymore) { if (interactor.healthHaver.GetCurrentHealthPercentage() < 1f) { healingTimer -= BraveTime.DeltaTime; } if (healingTimer <= 0f) { interactor.healthHaver.ApplyHealing(0.5f); AkSoundEngine.PostEvent("Play_OBJ_heart_heal_01", base.gameObject); interactor.PlayEffectOnActor(ResourceCache.Acquire("Global VFX/VFX_Healing_Sparkles_001") as GameObject, Vector3.zero, true, false, false); healingTimer = 0.75f; } if (interactor.CurrentItem != null) { if (interactor.CurrentItem.IsOnCooldown) { if (interactor.CurrentItem.damageCooldown > 0) { interactor.CurrentItem.CurrentDamageCooldown = Mathf.Max(interactor.CurrentItem.CurrentDamageCooldown - 1f, 0f); } } } } yield return(null); } interactor.CurrentInputState = PlayerInputState.AllInput; interactor.ToggleGunRenderers(true, "carpet"); interactor.ToggleHandRenderers(true, "carpet"); info.SetValue(interactor, false); this.theCarpetIsntThatComfortableAnymore = true; yield break; }
// Token: 0x0600011C RID: 284 RVA: 0x0000A9F9 File Offset: 0x00008BF9 public override void Init(GameObject gameObject, AIActor aiActor, AIShooter aiShooter) { base.Init(gameObject, aiActor, aiShooter); this.Owner = this.m_aiActor.GetComponent <BabyGoodChamber.PenguinBehavior>().Owner; }
//SYNERGY WITH SPARE KEY --> "Spare Keybullet Kin" private void OnEnemyDamaged(float damage, bool fatal, HealthHaver enemy) { try { if (enemy.aiActor && enemy) { if (fatal && Owner.HasPickupID(71)) { if (UnityEngine.Random.value < 0.1f) { SpawnObjectPlayerItem bigbombPrefab = PickupObjectDatabase.GetById(71).GetComponent <SpawnObjectPlayerItem>(); GameObject bigbombObject = bigbombPrefab.objectToSpawn.gameObject; GameObject bigbombObject2 = UnityEngine.Object.Instantiate <GameObject>(bigbombObject, enemy.sprite.WorldBottomCenter, Quaternion.identity); tk2dBaseSprite bombsprite = bigbombObject2.GetComponent <tk2dBaseSprite>(); if (bombsprite) { bombsprite.PlaceAtPositionByAnchor(enemy.sprite.WorldBottomCenter, tk2dBaseSprite.Anchor.MiddleCenter); } } } float outcomeDamage = damage; if (Owner.HasPickupID(442)) { outcomeDamage *= 2; } RoomHandler absoluteRoom = base.transform.position.GetAbsoluteRoom(); List <AIActor> enemiesInRoom = new List <AIActor>(); if (absoluteRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear) != null) { foreach (AIActor m_Enemy in absoluteRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear)) { enemiesInRoom.Add(m_Enemy); } } AIActor randomActiveEnemy = null; AIActor randomActiveOTHEREnemy = null; if (enemiesInRoom.Count > 1) { enemiesInRoom.Remove(enemy.aiActor); randomActiveEnemy = BraveUtility.RandomElement(enemiesInRoom); if (enemiesInRoom.Count > 2 && (Owner.HasPickupID(276) || Owner.HasPickupID(149) || Owner.HasPickupID(482) || Owner.HasPickupID(506) || Owner.HasPickupID(172) || Owner.HasPickupID(198) || Owner.HasPickupID(Gungeon.Game.Items["nn:spectre_bullets"].PickupObjectId))) { enemiesInRoom.Remove(randomActiveEnemy); randomActiveOTHEREnemy = BraveUtility.RandomElement(enemiesInRoom); } } if (randomActiveEnemy != null && randomActiveEnemy != enemy.aiActor && randomActiveEnemy.healthHaver && randomActiveEnemy.healthHaver.IsAlive && randomActiveEnemy.healthHaver.IsVulnerable) { if (OnCooldownVoodoo == false) { OnCooldownVoodoo = true; if (Owner.HasPickupID(527) && UnityEngine.Random.value < 0.25f) { randomActiveEnemy.gameActor.ApplyEffect(this.charmEffect, 1f, null); } randomActiveEnemy.healthHaver.ApplyDamage(outcomeDamage, Vector2.zero, "Voodoo Magic", CoreDamageTypes.None, DamageCategory.Normal, true, null, false); if ((Owner.HasPickupID(276) || Owner.HasPickupID(149) || Owner.HasPickupID(482) || Owner.HasPickupID(506) || Owner.HasPickupID(172) || Owner.HasPickupID(198) || Owner.HasPickupID(Gungeon.Game.Items["nn:spectre_bullets"].PickupObjectId)) && randomActiveOTHEREnemy != null && randomActiveOTHEREnemy != enemy.aiActor && randomActiveOTHEREnemy.healthHaver && randomActiveOTHEREnemy.healthHaver.IsAlive && randomActiveOTHEREnemy.healthHaver.IsVulnerable) { if (Owner.HasPickupID(527) && UnityEngine.Random.value < 0.25f) { randomActiveOTHEREnemy.gameActor.ApplyEffect(this.charmEffect, 1f, null); } randomActiveOTHEREnemy.healthHaver.ApplyDamage(outcomeDamage, Vector2.zero, "Voodoo Magic", CoreDamageTypes.None, DamageCategory.Normal, true, null, false); } Invoke("Cooldown", 0.01f); } } } } catch (Exception e) { ETGModConsole.Log(e.Message); ETGModConsole.Log(e.StackTrace); ETGModConsole.Log("IF YOU SEE THIS PLEASE REPORT IT TO NEVERNAMED (WITH SCREENSHOTS)"); } }
protected virtual void OnPickedUpByEnemy(AIActor enemy) { }
public static AIActor SummonAtRandomPosition(string guid, PlayerController owner) { AIActor aiactor = AIActor.Spawn(EnemyDatabase.GetOrLoadByGuid(guid), new IntVector2?(owner.CurrentRoom.GetRandomVisibleClearSpot(1, 1)).Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(new IntVector2?(owner.CurrentRoom.GetRandomVisibleClearSpot(1, 1)).Value), true, AIActor.AwakenAnimationType.Awaken, true); return(aiactor); }
protected virtual void OnPostDroppedByEnemy(AIActor enemy) { }
public IEnumerator HandleClockhair(AIActor targetEnemy, PlayerController user) { RadialSlowInterface Rad; Rad = new RadialSlowInterface { RadialSlowHoldTime = 6f, RadialSlowOutTime = 2f, RadialSlowTimeModifier = 0f, DoesSepia = false, UpdatesForNewEnemies = true, audioEvent = "Play_OBJ_time_bell_01", }; Rad.DoRadialSlow(user.CenterPosition, user.CurrentRoom); user.healthHaver.IsVulnerable = false; user.SetInputOverride("tiddy"); Pixelator.Instance.DoFinalNonFadedLayer = false; Transform clockhairTransform = ((GameObject)Instantiate(BraveResources.Load("Clockhair", ".prefab"))).transform; ClockhairController clockhair = clockhairTransform.GetComponent <ClockhairController>(); // clockhair.gameObject.SetLayerRecursively(LayerMask.NameToLayer("Unpixelated")); float elapsed = 0f; float duration = clockhair.ClockhairInDuration; Vector3 clockhairTargetPosition = targetEnemy.CenterPosition; Vector3 clockhairStartPosition = clockhairTargetPosition + new Vector3(-20f, 5f, 0f); clockhair.renderer.enabled = true; clockhair.spriteAnimator.alwaysUpdateOffscreen = true; clockhair.spriteAnimator.Play("clockhair_intro"); clockhair.hourAnimator.Play("hour_hand_intro"); clockhair.minuteAnimator.Play("minute_hand_intro"); clockhair.secondAnimator.Play("second_hand_intro"); while (elapsed < duration) { if (GameManager.INVARIANT_DELTA_TIME == 0f) { elapsed += 0.05f; } elapsed += GameManager.INVARIANT_DELTA_TIME; float t = elapsed / duration; float smoothT = Mathf.SmoothStep(0f, 1f, t); clockhairTargetPosition = targetEnemy.CenterPosition; Vector3 currentPosition = Vector3.Slerp(clockhairStartPosition, clockhairTargetPosition, smoothT); clockhairTransform.position = currentPosition.WithZ(0f); if (t > 0.5f) { clockhair.renderer.enabled = true; } if (t > 0.75f) { clockhair.hourAnimator.GetComponent <Renderer>().enabled = true; clockhair.minuteAnimator.GetComponent <Renderer>().enabled = true; clockhair.secondAnimator.GetComponent <Renderer>().enabled = true; } clockhair.sprite.UpdateZDepth(); yield return(null); } clockhair.SetMotionType(1f); float dur = 2; elapsed = 0; clockhair.BeginSpinningWildly(); while (elapsed < dur) { if (GameManager.INVARIANT_DELTA_TIME == 0f) { elapsed += 0.05f; } elapsed += GameManager.INVARIANT_DELTA_TIME; clockhairTransform.position = targetEnemy.CenterPosition; yield return(null); } AkSoundEngine.PostEvent("Play_ENV_time_shatter_01", gameObject); targetEnemy.healthHaver.ApplyDamage(10000, Vector2.zero, "die", CoreDamageTypes.None, DamageCategory.Normal, false, null, true); yield return(new WaitForSeconds(.2f)); Destroy(clockhairTransform.gameObject); user.ClearInputOverride("tiddy"); user.healthHaver.IsVulnerable = true; yield break; }