コード例 #1
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);
            }
        }
コード例 #2
0
ファイル: FlameChamber.cs プロジェクト: Lichton/Fallen-Items
        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);
            }
        }
コード例 #3
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);
            }
        }