public static GameObject CreateNewBossRoomAIActor(GameObject gameObject)
        {//turn regular enemy into boss
            AIActor bosscomponent = gameObject.GetComponent <AIActor>();

            if (bosscomponent.healthHaver.bossHealthBar == HealthHaver.BossBarType.None)
            {
                bosscomponent.healthHaver.bossHealthBar = HealthHaver.BossBarType.MainBar;


                gameObject.AddComponent <GenericIntroDoer>();

                GenericIntroDoer genericIntroDoer = gameObject.GetComponent <GenericIntroDoer>();
                genericIntroDoer.InvisibleBeforeIntroAnim = false;

                genericIntroDoer.triggerType = GenericIntroDoer.TriggerType.PlayerEnteredRoom;

                gameObject.AddComponent <SpecificIntroDoer>();
                genericIntroDoer.RegenerateCache();

                gameObject = ReinstateAIActorObjectInfo(gameObject);
            }


            return(gameObject);
        }
        public static GameObject RemoveBossIntros(GameObject bossobject)
        {   //removes boss generic and specific boss intros
            GenericIntroDoer     genericIntroDoer = bossobject.GetComponent <GenericIntroDoer>();
            CustomEngageDoer     customengage     = bossobject.GetComponent <CustomEngageDoer>();
            GatlingGullIntroDoer ggintro          = bossobject.GetComponent <GatlingGullIntroDoer>();

            if (genericIntroDoer)
            {
                SpecificIntroDoer specificintrodoer = bossobject.GetComponent <SpecificIntroDoer>();
                //MetalGearRatDeathController deathcontroller2 = bossobject.GetComponent<MetalGearRatDeathController>();


                if (specificintrodoer)
                {
                    Destroy(specificintrodoer);
                    specificintrodoer.RegenerateCache();
                }

                genericIntroDoer.InvisibleBeforeIntroAnim = false;
                Destroy(genericIntroDoer);
                genericIntroDoer.RegenerateCache();
                Destroy(customengage);
            }

            if (ggintro) //gatling gull
            {
                Destroy(ggintro);
            }

            return(bossobject);
        }
        public static void GenerateGungeoneerMimicBoss(AssetBundle expandSharedAssets1, GameObject aiActorObject, PlayerController sourcePlayer = null)
        {
            if (sourcePlayer == null)
            {
                sourcePlayer = GameManager.Instance.PrimaryPlayer;
            }
            if (sourcePlayer == null)
            {
                return;
            }

            tk2dSprite playerSprite = aiActorObject.AddComponent <tk2dSprite>();

            ExpandUtility.DuplicateSprite(playerSprite, (sourcePlayer.sprite as tk2dSprite));

            // If Player sprite was flipped (aka, player aiming/facing towards the left), then this could cause sprite being shifted left on AIActor.
            // Always set false to ensure this doesn't happen.
            playerSprite.FlipX = false;

            ExpandUtility.GenerateAIActorTemplate(aiActorObject, out m_CorpseObject, aiActorObject.name, System.Guid.NewGuid().ToString(), GunAttachOffset: new Vector3(0.3f, 0.25f, 0), StartingGunID: 472);

            AIActor CachedEnemyActor = aiActorObject.GetComponent <AIActor>();

            if (!aiActorObject | !CachedEnemyActor)
            {
                return;
            }

            if (ExpandStats.debugMode)
            {
                ETGModConsole.Log("Spawning '" + CachedEnemyActor.ActorName + "' with GUID: " + CachedEnemyActor.EnemyGuid + " .", false);
            }

            GameObject m_NewHandObject = new GameObject("PlayerMimicHand");
            tk2dSprite m_HandSprite    = m_NewHandObject.AddComponent <tk2dSprite>();

            ExpandUtility.DuplicateSprite(m_HandSprite, sourcePlayer.primaryHand.gameObject.GetComponent <tk2dSprite>());
            PlayerHandController m_HandController = m_NewHandObject.AddComponent <PlayerHandController>();

            m_HandController.ForceRenderersOff = false;
            m_HandController.handHeightFromGun = 0.05f;

            CachedEnemyActor.aiShooter.handObject = m_HandController;

            // Generate BossCard based on current Player.
            Texture2D BossCardForeground = ExpandUtility.FlipTexture(Instantiate(sourcePlayer.BosscardSprites[0]));
            // Mirror thing will be used as static background. (will be the same for all possible boss cards)
            Texture2D BossCardBackground = expandSharedAssets1.LoadAsset <Texture2D>("MimicInMirror_BossCardBackground");
            // Combine foreground boss card generated from PlayerController onto the static background image loased in earlier. Resolutions must match!
            Texture2D BossCardTexture = ExpandUtility.CombineTextures(BossCardBackground, BossCardForeground);



            GenericIntroDoer miniBossIntroDoer = aiActorObject.AddComponent <GenericIntroDoer>();

            aiActorObject.AddComponent <ExpandGungeoneerMimicIntroDoer>();
            miniBossIntroDoer.triggerType              = GenericIntroDoer.TriggerType.PlayerEnteredRoom;
            miniBossIntroDoer.initialDelay             = 0.15f;
            miniBossIntroDoer.cameraMoveSpeed          = 14;
            miniBossIntroDoer.specifyIntroAiAnimator   = null;
            miniBossIntroDoer.BossMusicEvent           = "Play_MUS_Boss_Theme_Beholster";
            miniBossIntroDoer.PreventBossMusic         = false;
            miniBossIntroDoer.InvisibleBeforeIntroAnim = false;
            miniBossIntroDoer.preIntroAnim             = string.Empty;
            miniBossIntroDoer.preIntroDirectionalAnim  = string.Empty;
            miniBossIntroDoer.introAnim                  = "idle";
            miniBossIntroDoer.introDirectionalAnim       = string.Empty;
            miniBossIntroDoer.continueAnimDuringOutro    = false;
            miniBossIntroDoer.cameraFocus                = null;
            miniBossIntroDoer.roomPositionCameraFocus    = Vector2.zero;
            miniBossIntroDoer.restrictPlayerMotionToRoom = false;
            miniBossIntroDoer.fusebombLock               = false;
            miniBossIntroDoer.AdditionalHeightOffset     = 0;
            miniBossIntroDoer.portraitSlideSettings      = new PortraitSlideSettings()
            {
                bossNameString          = "Dopplegunner",
                bossSubtitleString      = "Imposter!",
                bossQuoteString         = "Clone gone rogue...",
                bossSpritePxOffset      = IntVector2.Zero,
                topLeftTextPxOffset     = IntVector2.Zero,
                bottomRightTextPxOffset = IntVector2.Zero,
                bgColor = new Color(0, 0, 1, 1)
            };
            if (BossCardTexture)
            {
                miniBossIntroDoer.portraitSlideSettings.bossArtSprite = BossCardTexture;
                miniBossIntroDoer.SkipBossCard             = false;
                CachedEnemyActor.healthHaver.bossHealthBar = HealthHaver.BossBarType.MainBar;
            }
            else
            {
                miniBossIntroDoer.SkipBossCard             = true;
                CachedEnemyActor.healthHaver.bossHealthBar = HealthHaver.BossBarType.SubbossBar;
            }
            miniBossIntroDoer.HideGunAndHand        = true;
            miniBossIntroDoer.SkipFinalizeAnimation = true;
            miniBossIntroDoer.RegenerateCache();


            CachedEnemyActor.BaseMovementSpeed = 8f;
            CachedEnemyActor.MovementSpeed     = 8f;

            CachedEnemyActor.healthHaver.SetHealthMaximum(1000);
            CachedEnemyActor.healthHaver.ForceSetCurrentHealth(1000);
            CachedEnemyActor.healthHaver.overrideBossName = "Dopplegunner";
            CachedEnemyActor.healthHaver.RegenerateCache();

            CachedEnemyActor.EnemyId             = Random.Range(2000, 9999);
            CachedEnemyActor.EnemyGuid           = System.Guid.NewGuid().ToString();
            CachedEnemyActor.OverrideDisplayName = ("Dopplegunner");
            CachedEnemyActor.ActorName           = ("Dopplegunner");
            CachedEnemyActor.name = ("Dopplegunner");

            CachedEnemyActor.CanTargetEnemies = false;
            CachedEnemyActor.CanTargetPlayers = true;

            if (sourcePlayer.characterIdentity == PlayableCharacters.Bullet)
            {
                CachedEnemyActor.EnemySwitchState = "Metal_Bullet_Man";
            }
            else if (sourcePlayer.characterIdentity == PlayableCharacters.Convict)
            {
                CachedEnemyActor.EnemySwitchState = "Convict";
            }
            else if (sourcePlayer.characterIdentity == PlayableCharacters.CoopCultist)
            {
                CachedEnemyActor.EnemySwitchState = "Cultist";
            }
            else if (sourcePlayer.characterIdentity == PlayableCharacters.Cosmonaut)
            {
                CachedEnemyActor.EnemySwitchState = "Cosmonaut";
            }
            else if (sourcePlayer.characterIdentity == PlayableCharacters.Guide)
            {
                CachedEnemyActor.EnemySwitchState = "Guide";
            }
            else if (sourcePlayer.characterIdentity == PlayableCharacters.Gunslinger)
            {
                CachedEnemyActor.EnemySwitchState = "Gunslinger";
            }
            else if (sourcePlayer.characterIdentity == PlayableCharacters.Ninja)
            {
                CachedEnemyActor.EnemySwitchState = "Ninja";
            }
            else if (sourcePlayer.characterIdentity == PlayableCharacters.Pilot)
            {
                CachedEnemyActor.EnemySwitchState = "Rogue";
            }
            else if (sourcePlayer.characterIdentity == PlayableCharacters.Robot)
            {
                CachedEnemyActor.EnemySwitchState = "Robot";
            }
            else if (sourcePlayer.characterIdentity == PlayableCharacters.Soldier)
            {
                CachedEnemyActor.EnemySwitchState = "Marine";
            }
            else if (sourcePlayer.characterIdentity == PlayableCharacters.Eevee)
            {
                CachedEnemyActor.EnemySwitchState = "Convict";
                ExpandShaders.ApplyParadoxPlayerShader(CachedEnemyActor.sprite);
            }
            else
            {
                CachedEnemyActor.EnemySwitchState = "Gun Cultist";
            }


            ExpandGungeoneerMimicBossController playerMimicController = aiActorObject.AddComponent <ExpandGungeoneerMimicBossController>();

            playerMimicController.m_Player = sourcePlayer;

            aiActorObject.AddComponent <ExpandGungeoneerMimicDeathController>();

            if (CachedEnemyActor.GetComponent <ExpandGungeoneerMimicIntroDoer>())
            {
                GenericIntroDoer genericIntroDoer = CachedEnemyActor.gameObject.GetComponent <GenericIntroDoer>();
                FieldInfo        field            = typeof(GenericIntroDoer).GetField("m_specificIntroDoer", BindingFlags.Instance | BindingFlags.NonPublic);
                field.SetValue(genericIntroDoer, CachedEnemyActor.GetComponent <ExpandGungeoneerMimicIntroDoer>());
            }

            CachedEnemyActor.aiAnimator.enabled = false;
            CachedEnemyActor.spriteAnimator.Stop();
            CachedEnemyActor.spriteAnimator.DefaultClipId     = 0;
            CachedEnemyActor.spriteAnimator.playAutomatically = false;

            List <tk2dSpriteAnimationClip> m_AnimationClips = new List <tk2dSpriteAnimationClip>();

            foreach (tk2dSpriteAnimationClip clip in sourcePlayer.spriteAnimator.Library.clips)
            {
                if (!string.IsNullOrEmpty(clip.name))
                {
                    if (clip.name.ToLower() == "dodge")
                    {
                        m_AnimationClips.Add(clip);
                        if (clip.frames != null && clip.frames.Length > 0)
                        {
                            if (!sourcePlayer.UseArmorlessAnim)
                            {
                                CachedEnemyActor.sprite.SetSprite(clip.frames[0].spriteId);
                            }
                        }
                    }
                    else if (clip.name.ToLower() == "dodge_armorless")
                    {
                        m_AnimationClips.Add(clip);
                        if (clip.frames != null && clip.frames.Length > 0)
                        {
                            if (sourcePlayer.UseArmorlessAnim)
                            {
                                CachedEnemyActor.sprite.SetSprite(clip.frames[0].spriteId);
                            }
                        }
                    }
                    else if (clip.name.ToLower() == "run_down")
                    {
                        m_AnimationClips.Add(clip);
                    }
                    else if (clip.name.ToLower() == "run_down_armorless")
                    {
                        m_AnimationClips.Add(clip);
                    }
                    else if (clip.name.ToLower() == "death_shot")
                    {
                        m_AnimationClips.Add(clip);
                    }
                    else if (clip.name.ToLower() == "death_shot_armorless")
                    {
                        m_AnimationClips.Add(clip);
                    }
                }
            }

            if (m_AnimationClips.Count > 0)
            {
                if (!CachedEnemyActor.spriteAnimator.Library)
                {
                    CachedEnemyActor.spriteAnimator.Library = aiActorObject.AddComponent <tk2dSpriteAnimation>();
                }
                CachedEnemyActor.spriteAnimator.Library.clips = m_AnimationClips.ToArray();
            }

            CachedEnemyActor.healthHaver.RegenerateCache();

            BehaviorSpeculator customBehaviorSpeculator = aiActorObject.AddComponent <BehaviorSpeculator>();

            customBehaviorSpeculator.OverrideBehaviors               = new List <OverrideBehaviorBase>(0);
            customBehaviorSpeculator.TargetBehaviors                 = new List <TargetBehaviorBase>(0);
            customBehaviorSpeculator.MovementBehaviors               = new List <MovementBehaviorBase>(0);
            customBehaviorSpeculator.AttackBehaviors                 = new List <AttackBehaviorBase>(0);
            customBehaviorSpeculator.OtherBehaviors                  = new List <BehaviorBase>(0);
            customBehaviorSpeculator.InstantFirstTick                = false;
            customBehaviorSpeculator.TickInterval                    = 0.1f;
            customBehaviorSpeculator.PostAwakenDelay                 = 0.5f;
            customBehaviorSpeculator.RemoveDelayOnReinforce          = false;
            customBehaviorSpeculator.OverrideStartingFacingDirection = false;
            customBehaviorSpeculator.StartingFacingDirection         = -90f;
            customBehaviorSpeculator.SkipTimingDifferentiator        = false;
            customBehaviorSpeculator.RegenerateCache();

            // BehaviorSpeculator is a serialized object. You must build these lists (or create new empty lists) and save them before the game can instantiate it correctly!
            ISerializedObject m_TargetBehaviorSpeculatorSeralized = customBehaviorSpeculator;

            m_TargetBehaviorSpeculatorSeralized.SerializedObjectReferences = new List <Object>(0);
            m_TargetBehaviorSpeculatorSeralized.SerializedStateKeys        = new List <string>()
            {
                "OverrideBehaviors", "TargetBehaviors", "MovementBehaviors", "AttackBehaviors", "OtherBehaviors"
            };
            m_TargetBehaviorSpeculatorSeralized.SerializedStateValues = new List <string>()
            {
                "[]", "[]", "[]", "[]", "[]"
            };

            CachedEnemyActor.RegenerateCache();
            return;
        }
示例#4
0
        public static void BuildPrefab()
        {
            // source = EnemyDatabase.GetOrLoadByGuid("c50a862d19fc4d30baeba54795e8cb93");
            bool flag  = prefab != null || BossBuilder.Dictionary.ContainsKey(guid);
            bool flag2 = flag;

            if (!flag2)
            {
                prefab = BossBuilder.BuildPrefab("Flame Chamber", guid, spritePaths[0], new IntVector2(0, 0), new IntVector2(8, 9), false, true);
                var companion = prefab.AddComponent <EnemyBehavior2>();

                companion.aiActor.knockbackDoer.weight         = 200;
                companion.aiActor.MovementSpeed                = 6f;
                companion.aiActor.healthHaver.PreventAllDamage = false;
                companion.aiActor.CollisionDamage              = 1f;
                companion.aiActor.HasShadow                        = true;
                companion.aiActor.IgnoreForRoomClear               = false;
                companion.aiActor.aiAnimator.HitReactChance        = 0.05f;
                companion.aiActor.specRigidbody.CollideWithOthers  = true;
                companion.aiActor.specRigidbody.CollideWithTileMap = true;
                companion.aiActor.PreventFallingInPitsEver         = true;
                companion.aiActor.healthHaver.ForceSetCurrentHealth(500f);
                companion.aiActor.healthHaver.SetHealthMaximum(500f);
                companion.aiActor.CollisionKnockbackStrength = 5f;
                companion.aiActor.procedurallyOutlined       = true;
                companion.aiActor.CanTargetPlayers           = true;

                ItemsMod.Strings.Enemies.Set("#FLAMECHAMBER", "Killinder");
                ItemsMod.Strings.Enemies.Set("#????", "???");
                ItemsMod.Strings.Enemies.Set("#SUBTITLE", "FLAME CHAMBER");
                ItemsMod.Strings.Enemies.Set("#QUOTE", "THE 36 CHAMBERS");
                companion.aiActor.healthHaver.overrideBossName = "#FLAMECHAMBER";
                companion.aiActor.OverrideDisplayName          = "#FLAMECHAMBER";
                companion.aiActor.ActorName = "#FLAMECHAMBER";
                companion.aiActor.name      = "#FLAMECHAMBER";
                companion.aiActor.SetIsFlying(true, "Flying Enemy", true, true);

                prefab.name = companion.aiActor.OverrideDisplayName;

                GenericIntroDoer miniBossIntroDoer = prefab.AddComponent <GenericIntroDoer>();
                miniBossIntroDoer.triggerType  = GenericIntroDoer.TriggerType.PlayerEnteredRoom;
                miniBossIntroDoer.initialDelay = 0.15f;

                miniBossIntroDoer.cameraMoveSpeed        = 14;
                miniBossIntroDoer.specifyIntroAiAnimator = null;
                miniBossIntroDoer.BossMusicEvent         = "Play_MUS_Boss_Theme_Beholster";
                companion.aiActor.ShadowObject           = EnemyDatabase.GetOrLoadByGuid("c00390483f394a849c36143eb878998f").ShadowObject;
                companion.aiActor.HasShadow        = true;
                miniBossIntroDoer.PreventBossMusic = false;

                miniBossIntroDoer.InvisibleBeforeIntroAnim = false;
                miniBossIntroDoer.preIntroAnim             = string.Empty;
                miniBossIntroDoer.preIntroDirectionalAnim  = string.Empty;
                miniBossIntroDoer.introAnim                  = "intro";
                miniBossIntroDoer.introDirectionalAnim       = string.Empty;
                miniBossIntroDoer.continueAnimDuringOutro    = false;
                miniBossIntroDoer.cameraFocus                = null;
                miniBossIntroDoer.roomPositionCameraFocus    = Vector2.zero;
                miniBossIntroDoer.restrictPlayerMotionToRoom = false;
                miniBossIntroDoer.fusebombLock               = false;
                miniBossIntroDoer.AdditionalHeightOffset     = 0;
                miniBossIntroDoer.portraitSlideSettings      = new PortraitSlideSettings()
                {
                    bossNameString          = "#FLAMECHAMBER",
                    bossSubtitleString      = "#SUBTITLE",
                    bossQuoteString         = "#QUOTE",
                    bossSpritePxOffset      = IntVector2.Zero,
                    topLeftTextPxOffset     = IntVector2.Zero,
                    bottomRightTextPxOffset = IntVector2.Zero,
                    bgColor = ExtendedColours.orange
                };
                miniBossIntroDoer.SkipBossCard = false;
                miniBossIntroDoer.portraitSlideSettings.bossArtSprite = BossCardTexture;
                companion.aiActor.healthHaver.bossHealthBar           = HealthHaver.BossBarType.MainBar;
                miniBossIntroDoer.SkipFinalizeAnimation = true;

                miniBossIntroDoer.RegenerateCache();
                //BehaviorSpeculator aIActor = EnemyDatabase.GetOrLoadByGuid("465da2bb086a4a88a803f79fe3a27677").behaviorSpeculator;
                //Tools.DebugInformation(aIActor);

                /////



                companion.aiActor.healthHaver.SetHealthMaximum(500f, 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          = 10,
                    ManualWidth            = 50,
                    ManualHeight           = 50,
                    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          = 10,
                    ManualWidth            = 50,
                    ManualHeight           = 50,
                    ManualDiameter         = 0,
                    ManualLeftX            = 0,
                    ManualLeftY            = 0,
                    ManualRightX           = 0,
                    ManualRightY           = 0,
                });
                companion.aiActor.CorpseObject        = EnemyDatabase.GetOrLoadByGuid("c0ff3744760c4a2eb0bb52ac162056e6").CorpseObject;
                companion.aiActor.PreventBlackPhantom = false;
                AIAnimator aiAnimator = companion.aiAnimator;
                aiAnimator.IdleAnimation = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.Single,
                    Prefix    = "idle",
                    AnimNames = new string[1],
                    Flipped   = new DirectionalAnimation.FlipType[1]
                };
                DirectionalAnimation almostdone = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.Single,
                    Prefix    = "intro",
                    AnimNames = new string[1],
                    Flipped   = new DirectionalAnimation.FlipType[1]
                };
                aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation>
                {
                    new AIAnimator.NamedDirectionalAnimation
                    {
                        name = "intro",
                        anim = almostdone
                    }
                };

                DirectionalAnimation done2 = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.Single,
                    Prefix    = "bigeyes",
                    AnimNames = new string[1],
                    Flipped   = new DirectionalAnimation.FlipType[1]
                };
                aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation>
                {
                    new AIAnimator.NamedDirectionalAnimation
                    {
                        name = "bigeyes",
                        anim = done2
                    }
                };
                DirectionalAnimation done32 = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.Single,
                    Prefix    = "eyes",
                    AnimNames = new string[1],
                    Flipped   = new DirectionalAnimation.FlipType[1]
                };
                aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation>
                {
                    new AIAnimator.NamedDirectionalAnimation
                    {
                        name = "eyes",
                        anim = done32
                    }
                };
                bool flag3 = BishopCollection == null;
                if (flag3)
                {
                    BishopCollection = SpriteBuilder.ConstructCollection(prefab, "FlameChamber_Collection");
                    UnityEngine.Object.DontDestroyOnLoad(BishopCollection);
                    for (int i = 0; i < spritePaths.Length; i++)
                    {
                        SpriteBuilder.AddSpriteToCollection(spritePaths[i], BishopCollection);
                    }
                    SpriteBuilder.AddAnimation(companion.spriteAnimator, BishopCollection, new List <int>
                    {
                        0,
                        1,
                        2,
                        3
                    }, "idle", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 7f;

                    SpriteBuilder.AddAnimation(companion.spriteAnimator, BishopCollection, new List <int>
                    {
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        34
                    }, "intro", tk2dSpriteAnimationClip.WrapMode.Once).fps = 7f;
                    SpriteBuilder.AddAnimation(companion.spriteAnimator, BishopCollection, new List <int>
                    {
                        31
                    }, "bigeyes", tk2dSpriteAnimationClip.WrapMode.Once).fps = 6f;
                    SpriteBuilder.AddAnimation(companion.spriteAnimator, BishopCollection, new List <int>
                    {
                        32
                    }, "eyes", tk2dSpriteAnimationClip.WrapMode.Once).fps = 6f;
                }
                var bs = prefab.GetComponent <BehaviorSpeculator>();
                BehaviorSpeculator behaviorSpeculator = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5").behaviorSpeculator;
                bs.OverrideBehaviors          = behaviorSpeculator.OverrideBehaviors;
                bs.OtherBehaviors             = behaviorSpeculator.OtherBehaviors;
                shootpoint                    = new GameObject("attach");
                shootpoint.transform.parent   = companion.transform;
                shootpoint.transform.position = companion.sprite.WorldCenter;
                GameObject m_CachedGunAttachPoint = companion.transform.Find("attach").gameObject;
                bs.TargetBehaviors = new List <TargetBehaviorBase>
                {
                    new TargetPlayerBehavior
                    {
                        Radius              = 35f,
                        LineOfSight         = false,
                        ObjectPermanence    = true,
                        SearchInterval      = 0.25f,
                        PauseOnTargetSwitch = false,
                        PauseTime           = 0.25f
                    }
                };
                float[] angles = { 45, 135, 225, 135 };
                bs.MovementBehaviors = new List <MovementBehaviorBase>
                {
                    new PingPongAroundBehavior2
                    {
                        startingAngles = angles
                    }
                };

                bs.AttackBehaviorGroup.AttackBehaviors = new List <AttackBehaviorGroup.AttackGroupItem>
                {
                    new AttackBehaviorGroup.AttackGroupItem()
                    {
                        Probability = 1,
                        Behavior    = new ShootBehavior {
                            ShootPoint          = m_CachedGunAttachPoint,
                            BulletScript        = new CustomBulletScriptSelector(typeof(ChamberShot)),
                            LeadAmount          = 0f,
                            AttackCooldown      = 4.5f,
                            TellAnimation       = "bigeyes",
                            RequiresLineOfSight = false,
                            StopDuring          = ShootBehavior.StopType.Attack,
                            Uninterruptible     = true
                        },
                        NickName = "Lucky Sixes"
                    },
                    new AttackBehaviorGroup.AttackGroupItem()
                    {
                        Probability = 1,
                        Behavior    = new ShootBehavior {
                            ShootPoint          = m_CachedGunAttachPoint,
                            BulletScript        = new CustomBulletScriptSelector(typeof(FireLine)),
                            LeadAmount          = 0f,
                            AttackCooldown      = 4.5f,
                            TellAnimation       = "bigeyes",
                            RequiresLineOfSight = false,
                            StopDuring          = ShootBehavior.StopType.Attack,
                            Uninterruptible     = true
                        },
                        NickName = "Fire In Da Hole"
                    },
                    new AttackBehaviorGroup.AttackGroupItem()
                    {
                        Probability = 1.5f,
                        Behavior    = new TeleportBehavior()
                        {
                            AttackableDuringAnimation = true,

                            AllowCrossRoomTeleportation  = false,
                            teleportRequiresTransparency = false,
                            hasOutlinesDuringAnim        = true,
                            ManuallyDefineRoom           = false,
                            StayOnScreen = true,
                            AvoidWalls   = true,
                            GoneTime     = 0.7f,
                            OnlyTeleportIfPlayerUnreachable = false,
                            MinDistanceFromPlayer           = 7f,
                            MaxDistanceFromPlayer           = -1f,

                            teleportInBulletScript  = new CustomBulletScriptSelector(typeof(PoofScript)),
                            teleportOutBulletScript = new CustomBulletScriptSelector(typeof(PoofScript)),
                            AttackCooldown          = 5f,
                            InitialCooldown         = 0f,
                            RequiresLineOfSight     = false,
                            roomMax        = new Vector2(0, 0),
                            roomMin        = new Vector2(0, 0),
                            GlobalCooldown = 0.5f,
                            Cooldown       = 1f,

                            InitialCooldownVariance = 0f,
                            goneAttackBehavior      = null,
                            IsBlackPhantom          = false,
                            GroupName                  = null,
                            GroupCooldown              = 0f,
                            MinRange                   = 3,
                            Range                      = 10,
                            MinHealthThreshold         = 0,
                            AccumulateHealthThresholds = true,
                            targetAreaStyle            = null,
                            HealthThresholds           = new float[0],
                            MinWallDistance            = 1,
                        },
                        NickName = "Flameport"
                    },

                    new AttackBehaviorGroup.AttackGroupItem()
                    {
                        Probability = 0.5f,
                        Behavior    = new ShootBehavior {
                            ShootPoint          = m_CachedGunAttachPoint,
                            BulletScript        = new CustomBulletScriptSelector(typeof(ShotgunBall)),
                            LeadAmount          = 0f,
                            TellAnimation       = "eyes",
                            AttackCooldown      = 4.5f,
                            RequiresLineOfSight = false,
                            StopDuring          = ShootBehavior.StopType.Attack,
                            Uninterruptible     = true
                        },
                        NickName = "Large Shotgunball"
                    },
                };


                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;
                companion.aiActor.CollisionSetsPlayerOnFire = true;
                companion.aiActor.EffectResistances         = new ActorEffectResistance[] { new ActorEffectResistance()
                                                                                            {
                                                                                                resistAmount = 1, resistType = EffectResistanceType.Fire
                                                                                            }, };
                Game.Enemies.Add("cak:flamechamber", companion.aiActor);
            }
        }
示例#5
0
        public static void BuildPrefab()
        {
            // source = EnemyDatabase.GetOrLoadByGuid("c50a862d19fc4d30baeba54795e8cb93");
            bool flag  = fuckyouprefab != null || BossBuilder.Dictionary.ContainsKey(guid);
            bool flag2 = flag;

            if (!flag2)
            {
                fuckyouprefab = BossBuilder.BuildPrefab("TheStranger", guid, spritePaths[0], new IntVector2(0, 0), new IntVector2(8, 9), false, true);
                var companion = fuckyouprefab.AddComponent <EnemyBehavior>();
                companion.aiActor.knockbackDoer.weight         = 200;
                companion.aiActor.MovementSpeed                = 1.33f;
                companion.aiActor.healthHaver.PreventAllDamage = false;
                companion.aiActor.CollisionDamage              = 1f;
                companion.aiActor.HasShadow                        = false;
                companion.aiActor.IgnoreForRoomClear               = false;
                companion.aiActor.aiAnimator.HitReactChance        = 0.05f;
                companion.aiActor.specRigidbody.CollideWithOthers  = true;
                companion.aiActor.specRigidbody.CollideWithTileMap = true;
                companion.aiActor.PreventFallingInPitsEver         = true;
                companion.aiActor.healthHaver.ForceSetCurrentHealth(600f);
                companion.aiActor.healthHaver.SetHealthMaximum(600f);
                companion.aiActor.CollisionKnockbackStrength = 2f;
                companion.aiActor.procedurallyOutlined       = false;
                companion.aiActor.CanTargetPlayers           = true;
                ///
                BunnyModule.Strings.Enemies.Set("#THE_STRANGER", "Stranger");
                BunnyModule.Strings.Enemies.Set("#????", "???");
                BunnyModule.Strings.Enemies.Set("#SUBTITLE", "Glocked And Loaded");
                BunnyModule.Strings.Enemies.Set("#QUOTE", "");
                companion.aiActor.healthHaver.overrideBossName = "#THE_STRANGER";
                companion.aiActor.OverrideDisplayName          = "#THE_STRANGER";
                companion.aiActor.ActorName = "#THE_STRANGER";
                companion.aiActor.name      = "#THE_STRANGER";
                fuckyouprefab.name          = companion.aiActor.OverrideDisplayName;

                GenericIntroDoer miniBossIntroDoer = fuckyouprefab.AddComponent <GenericIntroDoer>();
                fuckyouprefab.AddComponent <TheStrangerIntro>();
                miniBossIntroDoer.triggerType              = GenericIntroDoer.TriggerType.PlayerEnteredRoom;
                miniBossIntroDoer.initialDelay             = 0.15f;
                miniBossIntroDoer.cameraMoveSpeed          = 14;
                miniBossIntroDoer.specifyIntroAiAnimator   = null;
                miniBossIntroDoer.BossMusicEvent           = "Play_MUS_Boss_Theme_Beholster";
                miniBossIntroDoer.PreventBossMusic         = false;
                miniBossIntroDoer.InvisibleBeforeIntroAnim = true;
                miniBossIntroDoer.preIntroAnim             = string.Empty;
                miniBossIntroDoer.preIntroDirectionalAnim  = string.Empty;
                miniBossIntroDoer.introAnim                  = "intro";
                miniBossIntroDoer.introDirectionalAnim       = string.Empty;
                miniBossIntroDoer.continueAnimDuringOutro    = false;
                miniBossIntroDoer.cameraFocus                = null;
                miniBossIntroDoer.roomPositionCameraFocus    = Vector2.zero;
                miniBossIntroDoer.restrictPlayerMotionToRoom = false;
                miniBossIntroDoer.fusebombLock               = false;
                miniBossIntroDoer.AdditionalHeightOffset     = 0;
                miniBossIntroDoer.portraitSlideSettings      = new PortraitSlideSettings()
                {
                    bossNameString          = "#THE_STRANGER",
                    bossSubtitleString      = "#SUBTITLE",
                    bossQuoteString         = "#QUOTE",
                    bossSpritePxOffset      = IntVector2.Zero,
                    topLeftTextPxOffset     = IntVector2.Zero,
                    bottomRightTextPxOffset = IntVector2.Zero,
                    bgColor = Color.yellow
                };
                if (BossCardTexture)
                {
                    miniBossIntroDoer.portraitSlideSettings.bossArtSprite = BossCardTexture;
                    miniBossIntroDoer.SkipBossCard = false;
                    companion.aiActor.healthHaver.bossHealthBar = HealthHaver.BossBarType.MainBar;
                }
                else
                {
                    miniBossIntroDoer.SkipBossCard = true;
                    companion.aiActor.healthHaver.bossHealthBar = HealthHaver.BossBarType.SubbossBar;
                }
                miniBossIntroDoer.SkipFinalizeAnimation = true;
                miniBossIntroDoer.RegenerateCache();

                //BehaviorSpeculator aIActor = EnemyDatabase.GetOrLoadByGuid("465da2bb086a4a88a803f79fe3a27677").behaviorSpeculator;
                //Tools.DebugInformation(aIActor);

                /////



                companion.aiActor.healthHaver.SetHealthMaximum(600f, 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          = 10,
                    ManualWidth            = 16,
                    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          = 10,
                    ManualWidth            = 16,
                    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.IdleAnimation = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.Single,
                    Prefix    = "idle",
                    AnimNames = new string[1],
                    Flipped   = new DirectionalAnimation.FlipType[1]
                };
                DirectionalAnimation anim = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.TwoWayHorizontal,
                    AnimNames = new string[]
                    {
                        "flare",
                    },
                    Flipped = new DirectionalAnimation.FlipType[2]
                };
                aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation>
                {
                    new AIAnimator.NamedDirectionalAnimation
                    {
                        name = "flare",
                        anim = anim
                    }
                };
                DirectionalAnimation anim2 = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.TwoWayHorizontal,
                    AnimNames = new string[]
                    {
                        "brrap",
                    },
                    Flipped = new DirectionalAnimation.FlipType[2]
                };
                aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation>
                {
                    new AIAnimator.NamedDirectionalAnimation
                    {
                        name = "brrap",
                        anim = anim2
                    }
                };
                DirectionalAnimation anim3 = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.Single,
                    AnimNames = new string[]
                    {
                        "tell",
                    },
                    Flipped = new DirectionalAnimation.FlipType[1]
                };
                aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation>
                {
                    new AIAnimator.NamedDirectionalAnimation
                    {
                        name = "tell",
                        anim = anim3
                    }
                };
                DirectionalAnimation Hurray = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.Single,
                    Prefix    = "fire1",
                    AnimNames = new string[1],
                    Flipped   = new DirectionalAnimation.FlipType[1]
                };
                aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation>
                {
                    new AIAnimator.NamedDirectionalAnimation
                    {
                        name = "fire1",
                        anim = Hurray
                    }
                };
                DirectionalAnimation almostdone = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.Single,
                    Prefix    = "intro",
                    AnimNames = new string[1],
                    Flipped   = new DirectionalAnimation.FlipType[1]
                };
                aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation>
                {
                    new AIAnimator.NamedDirectionalAnimation
                    {
                        name = "intro",
                        anim = almostdone
                    }
                };
                DirectionalAnimation done = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.Single,
                    Prefix    = "death",
                    AnimNames = new string[1],
                    Flipped   = new DirectionalAnimation.FlipType[1]
                };
                aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation>
                {
                    new AIAnimator.NamedDirectionalAnimation
                    {
                        name = "death",
                        anim = done
                    }
                };
                bool flag3 = StagngerCollection == null;
                if (flag3)
                {
                    StagngerCollection = SpriteBuilder.ConstructCollection(fuckyouprefab, "The_Stranger_Collection");
                    UnityEngine.Object.DontDestroyOnLoad(StagngerCollection);
                    for (int i = 0; i < spritePaths.Length; i++)
                    {
                        SpriteBuilder.AddSpriteToCollection(spritePaths[i], StagngerCollection);
                    }
                    SpriteBuilder.AddAnimation(companion.spriteAnimator, StagngerCollection, new List <int>
                    {
                        0,
                        1,
                        2,
                        3
                    }, "idle", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 3f;
                    SpriteBuilder.AddAnimation(companion.spriteAnimator, StagngerCollection, new List <int>
                    {
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                    }, "flare", tk2dSpriteAnimationClip.WrapMode.Once).fps = 12f;
                    SpriteBuilder.AddAnimation(companion.spriteAnimator, StagngerCollection, new List <int>
                    {
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26,
                        27,
                        28,
                        29,
                        30,
                    }, "brrap", tk2dSpriteAnimationClip.WrapMode.Once).fps = 8f;
                    SpriteBuilder.AddAnimation(companion.spriteAnimator, StagngerCollection, new List <int>
                    {
                        31,
                        32,
                        33,
                        34,
                        35,
                        36,
                    }, "tell", tk2dSpriteAnimationClip.WrapMode.Once).fps = 8f;
                    SpriteBuilder.AddAnimation(companion.spriteAnimator, StagngerCollection, new List <int>
                    {
                        37,
                        38,
                        39,
                        40,
                        41,
                        42,
                        43,
                        44,
                    }, "fire1", tk2dSpriteAnimationClip.WrapMode.Once).fps = 5f;
                    SpriteBuilder.AddAnimation(companion.spriteAnimator, StagngerCollection, new List <int>
                    {
                        45,
                        46,
                        47,
                        48,
                        49,
                        50,
                        51,
                        52,
                        53,
                        54,
                        55,
                        56,
                        57,
                        58,
                        59,
                        60,
                        61,
                    }, "intro", tk2dSpriteAnimationClip.WrapMode.Once).fps = 5f;
                    SpriteBuilder.AddAnimation(companion.spriteAnimator, StagngerCollection, new List <int>
                    {
                        62,
                        63,
                        64,
                        65,
                        66,
                        67,
                        68,
                        69,
                        70,
                    }, "death", tk2dSpriteAnimationClip.WrapMode.Once).fps = 6f;
                }
                var bs = fuckyouprefab.GetComponent <BehaviorSpeculator>();
                BehaviorSpeculator behaviorSpeculator = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5").behaviorSpeculator;
                bs.OverrideBehaviors          = behaviorSpeculator.OverrideBehaviors;
                bs.OtherBehaviors             = behaviorSpeculator.OtherBehaviors;
                shootpoint                    = new GameObject("attach");
                shootpoint.transform.parent   = companion.transform;
                shootpoint.transform.position = companion.sprite.WorldCenter;
                GameObject m_CachedGunAttachPoint = companion.transform.Find("attach").gameObject;
                bs.TargetBehaviors = new List <TargetBehaviorBase>
                {
                    new TargetPlayerBehavior
                    {
                        Radius              = 35f,
                        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.AttackBehaviorGroup.AttackBehaviors = new List <AttackBehaviorGroup.AttackGroupItem>
                {
                    new AttackBehaviorGroup.AttackGroupItem()
                    {
                        Probability = 0.4f,
                        Behavior    = new ShootBehavior {
                            ShootPoint          = m_CachedGunAttachPoint,
                            BulletScript        = new BunnyMod.CustomBulletScriptSelector(typeof(SwirlScript)),
                            LeadAmount          = 0f,
                            AttackCooldown      = 1.5f,
                            Cooldown            = 5,
                            InitialCooldown     = 8f,
                            FireAnimation       = "flare",
                            RequiresLineOfSight = false,
                            StopDuring          = ShootBehavior.StopType.Attack,
                            Uninterruptible     = true,
                        },
                        NickName = "FireFlare"
                    },
                    new AttackBehaviorGroup.AttackGroupItem()
                    {
                        Probability = 1f,
                        Behavior    = new ShootBehavior {
                            ShootPoint          = m_CachedGunAttachPoint,
                            BulletScript        = new BunnyMod.CustomBulletScriptSelector(typeof(BrrapScript)),
                            LeadAmount          = 0f,
                            AttackCooldown      = 1.5f,
                            FireAnimation       = "brrap",
                            RequiresLineOfSight = false,
                            StopDuring          = ShootBehavior.StopType.Attack,
                            Uninterruptible     = true
                        },
                        NickName = "BRRRRRRRRAP"
                    },
                    new AttackBehaviorGroup.AttackGroupItem()
                    {
                        Probability = 0.25f,
                        Behavior    = new ShootBehavior {
                            ShootPoint      = m_CachedGunAttachPoint,
                            BulletScript    = new BunnyMod.CustomBulletScriptSelector(typeof(GrenadeChuck)),
                            LeadAmount      = 0f,
                            MaxUsages       = 3,
                            Cooldown        = 7f,
                            InitialCooldown = 3f,

                            AttackCooldown      = 1.66f,
                            TellAnimation       = "tell",
                            FireAnimation       = "fire1",
                            RequiresLineOfSight = false,
                            StopDuring          = ShootBehavior.StopType.Attack,
                            Uninterruptible     = true
                        },
                        NickName = "Grenade Toss."
                    },
                    new AttackBehaviorGroup.AttackGroupItem()
                    {
                        Probability = 0.7f,
                        Behavior    = new ShootBehavior {
                            ShootPoint          = m_CachedGunAttachPoint,
                            BulletScript        = new BunnyMod.CustomBulletScriptSelector(typeof(CannonScript)),
                            LeadAmount          = 0f,
                            AttackCooldown      = 1.2f,
                            TellAnimation       = "tell",
                            FireAnimation       = "fire1",
                            RequiresLineOfSight = false,
                            Cooldown            = 6f,

                            StopDuring      = ShootBehavior.StopType.Attack,
                            Uninterruptible = true
                        },
                        NickName = "CANNON"
                    },
                    new AttackBehaviorGroup.AttackGroupItem()
                    {
                        Probability = 1f,
                        Behavior    = new ShootBehavior {
                            ShootPoint     = m_CachedGunAttachPoint,
                            BulletScript   = new BunnyMod.CustomBulletScriptSelector(typeof(SniperScript)),
                            LeadAmount     = 0f,
                            AttackCooldown = 2f,
                            Cooldown       = 5f,

                            TellAnimation       = "tell",
                            FireAnimation       = "fire1",
                            RequiresLineOfSight = false,
                            StopDuring          = ShootBehavior.StopType.Attack,
                            Uninterruptible     = true
                        },
                        NickName = "Sniper"
                    },
                };
                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("bny:the_stranger", companion.aiActor);
            }
        }
示例#6
0
        public static void BuildPrefab()
        {
            // source = EnemyDatabase.GetOrLoadByGuid("c50a862d19fc4d30baeba54795e8cb93");
            bool flag  = prefab != null || BossBuilder.Dictionary.ContainsKey(guid);
            bool flag2 = flag;

            if (!flag2)
            {
                prefab = BossBuilder.BuildPrefab("Kill Shrine", guid, spritePaths[0], new IntVector2(0, 0), new IntVector2(8, 9), false, true);
                var companion = prefab.AddComponent <EnemyBehavior23>();

                companion.aiActor.knockbackDoer.weight         = 200;
                companion.aiActor.MovementSpeed                = 6f;
                companion.aiActor.healthHaver.PreventAllDamage = false;
                companion.aiActor.CollisionDamage              = 1f;
                companion.aiActor.HasShadow                        = true;
                companion.aiActor.IgnoreForRoomClear               = false;
                companion.aiActor.aiAnimator.HitReactChance        = 0.05f;
                companion.aiActor.specRigidbody.CollideWithOthers  = true;
                companion.aiActor.specRigidbody.CollideWithTileMap = true;
                companion.aiActor.PreventFallingInPitsEver         = true;
                companion.aiActor.healthHaver.ForceSetCurrentHealth(500f);
                companion.aiActor.healthHaver.SetHealthMaximum(500f);
                companion.aiActor.CollisionKnockbackStrength = 5f;
                companion.aiActor.procedurallyOutlined       = true;
                companion.aiActor.CanTargetPlayers           = true;

                ItemsMod.Strings.Enemies.Set("#KILLSHRINE", "Sepulchergiest");
                ItemsMod.Strings.Enemies.Set("#????", "???");
                ItemsMod.Strings.Enemies.Set("#KILLSHRINESUBTITLE", "KILL SHRINE");
                ItemsMod.Strings.Enemies.Set("#KILLSHRINEQUOTE", "THE SHRINING");
                companion.aiActor.healthHaver.overrideBossName = "#KILLSHRINE";
                companion.aiActor.OverrideDisplayName          = "#KILLSHRINE";
                companion.aiActor.ActorName = "#KILLSHRINE";
                companion.aiActor.name      = "#KILLSHRINE";
                companion.aiActor.SetIsFlying(true, "Flying Enemy", true, true);

                prefab.name = companion.aiActor.OverrideDisplayName;

                GenericIntroDoer miniBossIntroDoer = prefab.AddComponent <GenericIntroDoer>();
                miniBossIntroDoer.triggerType  = GenericIntroDoer.TriggerType.PlayerEnteredRoom;
                miniBossIntroDoer.initialDelay = 0.15f;

                miniBossIntroDoer.cameraMoveSpeed        = 14;
                miniBossIntroDoer.specifyIntroAiAnimator = null;
                miniBossIntroDoer.BossMusicEvent         = "Play_MUS_Boss_Theme_Beholster";
                companion.aiActor.ShadowObject           = EnemyDatabase.GetOrLoadByGuid("c00390483f394a849c36143eb878998f").ShadowObject;
                companion.aiActor.HasShadow        = true;
                miniBossIntroDoer.PreventBossMusic = false;

                miniBossIntroDoer.InvisibleBeforeIntroAnim = false;
                miniBossIntroDoer.preIntroAnim             = string.Empty;
                miniBossIntroDoer.preIntroDirectionalAnim  = string.Empty;
                miniBossIntroDoer.introAnim                  = "intro";
                miniBossIntroDoer.introDirectionalAnim       = string.Empty;
                miniBossIntroDoer.continueAnimDuringOutro    = false;
                miniBossIntroDoer.cameraFocus                = null;
                miniBossIntroDoer.roomPositionCameraFocus    = Vector2.zero;
                miniBossIntroDoer.restrictPlayerMotionToRoom = false;
                miniBossIntroDoer.fusebombLock               = false;
                miniBossIntroDoer.AdditionalHeightOffset     = 0;
                miniBossIntroDoer.portraitSlideSettings      = new PortraitSlideSettings()
                {
                    bossNameString          = "#KILLSHRINE",
                    bossSubtitleString      = "#KILLSHRINESUBTITLE",
                    bossQuoteString         = "#KILLSHRINEQUOTE",
                    bossSpritePxOffset      = IntVector2.Zero,
                    topLeftTextPxOffset     = IntVector2.Zero,
                    bottomRightTextPxOffset = IntVector2.Zero,
                    bgColor = Color.cyan
                };
                miniBossIntroDoer.SkipBossCard = false;
                miniBossIntroDoer.portraitSlideSettings.bossArtSprite = BossCardTexture;
                companion.aiActor.healthHaver.bossHealthBar           = HealthHaver.BossBarType.MainBar;
                miniBossIntroDoer.SkipFinalizeAnimation = true;

                miniBossIntroDoer.RegenerateCache();
                //BehaviorSpeculator aIActor = EnemyDatabase.GetOrLoadByGuid("465da2bb086a4a88a803f79fe3a27677").behaviorSpeculator;
                //Tools.DebugInformation(aIActor);

                /////



                companion.aiActor.healthHaver.SetHealthMaximum(500f, 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          = 15,
                    ManualOffsetY          = 10,
                    ManualWidth            = 60,
                    ManualHeight           = 80,
                    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          = 15,
                    ManualOffsetY          = 10,
                    ManualWidth            = 60,
                    ManualHeight           = 80,
                    ManualDiameter         = 0,
                    ManualLeftX            = 0,
                    ManualLeftY            = 0,
                    ManualRightX           = 0,
                    ManualRightY           = 0,
                });
                companion.aiActor.CorpseObject        = EnemyDatabase.GetOrLoadByGuid("c0ff3744760c4a2eb0bb52ac162056e6").CorpseObject;
                companion.aiActor.PreventBlackPhantom = false;
                AIAnimator aiAnimator = companion.aiAnimator;
                aiAnimator.IdleAnimation = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.Single,
                    Prefix    = "idle",
                    AnimNames = new string[1],
                    Flipped   = new DirectionalAnimation.FlipType[1]
                };
                DirectionalAnimation almostdone = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.Single,
                    Prefix    = "intro",
                    AnimNames = new string[1],
                    Flipped   = new DirectionalAnimation.FlipType[1]
                };
                aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation>
                {
                    new AIAnimator.NamedDirectionalAnimation
                    {
                        name = "intro",
                        anim = almostdone
                    }
                };
                bool flag3 = BishopCollection == null;
                if (flag3)
                {
                    BishopCollection = SpriteBuilder.ConstructCollection(prefab, "FlameChamber_Collection");
                    UnityEngine.Object.DontDestroyOnLoad(BishopCollection);
                    for (int i = 0; i < spritePaths.Length; i++)
                    {
                        SpriteBuilder.AddSpriteToCollection(spritePaths[i], BishopCollection);
                    }
                    SpriteBuilder.AddAnimation(companion.spriteAnimator, BishopCollection, new List <int>
                    {
                        0,
                        1
                    }, "idle", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 7f;

                    SpriteBuilder.AddAnimation(companion.spriteAnimator, BishopCollection, new List <int>
                    {
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8
                    }, "intro", tk2dSpriteAnimationClip.WrapMode.Once).fps = 7f;
                }
                var bs = prefab.GetComponent <BehaviorSpeculator>();
                BehaviorSpeculator behaviorSpeculator = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5").behaviorSpeculator;
                bs.OverrideBehaviors          = behaviorSpeculator.OverrideBehaviors;
                bs.OtherBehaviors             = behaviorSpeculator.OtherBehaviors;
                shootpoint                    = new GameObject("attach");
                shootpoint.transform.parent   = companion.transform;
                shootpoint.transform.position = companion.sprite.WorldCenter;
                GameObject m_CachedGunAttachPoint = companion.transform.Find("attach").gameObject;
                bs.TargetBehaviors = new List <TargetBehaviorBase>
                {
                    new TargetPlayerBehavior
                    {
                        Radius              = 35f,
                        LineOfSight         = false,
                        ObjectPermanence    = true,
                        SearchInterval      = 0.25f,
                        PauseOnTargetSwitch = false,
                        PauseTime           = 0.25f
                    }
                };
                float[] angles = { 45, 135, 225, 135 };
                bs.MovementBehaviors = new List <MovementBehaviorBase>
                {
                };

                bs.AttackBehaviorGroup.AttackBehaviors = new List <AttackBehaviorGroup.AttackGroupItem>
                {
                };


                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("cak:killshrine", companion.aiActor);
            }
        }