private void SpawnWave()
 {
     CurrentWave++;
     if (CurrentWave < waves.Count)
     {
         foreach (string guid in waves[CurrentWave])
         {
             AIActor    prefab  = EnemyDatabase.GetOrLoadByGuid(guid);
             IntVector2?vector  = this.GetAbsoluteParentRoom().GetRandomAvailableCell(prefab.Clearance, new CellTypes?(CellTypes.FLOOR | CellTypes.PIT), false, null);
             AIActor    aiactor = AIActor.Spawn(prefab, vector != null ? vector.Value : this.GetAbsoluteParentRoom().GetBestRewardLocation(prefab.Clearance, RoomHandler.RewardLocationStyle.Original, false), this.GetAbsoluteParentRoom(), false, AIActor.AwakenAnimationType.Default,
                                                true);
             aiactor.SetIsFlying(true, "because why not", false, true);
             aiactor.encounterTrackable.journalData.PrimaryDisplayName = "#ENEMY_PRIMALASPIDS_REVENGE";
             this.GetAbsoluteParentRoom().SealRoom();
         }
     }
     else
     {
         SpawnManager.SpawnVFX(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultExplosionData.effect, this.statue.GetComponent <tk2dBaseSprite>().WorldBottomCenter, Quaternion.identity);
         AkSoundEngine.PostEvent("Play_WPN_grenade_blast_01", base.gameObject);
         this.statue.GetComponent <tk2dBaseSprite>().renderer.enabled = false;
         Chest      chest  = GameManager.Instance.RewardManager.Rainbow_Chest;
         IntVector2?vector = this.GetAbsoluteParentRoom().GetRandomAvailableCell(new IntVector2?(IntVector2.One * 4), new CellTypes?(CellTypes.FLOOR | CellTypes.PIT), false, null);
         Chest.Spawn(chest, vector != null ? vector.Value : this.GetAbsoluteParentRoom().GetBestRewardLocation(IntVector2.One * 4, RoomHandler.RewardLocationStyle.Original, false), this.GetAbsoluteParentRoom(), true);
         this.IsActive   = false;
         this.DeclineKey = "#SHRINE_ASPID_DECLINE_SPENT";
     }
 }
Beispiel #2
0
        public static void SpectreBehav()
        {
            Gun cached_poison = PickupObjectDatabase.GetById(208) as Gun;

            Spectre     = EnemyDatabase.GetOrLoadByGuid("56f5a0f2c1fc4bc78875aea617ee31ac");
            HollowPoint = EnemyDatabase.GetOrLoadByGuid("4db03291a12144d69fe940d5a01de376");
            AIShooter SpecShoot = Spectre.gameObject.AddComponent <AIShooter>();

            Spectre.gameObject.GetComponent <AIShooter>().gunAttachPoint.localPosition += new Vector3(0, 0.2f, 0);
            GameObject targetPoison = Spectre.gameObject;

            Spectre.behaviorSpeculator.AttackBehaviors.Remove(Spectre.behaviorSpeculator.AttackBehaviors[1]);
            Spectre.behaviorSpeculator.AttackBehaviors.Add(HollowPoint.behaviorSpeculator.AttackBehaviors[1]);
            Spectre.CollisionDamage = .5f;
            Spectre.SetIsFlying(true, "ghost", true, true);
            var actor = Spectre.gameActor;

            actor.EffectResistances = new ActorEffectResistance[]
            {
                new ActorEffectResistance()
                {
                    resistAmount = 1,
                    resistType   = EffectResistanceType.Poison
                }
            };

            Spectre.healthHaver.SetHealthMaximum(30);
            Spectre.healthHaver.ForceSetCurrentHealth(30);



            if (cached_poison)
            {
                GoopDoer Gooper = targetPoison.AddComponent <GoopDoer>();
                Gooper.goopDefinition         = cached_poison.singleModule.projectiles[0].gameObject.GetComponent <GoopModifier>().goopDefinition;
                Gooper.positionSource         = GoopDoer.PositionSource.HitBoxCenter;
                Gooper.updateTiming           = GoopDoer.UpdateTiming.Always;
                Gooper.updateFrequency        = 0.05f;
                Gooper.isTimed                = false;
                Gooper.goopTime               = 1;
                Gooper.updateOnDeath          = false;
                Gooper.updateOnPreDeath       = false;
                Gooper.updateOnAnimFrames     = false;
                Gooper.updateOnCollision      = false;
                Gooper.updateOnGrounded       = false;
                Gooper.updateOnDestroy        = false;
                Gooper.defaultGoopRadius      = 1.2f;
                Gooper.suppressSplashes       = false;
                Gooper.goopSizeVaries         = false;
                Gooper.varyCycleTime          = 0.9f;
                Gooper.radiusMax              = 1.2f;
                Gooper.radiusMin              = 1.2f;
                Gooper.goopSizeRandom         = false;
                Gooper.UsesDispersalParticles = false;
                Gooper.DispersalDensity       = 3;
                Gooper.DispersalMinCoherency  = 0.2f;
                Gooper.DispersalMaxCoherency  = 1;
            }
        }
Beispiel #3
0
        public static void InitButterflyPrefab()
        {
            AIActor       aiactor  = SetupAIActorDummy("Butterfly", new IntVector2(0, 0), new IntVector2(10, 10));
            List <string> leftAnim = new List <string>
            {
                "SpecialItemPack/Resources/Butterfly/butterfly_idle_left_001",
                "SpecialItemPack/Resources/Butterfly/butterfly_idle_left_002",
                "SpecialItemPack/Resources/Butterfly/butterfly_idle_left_003"
            };
            List <string> rightAnim = new List <string>
            {
                "SpecialItemPack/Resources/Butterfly/butterfly_idle_left_001",
                "SpecialItemPack/Resources/Butterfly/butterfly_idle_left_002",
                "SpecialItemPack/Resources/Butterfly/butterfly_idle_left_003"
            };

            GenerateSpriteAnimator(aiactor.gameObject, null, 0, 0, playAutomatically: true, clipTime: 0, ClipFps: 0);
            tk2dSpriteAnimator spriteAnim = aiactor.gameObject.GetComponent <tk2dSpriteAnimator>();

            spriteAnim.playAutomatically = true;
            spriteAnim.Library           = aiactor.gameObject.AddComponent <tk2dSpriteAnimation>();
            spriteAnim.Library.clips     = new tk2dSpriteAnimationClip[0];
            spriteAnim.DefaultClipId     = 0;
            tk2dSpriteAnimationClip leftClip = new tk2dSpriteAnimationClip {
                fps = 5, frames = new tk2dSpriteAnimationFrame[0], name = "idle_left"
            };

            foreach (string path in leftAnim)
            {
                int id = SpriteBuilder.AddSpriteToCollection(path, SpriteBuilder.itemCollection);
                tk2dSpriteAnimationFrame frame = new tk2dSpriteAnimationFrame {
                    spriteId = id, spriteCollection = SpriteBuilder.itemCollection
                };
                leftClip.frames = leftClip.frames.Concat(new tk2dSpriteAnimationFrame[] { frame }).ToArray();
            }
            aiactor.sprite.SetSprite(leftClip.frames[0].spriteCollection, leftClip.frames[0].spriteId);
            spriteAnim.Library.clips = spriteAnim.Library.clips.Concat(new tk2dSpriteAnimationClip[] { leftClip }).ToArray();
            tk2dSpriteAnimationClip rightClip = new tk2dSpriteAnimationClip {
                fps = 5, frames = new tk2dSpriteAnimationFrame[0], name = "idle_right"
            };

            foreach (string path in rightAnim)
            {
                int id = SpriteBuilder.AddSpriteToCollection(path, SpriteBuilder.itemCollection);
                tk2dSpriteAnimationFrame frame = new tk2dSpriteAnimationFrame {
                    spriteId = id, spriteCollection = SpriteBuilder.itemCollection
                };
                rightClip.frames = rightClip.frames.Concat(new tk2dSpriteAnimationFrame[] { frame }).ToArray();
            }
            spriteAnim.Library.clips = spriteAnim.Library.clips.Concat(new tk2dSpriteAnimationClip[] { rightClip }).ToArray();
            AIAnimator aiAnim = GenerateBlankAIAnimator(aiactor.gameObject);

            aiAnim.aiAnimator.facingType            = AIAnimator.FacingType.Default;
            aiAnim.aiAnimator.faceSouthWhenStopped  = false;
            aiAnim.aiAnimator.faceTargetWhenStopped = false;
            aiAnim.aiAnimator.HitType = AIAnimator.HitStateType.Basic;
            aiAnim.IdleAnimation      = new DirectionalAnimation
            {
                Type      = DirectionalAnimation.DirectionType.TwoWayHorizontal,
                Flipped   = new DirectionalAnimation.FlipType[2],
                AnimNames = new string[]
                {
                    "idle_right",
                    "idle_left"
                }
            };
            aiAnim.IdleAnimation = aiAnim.MoveAnimation;
            BehaviorSpeculator   chickSpec = EnemyDatabase.GetOrLoadByGuid("76bc43539fc24648bff4568c75c686d1").behaviorSpeculator;
            SpeculativeRigidbody body      = aiactor.specRigidbody;

            body.PixelColliders.RemoveAt(1);
            body.PrimaryPixelCollider.CollisionLayer = CollisionLayer.BulletBlocker;
            BehaviorSpeculator spec = aiactor.behaviorSpeculator;

            spec.OverrideBehaviors               = chickSpec.OverrideBehaviors;
            spec.OtherBehaviors                  = chickSpec.OtherBehaviors;
            spec.TargetBehaviors                 = chickSpec.TargetBehaviors;
            spec.AttackBehaviors                 = chickSpec.AttackBehaviors;
            spec.MovementBehaviors               = chickSpec.MovementBehaviors;
            spec.InstantFirstTick                = chickSpec.InstantFirstTick;
            spec.TickInterval                    = chickSpec.TickInterval;
            spec.PostAwakenDelay                 = chickSpec.PostAwakenDelay;
            spec.RemoveDelayOnReinforce          = chickSpec.RemoveDelayOnReinforce;
            spec.OverrideStartingFacingDirection = chickSpec.OverrideStartingFacingDirection;
            spec.StartingFacingDirection         = chickSpec.StartingFacingDirection;
            spec.SkipTimingDifferentiator        = chickSpec.SkipTimingDifferentiator;
            aiactor.SetIsFlying(true, "butter fly", true, true);
            Game.Enemies.Add("spapi:butterfly", aiactor);
        }
Beispiel #4
0
 public void OnPreRigidbodyCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider)
 {
     if (myRigidbody.projectile != null && myRigidbody.sprite != null && this.m_owner.PlayerHasActiveSynergy("#BE_SERIOUS"))
     {
         if (!this.m_owner.IsInCombat || this.smarterMinions.Count >= 4)
         {
             return;
         }
         AIActor    orLoadByGuid         = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5");
         IntVector2?nearestAvailableCell = null;
         if (this.m_owner.CurrentRoom != null)
         {
             nearestAvailableCell = this.m_owner.CurrentRoom.GetNearestAvailableCell(myRigidbody.projectile.sprite.WorldCenter, new IntVector2?(orLoadByGuid.Clearance), new CellTypes?(CellTypes.FLOOR), false, null);
         }
         Vector3             vector         = nearestAvailableCell != null ? (nearestAvailableCell.Value.ToVector2()).ToVector3ZUp(0f) : myRigidbody.projectile.sprite.WorldCenter.ToVector3ZUp(0f);
         GameObject          enemyObj       = UnityEngine.Object.Instantiate <GameObject>(orLoadByGuid.gameObject, vector, Quaternion.identity);
         CompanionController orAddComponent = enemyObj.GetOrAddComponent <CompanionController>();
         orAddComponent.companionID = CompanionController.CompanionIdentifier.NONE;
         orAddComponent.Initialize(this.m_owner);
         orAddComponent.behaviorSpeculator.MovementBehaviors.Add(new CompanionFollowPlayerBehavior());
         AIActor aiactor = enemyObj.GetComponent <AIActor>();
         aiactor.HitByEnemyBullets         = true;
         aiactor.healthHaver.ModifyDamage += this.ModifyDamageForCompanions;
         aiactor.StartCoroutine(this.InvisibleCoroutine(aiactor));
         aiactor.procedurallyOutlined = false;
         aiactor.CorpseObject         = null;
         aiactor.ImmuneToAllEffects   = true;
         aiactor.SetIsFlying(true, "I'm a bullet too!");
         SmarterDumbEnemyBehavior smartBehavior = aiactor.gameObject.AddComponent <SmarterDumbEnemyBehavior>();
         smartBehavior.layer      = myRigidbody.projectile.gameObject.layer;
         smartBehavior.collection = myRigidbody.projectile.sprite.Collection;
         smartBehavior.spriteId   = myRigidbody.projectile.sprite.spriteId;
         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;
                 }
             }
         }
         this.smarterMinions.Add(aiactor);
     }
     else if (myRigidbody.projectile != null && myRigidbody.sprite != null)
     {
         AIActor    aiactor    = AIActor.Spawn(EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5"), myRigidbody.projectile.sprite.WorldCenter, myRigidbody.transform.position.GetAbsoluteRoom(), true, AIActor.AwakenAnimationType.Default, true);
         GameObject gameObject = new GameObject("suck image");
         gameObject.layer = myRigidbody.projectile.gameObject.layer;
         tk2dSprite tk2dSprite = gameObject.AddComponent <tk2dSprite>();
         gameObject.transform.parent   = SpawnManager.Instance.Projectiles;
         gameObject.transform.position = aiactor.sprite.WorldCenter;
         tk2dSprite.SetSprite(myRigidbody.projectile.sprite.Collection, myRigidbody.projectile.sprite.spriteId);
         tk2dSprite.transform.parent     = aiactor.transform;
         aiactor.sprite.renderer.enabled = false;
         aiactor.procedurallyOutlined    = false;
         aiactor.CanTargetEnemies        = true;
         aiactor.CanTargetPlayers        = false;
         aiactor.CorpseObject            = null;
         aiactor.ImmuneToAllEffects      = true;
         aiactor.SetIsFlying(true, "I'm a bullet too!");
         aiactor.specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask(CollisionLayer.PlayerHitBox, CollisionLayer.PlayerCollider));
         if (aiactor.IgnoreForRoomClear)
         {
             aiactor.IgnoreForRoomClear = false;
             if (aiactor.ParentRoom != null)
             {
                 aiactor.ParentRoom.DeregisterEnemy(aiactor);
             }
         }
         DumbEnemyBehavior dumbEnemyBehavior = aiactor.gameObject.AddComponent <DumbEnemyBehavior>();
         if (myRigidbody.projectile.GetComponent <NewUsesProjectileSynergyController>() != null)
         {
             dumbEnemyBehavior.sourceAmmoType     = myRigidbody.projectile.GetComponent <NewUsesProjectileSynergyController>().ammoType;
             dumbEnemyBehavior.customAmmoType     = myRigidbody.projectile.GetComponent <NewUsesProjectileSynergyController>().customAmmoType;
             dumbEnemyBehavior.usesNewUsesSynergy = true;
         }
         myRigidbody.projectile.DieInAir();
     }
 }