Beispiel #1
0
 private void Awake()
 {
     InSightList    = new List <Soldier>();
     mapPathFinding = this.GetComponent <AIDestinationSetter>();
     data           = this.GetComponent <EnemyDataModel>();
     aniCon         = this.GetComponent <DirectionalAnimation>();
 }
Beispiel #2
0
        // Token: 0x060000C0 RID: 192 RVA: 0x0000891C File Offset: 0x00006B1C
        public static tk2dSpriteAnimationClip AddAnimation(this GameObject obj, string name, string spriteDirectory, int fps, CompanionBuilder.AnimationType type, DirectionalAnimation.DirectionType directionType = DirectionalAnimation.DirectionType.None, DirectionalAnimation.FlipType flipType = DirectionalAnimation.FlipType.None)
        {
            AIAnimator           orAddComponent       = obj.GetOrAddComponent <AIAnimator>();
            DirectionalAnimation directionalAnimation = orAddComponent.GetDirectionalAnimation(name, directionType, type);
            bool flag = directionalAnimation == null;

            if (flag)
            {
                directionalAnimation = new DirectionalAnimation
                {
                    AnimNames = new string[0],
                    Flipped   = new DirectionalAnimation.FlipType[0],
                    Type      = directionType,
                    Prefix    = string.Empty
                };
            }
            directionalAnimation.AnimNames = directionalAnimation.AnimNames.Concat(new string[]
            {
                name
            }).ToArray <string>();
            directionalAnimation.Flipped = directionalAnimation.Flipped.Concat(new DirectionalAnimation.FlipType[]
            {
                flipType
            }).ToArray <DirectionalAnimation.FlipType>();
            orAddComponent.AssignDirectionalAnimation(name, directionalAnimation, type);
            return(CompanionBuilder.BuildAnimation(orAddComponent, name, spriteDirectory, fps));
        }
        // Token: 0x06000052 RID: 82 RVA: 0x00004A28 File Offset: 0x00002C28
        public static tk2dSpriteAnimationClip AddAnimation(this GameObject obj, string name, string spriteDirectory, int fps, NPCBuilder.AnimationType type, DirectionalAnimation.DirectionType directionType = DirectionalAnimation.DirectionType.None, DirectionalAnimation.FlipType flipType = DirectionalAnimation.FlipType.None)
        {
            obj.AddComponent <tk2dSpriteAnimator>();
            AIAnimator aianimator = obj.GetComponent <AIAnimator>();
            bool       flag       = !aianimator;

            if (flag)
            {
                aianimator = NPCBuilder.CreateNewAIAnimator(obj);
            }
            DirectionalAnimation directionalAnimation = aianimator.GetDirectionalAnimation(name, directionType, type);
            bool flag2 = directionalAnimation == null;

            if (flag2)
            {
                directionalAnimation = new DirectionalAnimation
                {
                    AnimNames = new string[0],
                    Flipped   = new DirectionalAnimation.FlipType[0],
                    Type      = directionType,
                    Prefix    = string.Empty
                };
            }
            directionalAnimation.AnimNames = directionalAnimation.AnimNames.Concat(new string[]
            {
                name
            }).ToArray <string>();
            directionalAnimation.Flipped = directionalAnimation.Flipped.Concat(new DirectionalAnimation.FlipType[]
            {
                flipType
            }).ToArray <DirectionalAnimation.FlipType>();
            aianimator.AssignDirectionalAnimation(name, directionalAnimation, type);
            return(NPCBuilder.BuildAnimation(aianimator, name, spriteDirectory, fps));
        }
Beispiel #4
0
        public static tk2dSpriteAnimationClip AddAnimation(this GameObject obj, string name, string spriteDirectory, int fps,
                                                           AnimationType type, DirectionType directionType = DirectionType.None, FlipType flipType = FlipType.None)
        {
            obj.AddComponent <tk2dSpriteAnimator>();
            AIAnimator aiAnimator = obj.GetComponent <AIAnimator>();

            if (!aiAnimator)
            {
                aiAnimator = CreateNewAIAnimator(obj);
            }
            DirectionalAnimation animation = aiAnimator.GetDirectionalAnimation(name, directionType, type);

            if (animation == null)
            {
                animation = new DirectionalAnimation()
                {
                    AnimNames = new string[0],
                    Flipped   = new FlipType[0],
                    Type      = directionType,
                    Prefix    = string.Empty
                };
            }

            animation.AnimNames = animation.AnimNames.Concat(new string[] { name }).ToArray();
            animation.Flipped   = animation.Flipped.Concat(new FlipType[] { flipType }).ToArray();
            aiAnimator.AssignDirectionalAnimation(name, animation, type);
            return(BuildAnimation(aiAnimator, name, spriteDirectory, fps));
        }
Beispiel #5
0
 public void SetAnimation(DirectionalAnimation animation)
 {
     Sprites          = animation.Sprites;
     CurrentDirection = animation.Direction;
     CurrentAnimation = animation.Name;
     Restart();
 }
Beispiel #6
0
        public static tk2dSpriteAnimationClip AddAnimation(this GameObject obj, string name, string spriteDirectory, int fps, AnimationType type, DirectionType directionType = DirectionType.None, tk2dSpriteAnimationClip.WrapMode wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, FlipType flipType = FlipType.None, bool assignAnimation = true)
        {
            AIAnimator           aiAnimator = obj.GetOrAddComponent <AIAnimator>();
            DirectionalAnimation animation  = aiAnimator.GetDirectionalAnimation(name, directionType, type);

            if (animation == null)
            {
                animation = new DirectionalAnimation()
                {
                    AnimNames = new string[0],
                    Flipped   = new FlipType[0],
                    Type      = directionType,
                    Prefix    = string.Empty
                };
            }

            animation.AnimNames = animation.AnimNames.Concat(new string[] { name }).ToArray();
            animation.Flipped   = animation.Flipped.Concat(new FlipType[] { flipType }).ToArray();

            if (assignAnimation)
            {
                aiAnimator.AssignDirectionalAnimation(name, animation, type);
            }
            return(BuildAnimation(aiAnimator, name, spriteDirectory, fps, wrapMode));
        }
Beispiel #7
0
 private void Awake()
 {
     data           = this.GetComponent <SoldierDataModel>();
     mapPathFinding = this.GetComponent <MapPathFindingBehaviour>();
     InSightList    = new List <Enemy>();
     aniCon         = this.GetComponent <DirectionalAnimation>();
 }
Beispiel #8
0
        public static DirectionalAnimation GetDirectionalAnimation(this AIAnimator aiAnimator, string name, DirectionType directionType, AnimationType type)
        {
            DirectionalAnimation result = null;

            switch (type)
            {
            case AnimationType.Idle:
                result = aiAnimator.IdleAnimation;
                break;

            case AnimationType.Move:
                result = aiAnimator.MoveAnimation;
                break;

            case AnimationType.Flight:
                result = aiAnimator.FlightAnimation;
                break;

            case AnimationType.Hit:
                result = aiAnimator.HitAnimation;
                break;

            case AnimationType.Talk:
                result = aiAnimator.TalkAnimation;
                break;
            }
            if (result != null)
            {
                return(result);
            }

            return(null);
        }
Beispiel #9
0
 public CreatureAnimation()
 {
     north = new DirectionalAnimation(Direction.North);
     south = new DirectionalAnimation(Direction.South);
     east  = new DirectionalAnimation(Direction.East);
     west  = new DirectionalAnimation(Direction.West);
 }
Beispiel #10
0
 public static void BuildPrefab()
 {
     if (prefab == null && !CompanionBuilder.companionDictionary.ContainsKey("lil_crewmate"))
     {
         prefab = CompanionBuilder.BuildPrefab("Lil Crewmate", "lil_crewmate", "ImposterItems/Resources/Crewmate/IdleRight/lilguy_idle_right_001", new IntVector2(0, 0), new IntVector2(7, 9));
         var           companion = prefab.AddComponent <CompanionController>();
         PixelCollider collider  = new PixelCollider();
         collider.ColliderGenerationMode     = PixelCollider.PixelColliderGeneration.Manual;
         collider.CollisionLayer             = CollisionLayer.EnemyHitBox;
         collider.ManualWidth                = 7;
         collider.ManualHeight               = 9;
         collider.ManualOffsetX              = 0;
         collider.ManualOffsetY              = 0;
         companion.aiActor.HitByEnemyBullets = false;
         companion.aiActor.IsNormalEnemy     = false;
         companion.CanBePet            = true;
         companion.CanInterceptBullets = true;
         companion.specRigidbody.PixelColliders.Add(collider);
         companion.specRigidbody.CollideWithOthers = true;
         companion.aiActor.CollisionDamage         = 0f;
         companion.aiActor.MovementSpeed           = 7.2f;
         companion.aiActor.HitByEnemyBullets       = true;
         companion.aiActor.CanDropCurrency         = false;
         prefab.AddAnimation("idle_right", "ImposterItems/Resources/Crewmate/IdleRight", 5, AnimationType.Idle, DirectionType.TwoWayHorizontal);
         prefab.AddAnimation("idle_left", "ImposterItems/Resources/Crewmate/IdleLeft", 5, AnimationType.Idle, DirectionType.TwoWayHorizontal);
         prefab.AddAnimation("run_right", "ImposterItems/Resources/Crewmate/MoveRight", 16, AnimationType.Move, DirectionType.TwoWayHorizontal);
         prefab.AddAnimation("run_left", "ImposterItems/Resources/Crewmate/MoveLeft", 16, AnimationType.Move, DirectionType.TwoWayHorizontal);
         prefab.AddAnimation("pet_right", "ImposterItems/Resources/Crewmate/PetRight", 5, AnimationType.Move, DirectionType.TwoWayHorizontal, assignAnimation: false);
         prefab.AddAnimation("pet_left", "ImposterItems/Resources/Crewmate/PetLeft", 5, AnimationType.Move, DirectionType.TwoWayHorizontal, assignAnimation: false);
         DirectionalAnimation animation = new DirectionalAnimation()
         {
             AnimNames = new string[] { "pet_right", "pet_left" },
             Flipped   = new FlipType[] { FlipType.None, FlipType.None },
             Type      = DirectionType.TwoWayHorizontal,
             Prefix    = string.Empty
         };
         companion.aiAnimator.AssignDirectionalAnimation("pet", animation, AnimationType.Other);
         var bs = prefab.GetComponent <BehaviorSpeculator>();
         bs.MovementBehaviors.Add(new CompanionFollowPlayerBehavior()
         {
             IdleAnimations = new string[] { "idle" }, DisableInCombat = false
         });
     }
 }
Beispiel #11
0
        // Token: 0x0600015E RID: 350 RVA: 0x0000D3F8 File Offset: 0x0000B5F8
        public static DirectionalAnimation GetDirectionalAnimation(this AIAnimator aiAnimator, string name, DirectionalAnimation.DirectionType directionType, NPCBuilder.AnimationType type)
        {
            DirectionalAnimation directionalAnimation = null;

            switch (type)
            {
            case NPCBuilder.AnimationType.Move:
                directionalAnimation = aiAnimator.MoveAnimation;
                break;

            case NPCBuilder.AnimationType.Idle:
                directionalAnimation = aiAnimator.IdleAnimation;
                break;

            case NPCBuilder.AnimationType.Flight:
                directionalAnimation = aiAnimator.FlightAnimation;
                break;

            case NPCBuilder.AnimationType.Hit:
                directionalAnimation = aiAnimator.HitAnimation;
                break;

            case NPCBuilder.AnimationType.Talk:
                directionalAnimation = aiAnimator.TalkAnimation;
                break;
            }
            bool flag  = directionalAnimation != null;
            bool flag2 = flag;
            bool flag3 = flag2;
            DirectionalAnimation result;

            if (flag3)
            {
                result = directionalAnimation;
            }
            else
            {
                result = null;
            }
            return(result);
        }
Beispiel #12
0
    void DirectionalAnimationMenu(DirectionalAnimation dirAnim)
    {
        dirAnim.direction = (Direction)EditorGUILayout.EnumPopup(dirAnim.direction);

        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Standing", GUILayout.Width(100f));
        dirAnim.standing = (Sprite)EditorGUILayout.ObjectField(dirAnim.standing, typeof(Sprite));
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Left", GUILayout.Width(100f));
        dirAnim.left = (Sprite)EditorGUILayout.ObjectField(dirAnim.left, typeof(Sprite));
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Right", GUILayout.Width(100f));
        dirAnim.right = (Sprite)EditorGUILayout.ObjectField(dirAnim.right, typeof(Sprite));
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();
    }
Beispiel #13
0
//Public Controls

    public void SetDirection(Direction direction)
    {
        switch (direction)
        {
        case Direction.North:
            current = north;
            break;

        case Direction.South:
            current = south;
            break;

        case Direction.East:
            current = east;
            break;

        case Direction.West:
            current = west;
            break;
        }
    }
Beispiel #14
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);
            }
        }
Beispiel #15
0
        public static void BuildPrefab()
        {
            if (prefab == null || !EnemyBuilder.Dictionary.ContainsKey(guid))
            {
                //Sets up the prefab of the enemy. The spritepath, "CakeMod/Resources/DemonGuy/Idle/milton_idle_001", determines the setup sprite for your enemy. vvvv This bool right here determines whether or not an enemy has an AiShooter or not. AIShooters are necessary if you want your enemy to hold a gun for example. An example of this can be seen in here.
                prefab = EnemyBuilder.BuildPrefab("DemonGuy", guid, "CakeMod/Resources/DemonGuy/Idle/bullet_demon_idle_001", new IntVector2(0, 0), new IntVector2(0, 0), true);
                //This line extends a BraveBehavior called EnemyBehavior, this is a generic behavior I use for setting up things that can't be setup in BuildPrefab.
                var enemy = prefab.AddComponent <EnemyBehavior>();
                //Here you can setup various things like movement speed, weight, and health. There's a lot you can do with the AiActor parameter so feel free to experiment.
                //For DemonGuy let's make him a flying enemy
                enemy.aiActor.MovementSpeed        = 2f;
                enemy.aiActor.knockbackDoer.weight = 100;
                enemy.aiActor.IgnoreForRoomClear   = false;
                enemy.aiActor.CollisionDamage      = 1f;
                enemy.aiActor.healthHaver.ForceSetCurrentHealth(30f);
                enemy.aiActor.healthHaver.SetHealthMaximum(45f, null, false);
                //This is where you setup your animations. Most animations need specific frame names to be recognized like idle or die.
                //The AddAnimation lines gets sprites from the folder specified in second phrase of the this line. At the very least you need an animation that contains the word idle for the idle animations for example.
                //AnimationType determines what kind of animation your making. In Gungeon there are 7 different Animation Types: Move, Idle, Fidget, Flight, Hit, Talk, Other. For a majority of these animations, these play automatically, however specific animations need to be told when to play such as Attack.
                //DirectionType determines the amount of ways an animation can face. You'll have to change your animation names to correspond with the DirectionType. For example if you want an animation to face eight ways you'll have to name your animations something like ""attack_south_west", "attack_north_east",  "attack_east", "attack_south_east",  "attack_north",  "attack_south", "attack_west", "attack_north_west" and change DirectionType to  DirectionType.EightWayOrdinal.
                //I suggest looking at the sprites of base game enemies to determine the names for the different directions.
                prefab.AddAnimation("idle_left", "CakeMod/Resources/DemonGuy/Idle", fps: 5, AnimationType.Idle, DirectionType.FourWay);
                prefab.AddAnimation("idle_right", "CakeMod/Resources/DemonGuy/Idle", fps: 5, AnimationType.Idle, DirectionType.FourWay);
                prefab.AddAnimation("move_front_right", "CakeMod/Resources/DemonGuy/MoveFrontRight", fps: 5, AnimationType.Move, DirectionType.FourWay);
                prefab.AddAnimation("move_back_right", "CakeMod/Resources/DemonGuy/MoveBackRight", fps: 5, AnimationType.Move, DirectionType.FourWay);
                prefab.AddAnimation("move_front_left", "CakeMod/Resources/DemonGuy/MoveFrontLeft", fps: 5, AnimationType.Move, DirectionType.FourWay);
                prefab.AddAnimation("move_back_left", "CakeMod/Resources/DemonGuy/MoveBackLeft", fps: 5, AnimationType.Move, DirectionType.FourWay);
                //Note that the "die"animations are only set to Move because they will be overwritten later.
                //tk2dSpriteAnimationClip.WrapMode.Once determines how an animation plays out. If you don't want it to loop, leave it to Once, otherwise you can change it to Loop or something.
                //Assign animation well, assigns an animation to an animation type. By default this is on, but since we're overwritting this set this to false.
                prefab.AddAnimation("die_left", "CakeMod/Resources/DemonGuy/Die", fps: 8, AnimationType.Move, DirectionType.TwoWayHorizontal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);
                prefab.AddAnimation("die_right", "CakeMod/Resources/DemonGuy/Die", fps: 8, AnimationType.Move, DirectionType.TwoWayHorizontal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);
                //Here we create a new DirectionalAnimation for our enemy to pull from.
                //Make sure the AnimNames correspong to the AddAnimation names.
                DirectionalAnimation idle = new DirectionalAnimation()
                {
                    AnimNames = new string[] { "idle_right", "idle_left" },
                    Flipped   = new FlipType[] { FlipType.None, FlipType.None },
                    Type      = DirectionType.TwoWayHorizontal,
                    Prefix    = string.Empty
                };
                DirectionalAnimation die = new DirectionalAnimation()
                {
                    AnimNames = new string[] { "die_right", "die_left" },
                    Flipped   = new FlipType[] { FlipType.None, FlipType.None },
                    Type      = DirectionType.TwoWayHorizontal,
                    Prefix    = string.Empty
                };
                //Because Dodge Roll is Dodge Roll and there is no animation types for death, we have to assign them to the Other category.
                enemy.aiAnimator.AssignDirectionalAnimation("die", die, AnimationType.Other);
                //This is where we get into the meat and potatoes of our enemy. This is where all the behaviors of our enemy are made.

                //this line adds a BehaviorSpeculator to our enemy which is the base for adding behaviors on to.
                var bs = prefab.GetComponent <BehaviorSpeculator>();
                //We're also going to duplicate the bulletbank and aishooter from the Bullet Kin.
                //The "762" represents the the gun id we want our enemy to hold. For a list of all gun ids, look at the items file on this github.
                //For now let's give him the finished gun.
                GameObject m_CachedGunAttachPoint = enemy.transform.Find("GunAttachPoint").gameObject;
                Vector2    offset = new Vector2(1f, -0.50f);
                m_CachedGunAttachPoint.transform.position = enemy.sprite.WorldCenter + offset;
                AIActor SourceEnemy = EnemyDatabase.GetOrLoadByGuid("5f3abc2d561b4b9c9e72b879c6f10c7e5f3abc2d561b4b9c9e72b879c6f10c7e");
                EnemyBuilder.DuplicateAIShooterAndAIBulletBank(prefab, SourceEnemy.aiShooter, SourceEnemy.GetComponent <AIBulletBank>(), 476, enemy.sprite.transform);

                //Here we will add some basic behaviors such as TargetPlayerBehavior and SeekTargetBehavior.
                //You can change many things in these behaviors so feel free to go nuts.
                bs.TargetBehaviors = new List <TargetBehaviorBase>
                {
                    new TargetPlayerBehavior
                    {
                        Radius              = 35f,
                        LineOfSight         = true,
                        ObjectPermanence    = true,
                        SearchInterval      = 0.25f,
                        PauseOnTargetSwitch = false,
                        PauseTime           = 0.25f,
                    }
                };
                //Now this is one of the most important behaviors because it allows our enemy to shoot.
                //If we want our enemy to shoot out of a gun, use ShootGunBehavior
                bs.AttackBehaviors = new List <AttackBehaviorBase>()
                {
                    new ShootGunBehavior()
                    {
                        GroupCooldownVariance = 0.2f,
                        LineOfSight           = false,
                        //With weapon type you can determine if you want your enemy to fire the gun directly or to use a bullet script. Let's use a Bullet Script for now. For the rest of code, let's modify it to be close to the Finished Gun.
                        WeaponType                   = WeaponType.BulletScript,
                        OverrideBulletName           = null,
                        BulletScript                 = new CustomBulletScriptSelector(typeof(DemonGuyScript)),
                        FixTargetDuringAttack        = true,
                        StopDuringAttack             = true,
                        LeadAmount                   = 0,
                        LeadChance                   = 1,
                        RespectReload                = true,
                        MagazineCapacity             = 6,
                        ReloadSpeed                  = 2f,
                        EmptiesClip                  = true,
                        SuppressReloadAnim           = false,
                        TimeBetweenShots             = -1,
                        PreventTargetSwitching       = true,
                        OverrideAnimation            = null,
                        OverrideDirectionalAnimation = null,
                        HideGun                      = false,
                        UseLaserSight                = false,
                        UseGreenLaser                = false,
                        PreFireLaserTime             = -1,
                        AimAtFacingDirectionWhenSafe = false,
                        Cooldown                     = 0.7f,
                        CooldownVariance             = 0,
                        AttackCooldown               = 0,
                        GlobalCooldown               = 0,
                        InitialCooldown              = 0,
                        InitialCooldownVariance      = 0,
                        GroupName                    = null,
                        GroupCooldown                = 0,
                        MinRange                     = 0,
                        Range                      = 16,
                        MinWallDistance            = 0,
                        MaxEnemiesInRoom           = 0,
                        MinHealthThreshold         = 0,
                        MaxHealthThreshold         = 1,
                        HealthThresholds           = new float[0],
                        AccumulateHealthThresholds = true,
                        targetAreaStyle            = null,
                        IsBlackPhantom             = false,
                        resetCooldownOnDamage      = null,
                        RequiresLineOfSight        = true,
                        MaxUsages                  = 0,
                    }
                };
                bs.MovementBehaviors = new List <MovementBehaviorBase>
                {
                    new SeekTargetBehavior
                    {
                        StopWhenInRange     = false,
                        CustomRange         = 15f,
                        LineOfSight         = false,
                        ReturnToSpawn       = false,
                        SpawnTetherDistance = 0f,
                        PathInterval        = 0.5f,
                        SpecifyRange        = false,
                        MinActiveRange      = 0f,
                        MaxActiveRange      = 0f
                    }
                };
                //Adds the enemy to MTG spawn pool and spawn command
                Game.Enemies.Add("cak:greeddemon", enemy.aiActor);
            }
        }
        public static DirectionalAnimation GetDirectionalAnimation(this AIAnimator self, string animName)
        {
            if (string.IsNullOrEmpty(animName))
            {
                return(null);
            }
            if (animName.Equals("idle", StringComparison.OrdinalIgnoreCase))
            {
                return(self.IdleAnimation);
            }
            if (animName.Equals("move", StringComparison.OrdinalIgnoreCase))
            {
                return(self.MoveAnimation);
            }
            if (animName.Equals("talk", StringComparison.OrdinalIgnoreCase))
            {
                return(self.TalkAnimation);
            }
            if (animName.Equals("hit", StringComparison.OrdinalIgnoreCase))
            {
                return(self.HitAnimation);
            }
            if (animName.Equals("flight", StringComparison.OrdinalIgnoreCase))
            {
                return(self.FlightAnimation);
            }
            DirectionalAnimation result = null;
            int num = 0;

            for (int i = 0; i < self.OtherAnimations.Count; i++)
            {
                if (animName.Equals(self.OtherAnimations[i].name, StringComparison.OrdinalIgnoreCase))
                {
                    num++;
                    result = self.OtherAnimations[i].anim;
                }
            }
            if (num == 0)
            {
                return(null);
            }
            if (num == 1)
            {
                return(result);
            }
            int num2 = UnityEngine.Random.Range(0, num);

            num = 0;
            for (int j = 0; j < self.OtherAnimations.Count; j++)
            {
                if (animName.Equals(self.OtherAnimations[j].name, StringComparison.OrdinalIgnoreCase))
                {
                    if (num == num2)
                    {
                        return(self.OtherAnimations[j].anim);
                    }
                    num++;
                }
            }
            return(null);
        }
Beispiel #17
0
 public Player(MyGame g, String assetName, Rectangle bounds)
     : base(g, assetName, bounds)
 {
     this.animation = new DirectionalAnimation<Player>(this, Constants.DEFAULT_PLAYER_VELOCITY);
     this.animation.Finished += animation_Finished;
 }
Beispiel #18
0
        public static void BuildPrefab()
        {
            bool flag = prefab != null || EnemyBuilder.Dictionary.ContainsKey(guid);

            bool flag2 = flag;

            if (!flag2)
            {
                prefab = EnemyBuilder.BuildPrefab("Hunter Kin", guid, "Items/Enemies/Sprites/Hunter_Kin/Idle_Front_Right/hunter_kin_idle_front_right_001", new IntVector2(0, 0), new IntVector2(0, 0), true, true);
                var enemy = prefab.AddComponent <EnemyBehavior>();

                enemy.aiActor.knockbackDoer.weight         = 35;
                enemy.aiActor.MovementSpeed                = 4f;
                enemy.aiActor.healthHaver.PreventAllDamage = false;
                enemy.aiActor.CollisionDamage              = 1f;
                enemy.aiActor.HasShadow                        = false;
                enemy.aiActor.IgnoreForRoomClear               = false;
                enemy.aiActor.aiAnimator.HitReactChance        = 0f;
                enemy.aiActor.specRigidbody.CollideWithOthers  = true;
                enemy.aiActor.specRigidbody.CollideWithTileMap = true;
                enemy.aiActor.PreventFallingInPitsEver         = false;
                enemy.aiActor.healthHaver.ForceSetCurrentHealth(25f);
                enemy.aiActor.CollisionKnockbackStrength = 5f;
                enemy.aiActor.CanTargetPlayers           = true;
                enemy.aiActor.healthHaver.SetHealthMaximum(25f, null, false);


                prefab.AddAnimation("idle_back_right", "Items/Enemies/Sprites/Hunter_Kin/Idle_Back_Right", fps: 5, AnimationType.Idle, DirectionType.FourWay);
                prefab.AddAnimation("idle_front_right", "Items/Enemies/Sprites/Hunter_Kin/Idle_Front_Right", fps: 5, AnimationType.Idle, DirectionType.FourWay);
                prefab.AddAnimation("idle_front_left", "Items/Enemies/Sprites/Hunter_Kin/Idle_Front_Left", fps: 5, AnimationType.Idle, DirectionType.FourWay);
                prefab.AddAnimation("idle_back_left", "Items/Enemies/Sprites/Hunter_Kin/Idle_Back_Left", fps: 5, AnimationType.Idle, DirectionType.FourWay);
                //
                prefab.AddAnimation("run_back_right", "Items/Enemies/Sprites/Hunter_Kin/Run_Back_Right", fps: 5, AnimationType.Move, DirectionType.FourWay);
                prefab.AddAnimation("run_front_right", "Items/Enemies/Sprites/Hunter_Kin/Run_Front_Right", fps: 5, AnimationType.Move, DirectionType.FourWay);
                prefab.AddAnimation("run_front_left", "Items/Enemies/Sprites/Hunter_Kin/Run_Front_Left", fps: 5, AnimationType.Move, DirectionType.FourWay);
                prefab.AddAnimation("run_back_left", "Items/Enemies/Sprites/Hunter_Kin/Run_Back_Left", fps: 5, AnimationType.Move, DirectionType.FourWay);
                //
                prefab.AddAnimation("die_north", "Items/Enemies/Sprites/Hunter_Kin/Die_North", fps: 5, AnimationType.Move, DirectionType.EightWayOrdinal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);
                prefab.AddAnimation("die_north_east", "Items/Enemies/Sprites/Hunter_Kin/Die_North_East", fps: 5, AnimationType.Move, DirectionType.EightWayOrdinal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);
                prefab.AddAnimation("die_east", "Items/Enemies/Sprites/Hunter_Kin/Die_East", fps: 5, AnimationType.Move, DirectionType.EightWayOrdinal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);
                prefab.AddAnimation("die_south_east", "Items/Enemies/Sprites/Hunter_Kin/Die_South_East", fps: 5, AnimationType.Move, DirectionType.EightWayOrdinal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);
                prefab.AddAnimation("die_south", "Items/Enemies/Sprites/Hunter_Kin/Die_South", fps: 5, AnimationType.Move, DirectionType.EightWayOrdinal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);
                prefab.AddAnimation("die_south_west", "Items/Enemies/Sprites/Hunter_Kin/Die_South_West", fps: 5, AnimationType.Move, DirectionType.EightWayOrdinal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);
                prefab.AddAnimation("die_west", "Items/Enemies/Sprites/Hunter_Kin/Die_West", fps: 5, AnimationType.Move, DirectionType.EightWayOrdinal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);
                prefab.AddAnimation("die_north_west", "Items/Enemies/Sprites/Hunter_Kin/Die_North_West", fps: 5, AnimationType.Move, DirectionType.EightWayOrdinal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);
                //
                prefab.AddAnimation("summon", "Items/Enemies/Sprites/Hunter_Kin/Summon", fps: 7, AnimationType.Move, DirectionType.Single, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);

                DirectionalAnimation die = new DirectionalAnimation()
                {
                    AnimNames = new string[] { "die_north", "die_north_east", "die_east", "die_south_east", "die_south", "die_south_west", "die_west", "die_north_west" },
                    Flipped   = new FlipType[] { FlipType.None, FlipType.None, FlipType.None, FlipType.None, FlipType.None, FlipType.None, FlipType.None, FlipType.None, },
                    Type      = DirectionType.EightWayOrdinal,
                    Prefix    = string.Empty
                };
                DirectionalAnimation summon = new DirectionalAnimation()
                {
                    AnimNames = new string[] { "summon" },
                    Flipped   = new FlipType[] { FlipType.None },
                    Type      = DirectionType.Single,
                    Prefix    = string.Empty
                };

                enemy.aiAnimator.AssignDirectionalAnimation("die", die, AnimationType.Other);
                enemy.aiAnimator.AssignDirectionalAnimation("summon", summon, AnimationType.Other);
                enemy.aiActor.specRigidbody.PixelColliders.Clear();
                enemy.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider
                {
                    ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual,
                    CollisionLayer         = CollisionLayer.EnemyCollider,
                    IsTrigger = false,
                    BagleUseFirstFrameOnly = false,
                    SpecifyBagelFrame      = string.Empty,
                    BagelColliderNumber    = 0,
                    ManualOffsetX          = 0,
                    ManualOffsetY          = 0,
                    ManualWidth            = 14,
                    ManualHeight           = 24,
                    ManualDiameter         = 0,
                    ManualLeftX            = 0,
                    ManualLeftY            = 0,
                    ManualRightX           = 0,
                    ManualRightY           = 0
                });

                enemy.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider
                {
                    ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual,
                    CollisionLayer         = CollisionLayer.EnemyHitBox,
                    IsTrigger = false,
                    BagleUseFirstFrameOnly = false,
                    SpecifyBagelFrame      = string.Empty,
                    BagelColliderNumber    = 0,
                    ManualOffsetX          = 0,
                    ManualOffsetY          = 0,
                    ManualWidth            = 14,
                    ManualHeight           = 24,
                    ManualDiameter         = 0,
                    ManualLeftX            = 0,
                    ManualLeftY            = 0,
                    ManualRightX           = 0,
                    ManualRightY           = 0,
                });

                enemy.aiActor.PreventBlackPhantom = false;

                AIAnimator aiAnimator = enemy.aiAnimator;
                var        yah        = enemy.transform.Find("GunAttachPoint").gameObject;
                yah.transform.position      = enemy.aiActor.transform.position;
                yah.transform.localPosition = new Vector2(0f, .3f);
                AIActor SourceEnemy = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5");
                EnemyBuilder.DuplicateAIShooterAndAIBulletBank(prefab, SourceEnemy.aiShooter, SourceEnemy.GetComponent <AIBulletBank>(), 12, yah.transform);
                var bs = prefab.GetComponent <BehaviorSpeculator>();
                BehaviorSpeculator behaviorSpeculator = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5").behaviorSpeculator;

                bs.OverrideBehaviors = behaviorSpeculator.OverrideBehaviors;
                bs.OtherBehaviors    = behaviorSpeculator.OtherBehaviors;
                bs.TargetBehaviors   = new List <TargetBehaviorBase>
                {
                    new TargetPlayerBehavior
                    {
                        Radius              = 45f,
                        LineOfSight         = true,
                        ObjectPermanence    = true,
                        SearchInterval      = 0.25f,
                        PauseOnTargetSwitch = false,
                        PauseTime           = 0.25f
                    },
                };

                AIActor Firecracker = EnemyDatabase.GetOrLoadByGuid("5f15093e6f684f4fb09d3e7e697216b4");
                bs.AttackBehaviors = new List <AttackBehaviorBase>()
                {
                    new AttackBehaviorGroup()
                    {
                    }
                };

                bs.AttackBehaviorGroup.AttackBehaviors = new List <AttackBehaviorGroup.AttackGroupItem>()
                {
                    new AttackBehaviorGroup.AttackGroupItem()
                    {
                        Probability = 1.75f,
                        Behavior    = new ShootGunBehavior()
                        {
                            WeaponType              = WeaponType.BulletScript,
                            BulletScript            = new CustomBulletScriptSelector(typeof(HunterKinScript)),
                            LeadAmount              = 0,
                            LeadChance              = 1,
                            AttackCooldown          = 1f,
                            RequiresLineOfSight     = true,
                            FixTargetDuringAttack   = true,
                            StopDuringAttack        = true,
                            RespectReload           = true,
                            MagazineCapacity        = 5,
                            ReloadSpeed             = 1f,
                            EmptiesClip             = true,
                            SuppressReloadAnim      = false,
                            CooldownVariance        = 0,
                            GlobalCooldown          = 0,
                            InitialCooldown         = 0,
                            InitialCooldownVariance = 0,
                            GroupName                  = null,
                            GroupCooldown              = 0,
                            MinRange                   = 0,
                            Range                      = 7,
                            MinWallDistance            = 0,
                            MaxEnemiesInRoom           = -1,
                            MinHealthThreshold         = 0,
                            MaxHealthThreshold         = 1,
                            HealthThresholds           = new float[0],
                            AccumulateHealthThresholds = true,
                            targetAreaStyle            = null,
                            IsBlackPhantom             = false,
                            resetCooldownOnDamage      = null,
                            MaxUsages                  = 0,
                            UseLaserSight              = true,
                            PreFireLaserTime           = .5f,
                        },
                        NickName = "Hunter Kin Shoot Arrow"
                    },
                    new AttackBehaviorGroup.AttackGroupItem()
                    {
                        Probability = 1.5f,
                        Behavior    = new SummonEnemyBehavior()
                        {
                            DefineSpawnRadius    = true,
                            MinSpawnRadius       = 3,
                            MaxSpawnRadius       = 3,
                            MaxRoomOccupancy     = 6,
                            MaxSummonedAtOnce    = 2,
                            MaxToSpawn           = -1,
                            NumToSpawn           = 2,
                            KillSpawnedOnDeath   = false,
                            CrazeAfterMaxSpawned = false,
                            EnemeyGuids          = new List <string>()
                            {
                                BulletDog.guid
                            },
                            SummonTime          = .5f,
                            DisableDrops        = true,
                            StopDuringAnimation = true,
                            SummonAnim          = "Summon",
                            HideGun             = true,
                            Cooldown            = 1f,
                            RequiresLineOfSight = false,
                            selectionType       = SummonEnemyBehavior.SelectionType.Random,
                        },
                        NickName = "Summon dat doggy"
                    }
                };
                bs.MovementBehaviors = new List <MovementBehaviorBase>
                {
                    new SeekTargetBehavior
                    {
                        StopWhenInRange     = true,
                        CustomRange         = 7f,
                        LineOfSight         = false,
                        ReturnToSpawn       = false,
                        SpawnTetherDistance = 0f,
                        PathInterval        = 0.5f,
                        SpecifyRange        = false,
                        MinActiveRange      = 0f,
                        MaxActiveRange      = 0f
                    }
                };
                bs.InstantFirstTick                = behaviorSpeculator.InstantFirstTick;
                bs.TickInterval                    = behaviorSpeculator.TickInterval;
                bs.PostAwakenDelay                 = behaviorSpeculator.PostAwakenDelay;
                bs.RemoveDelayOnReinforce          = behaviorSpeculator.RemoveDelayOnReinforce;
                bs.OverrideStartingFacingDirection = behaviorSpeculator.OverrideStartingFacingDirection;
                bs.StartingFacingDirection         = behaviorSpeculator.StartingFacingDirection;
                bs.SkipTimingDifferentiator        = behaviorSpeculator.SkipTimingDifferentiator;
                Game.Enemies.Add("cel:hunter_kin", enemy.aiActor);
            }
        }
Beispiel #19
0
        public static void BuildPrefab()
        {
            if (prefab != null || CompanionBuilder.companionDictionary.ContainsKey(guid))
            {
                return;
            }

            //Create the prefab with a starting sprite and hitbox offset/size
            prefab = CompanionBuilder.BuildPrefab("testbulon", guid, "CakeMod/Resources/Lovebulon/Idle/lovebulon_idle_001", new IntVector2(1, 0), new IntVector2(9, 9));

            //Add a companion component to the prefab (could be a custom class)
            var companion = prefab.GetComponent <BehaviorSpeculator>();
            BehaviorSpeculator BEHAVIORIAL = EnemyDatabase.GetOrLoadByGuid("42be66373a3d4d89b91a35c9ff8adfec").behaviorSpeculator;
            BehaviorSpeculator spec        = companion.behaviorSpeculator;

            spec.OverrideBehaviors = BEHAVIORIAL.OverrideBehaviors;
            spec.OtherBehaviors    = BEHAVIORIAL.OtherBehaviors;
            spec.TargetBehaviors   = BEHAVIORIAL.TargetBehaviors;

            spec.AttackBehaviors                               = BEHAVIORIAL.AttackBehaviors;
            spec.MovementBehaviors                             = BEHAVIORIAL.MovementBehaviors;
            spec.InstantFirstTick                              = BEHAVIORIAL.InstantFirstTick;
            spec.TickInterval                                  = BEHAVIORIAL.TickInterval;
            spec.PostAwakenDelay                               = BEHAVIORIAL.PostAwakenDelay;
            spec.RemoveDelayOnReinforce                        = BEHAVIORIAL.RemoveDelayOnReinforce;
            spec.OverrideStartingFacingDirection               = BEHAVIORIAL.OverrideStartingFacingDirection;
            spec.StartingFacingDirection                       = BEHAVIORIAL.StartingFacingDirection;
            spec.SkipTimingDifferentiator                      = BEHAVIORIAL.SkipTimingDifferentiator;
            companion.aiActor.MovementSpeed                    = 9f;
            companion.aiActor.healthHaver.PreventAllDamage     = false;
            companion.aiActor.CollisionDamage                  = 100f;
            companion.aiActor.HasShadow                        = false;
            companion.aiActor.CanTargetPlayers                 = true;
            companion.aiActor.specRigidbody.CollideWithOthers  = true;
            companion.aiActor.specRigidbody.CollideWithTileMap = true;
            companion.aiActor.healthHaver.ForceSetCurrentHealth(35f);
            companion.aiActor.healthHaver.SetHealthMaximum(35f, 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          = 20,
                ManualOffsetY          = 6,
                ManualWidth            = 11,
                ManualHeight           = 9,
                ManualDiameter         = 0,
                ManualLeftX            = 0,
                ManualLeftY            = 0,
                ManualRightX           = 0,
                ManualRightY           = 0
            });
            companion.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider
            {
                ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual,
                CollisionLayer         = CollisionLayer.EnemyHitBox,
                IsTrigger = false,
                BagleUseFirstFrameOnly = false,
                SpecifyBagelFrame      = string.Empty,
                BagelColliderNumber    = 0,
                ManualOffsetX          = 0,
                ManualOffsetY          = 0,
                ManualWidth            = 11,
                ManualHeight           = 9,
                ManualDiameter         = 0,
                ManualLeftX            = 0,
                ManualLeftY            = 0,
                ManualRightX           = 0,
                ManualRightY           = 0
            });

            //Add all of the needed animations (most of the animations need to have specific names to be recognized, like idle_right or attack_left)
            prefab.AddAnimation("idle_left", "CakeMod/Resources/Lovebulon/Idle", fps: 7, AnimationType.Idle, DirectionType.TwoWayHorizontal);
            prefab.AddAnimation("idle_right", "CakeMod/Resources/Lovebulon/Idle", fps: 7, AnimationType.Idle, DirectionType.TwoWayHorizontal);
            prefab.AddAnimation("run_left", "CakeMod/Resources/Lovebulon/Run", fps: 7, AnimationType.Move, DirectionType.TwoWayHorizontal);
            prefab.AddAnimation("run_right", "CakeMod/Resources/Lovebulon/Run", fps: 7, AnimationType.Move, DirectionType.TwoWayHorizontal);
            prefab.AddAnimation("pitfall", "CakeMod/Resources/Lovebulon/Fall", fps: 7, AnimationType.Idle, DirectionType.TwoWayHorizontal, tk2dSpriteAnimationClip.WrapMode.Once);
            //Note that the "die" and "attack" animations are only set to Move because they will be overwritten later.
            //tk2dSpriteAnimationClip.WrapMode.Once determines how an animation plays out. If you don't want it to loop, leave it to Once, otherwise you can change it to Loop or something.
            //Assign animation well assigns an animation to an animation type. By default this is on, but since we're overwritting this set this to false.
            prefab.AddAnimation("attack_left", "CakeMod/Resources/Lovebulon/Attack", fps: 8, AnimationType.Move, DirectionType.TwoWayHorizontal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);
            prefab.AddAnimation("attack_right", "CakeMod/Resources/Lovebulon/Attack", fps: 8, AnimationType.Move, DirectionType.TwoWayHorizontal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);
            prefab.AddAnimation("die_left", "CakeMod/Resources/Lovebulon/Die", fps: 12, AnimationType.Move, DirectionType.TwoWayHorizontal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);
            prefab.AddAnimation("die_right", "CakeMod/Resources/Lovebulon/Die", fps: 12, AnimationType.Move, DirectionType.TwoWayHorizontal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);
            //Here we create a new DirectionalAnimation for our enemy to pull from.
            //Make sure the AnimNames correspong to the AddAnimation names.
            DirectionalAnimation attack = new DirectionalAnimation()
            {
                AnimNames = new string[] { "attack_right", "attack_left" },
                Flipped   = new FlipType[] { FlipType.None, FlipType.None },
                Type      = DirectionType.TwoWayHorizontal,
                Prefix    = string.Empty
            };
            DirectionalAnimation die = new DirectionalAnimation()
            {
                AnimNames = new string[] { "die_right", "die_left" },
                Flipped   = new FlipType[] { FlipType.None, FlipType.None },
                Type      = DirectionType.TwoWayHorizontal,
                Prefix    = string.Empty
            };

            //Because Dodge Roll is Dodge Roll and there is no animation types for attack and death, we have to assign them to the Other category.
            companion.aiAnimator.AssignDirectionalAnimation("attack", attack, AnimationType.Other);
            companion.aiAnimator.AssignDirectionalAnimation("die", die, AnimationType.Other);

            //Add the behavior here, this too can be a custom class that extends AttackBehaviorBase or something like that
            var bs = prefab.GetComponent <BehaviorSpeculator>();

            bs.TargetBehaviors = new List <TargetBehaviorBase>()
            {
                new TargetPlayerBehavior()
                {
                    Radius              = 35,
                    LineOfSight         = false,
                    ObjectPermanence    = true,
                    SearchInterval      = 0.01f,
                    PauseOnTargetSwitch = false,
                    PauseTime           = 0f
                }
            };
            bs.MovementBehaviors = new List <MovementBehaviorBase>()
            {
                new SeekTargetBehavior()
                {
                    StopWhenInRange     = false,
                    CustomRange         = 6,
                    LineOfSight         = true,
                    ReturnToSpawn       = true,
                    SpawnTetherDistance = 0,
                    PathInterval        = 0.5f,
                    SpecifyRange        = false,
                    MinActiveRange      = 0,
                    MaxActiveRange      = 0
                }
            };
            Game.Enemies.Add("cak:testbulon", companion.aiActor);
        }
Beispiel #20
0
        public static void BuildPrefab()
        {
            // source = EnemyDatabase.GetOrLoadByGuid("c50a862d19fc4d30baeba54795e8cb93");
            bool flag  = prefab != null || EnemyBuilder.Dictionary.ContainsKey(guid);
            bool flag2 = flag;

            if (!flag2)
            {
                prefab = EnemyBuilder.BuildPrefab("Jesterlet", guid, spritePaths[0], new IntVector2(0, 0), new IntVector2(8, 9), false);
                var companion = prefab.AddComponent <EnemyBehavior>();
                companion.aiActor.knockbackDoer.weight         = 200;
                companion.aiActor.MovementSpeed                = 2f;
                companion.aiActor.healthHaver.PreventAllDamage = false;
                companion.aiActor.CollisionDamage              = 1f;
                companion.aiActor.HasShadow                        = false;
                companion.aiActor.IgnoreForRoomClear               = false;
                companion.aiActor.aiAnimator.HitReactChance        = 0.05f;
                companion.aiActor.specRigidbody.CollideWithOthers  = true;
                companion.aiActor.specRigidbody.CollideWithTileMap = true;
                companion.aiActor.PreventFallingInPitsEver         = true;
                companion.aiActor.healthHaver.ForceSetCurrentHealth(15f);
                companion.aiActor.CollisionKnockbackStrength = 5f;
                companion.aiActor.CanTargetPlayers           = true;
                companion.aiActor.healthHaver.SetHealthMaximum(15f, null, false);
                companion.aiActor.specRigidbody.PixelColliders.Clear();
                companion.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider
                {
                    ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual,
                    CollisionLayer         = CollisionLayer.EnemyCollider,
                    IsTrigger = false,
                    BagleUseFirstFrameOnly = false,
                    SpecifyBagelFrame      = string.Empty,
                    BagelColliderNumber    = 0,
                    ManualOffsetX          = 0,
                    ManualOffsetY          = 0,
                    ManualWidth            = 12,
                    ManualHeight           = 26,
                    ManualDiameter         = 0,
                    ManualLeftX            = 0,
                    ManualLeftY            = 0,
                    ManualRightX           = 0,
                    ManualRightY           = 0
                });
                companion.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider
                {
                    ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual,
                    CollisionLayer         = CollisionLayer.EnemyHitBox,
                    IsTrigger = false,
                    BagleUseFirstFrameOnly = false,
                    SpecifyBagelFrame      = string.Empty,
                    BagelColliderNumber    = 0,
                    ManualOffsetX          = 0,
                    ManualOffsetY          = 0,
                    ManualWidth            = 12,
                    ManualHeight           = 26,
                    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.TwoWayHorizontal,
                    Flipped   = new DirectionalAnimation.FlipType[2],
                    AnimNames = new string[]
                    {
                        "idle",
                        "idle_two"
                    }
                };
                DirectionalAnimation done3456 = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.Single,
                    Prefix    = "prepare",
                    AnimNames = new string[1],
                    Flipped   = new DirectionalAnimation.FlipType[1]
                };
                aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation>
                {
                    new AIAnimator.NamedDirectionalAnimation
                    {
                        name = "prepare",
                        anim = done3456
                    }
                };
                bool flag3 = JesterletCollection == null;
                if (flag3)
                {
                    JesterletCollection = SpriteBuilder.ConstructCollection(prefab, "Jesterlet_Collection");
                    UnityEngine.Object.DontDestroyOnLoad(JesterletCollection);
                    for (int i = 0; i < spritePaths.Length; i++)
                    {
                        SpriteBuilder.AddSpriteToCollection(spritePaths[i], JesterletCollection);
                    }
                    SpriteBuilder.AddAnimation(companion.spriteAnimator, JesterletCollection, new List <int>
                    {
                        2,
                        3
                    }, "idle", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 7f;
                    SpriteBuilder.AddAnimation(companion.spriteAnimator, JesterletCollection, new List <int>
                    {
                        0,
                        1
                    }, "idle_two", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 7f;
                    SpriteBuilder.AddAnimation(companion.spriteAnimator, JesterletCollection, new List <int>
                    {
                        4,
                        5,
                        6,
                        7
                    }, "prepare", tk2dSpriteAnimationClip.WrapMode.Once).fps = 4f;
                }
                var bs = prefab.GetComponent <BehaviorSpeculator>();
                BehaviorSpeculator behaviorSpeculator = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5").behaviorSpeculator;
                bs.OverrideBehaviors = behaviorSpeculator.OverrideBehaviors;
                bs.OtherBehaviors    = behaviorSpeculator.OtherBehaviors;
                bs.TargetBehaviors   = new List <TargetBehaviorBase>
                {
                    new TargetPlayerBehavior
                    {
                        Radius              = 35f,
                        LineOfSight         = false,
                        ObjectPermanence    = true,
                        SearchInterval      = 0.25f,
                        PauseOnTargetSwitch = false,
                        PauseTime           = 0.25f
                    }
                };
                shootpoint = new GameObject("f**k");
                shootpoint.transform.parent   = companion.transform;
                shootpoint.transform.position = companion.sprite.WorldCenter;
                GameObject m_CachedGunAttachPoint = companion.transform.Find("f**k").gameObject;
                bs.AttackBehaviors = new List <AttackBehaviorBase>()
                {
                    new ShootBehavior()
                    {
                        ShootPoint          = m_CachedGunAttachPoint,
                        BulletScript        = new CustomBulletScriptSelector(typeof(TeleportScript)),
                        LeadAmount          = 0f,
                        InitialCooldown     = 5f,
                        AttackCooldown      = 10f,
                        RequiresLineOfSight = false,
                        ChargeAnimation     = "prepare",
                        ChargeTime          = 1f,
                        Uninterruptible     = true
                    },
                };
                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:jestlet", companion.aiActor);
            }
        }
        // Token: 0x0600023B RID: 571 RVA: 0x00015AB8 File Offset: 0x00013CB8
        //public override DebrisObject Drop(PlayerController player)
        //{
        //	player.OnAllyFlipCompleted = (Action<FlippableCover>)Delegate.Remove(player.OnAllyFlipCompleted, new Action<FlippableCover>(this.HandleFlip));
        //	player.OnNewFloorLoaded = (Action<PlayerController>)Delegate.Remove(player.OnNewFloorLoaded, new Action<PlayerController>(this.HandleNewFloor));
        ///	this.DestroyCompanions();
        //	return base.Drop(player);
        //}

        // Token: 0x0600023C RID: 572 RVA: 0x00015B1C File Offset: 0x00013D1C
        public static void BuildPrefab()
        {
            bool flag  = AbilityRebel.AllyPrefab != null || CompanionBuilder.companionDictionary.ContainsKey(AbilityRebel.guid);
            bool flag2 = flag;
            bool flag3 = !flag2;

            if (flag3)
            {
                AbilityRebel.AllyPrefab = CompanionBuilder.BuildPrefab("Ally Boi", AbilityRebel.guid, AbilityRebel.spritePaths[0], new IntVector2(3, 2), new IntVector2(8, 9));
                AbilityRebel.AllyBehavior allyBehavior = AbilityRebel.AllyPrefab.AddComponent <AbilityRebel.AllyBehavior>();
                allyBehavior.aiAnimator.facingType            = AIAnimator.FacingType.Movement;
                allyBehavior.aiAnimator.faceSouthWhenStopped  = false;
                allyBehavior.aiAnimator.faceTargetWhenStopped = true;

                AIAnimator aiAnimator = allyBehavior.aiAnimator;
                //AIBulletBank aiBulletBlank = aiBulletBlank.
                //allyBehavior.aiShooter.equippedGunId = 79;

                aiAnimator.MoveAnimation = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.Single,
                    Prefix    = "run",
                    AnimNames = new string[1],
                    Flipped   = new DirectionalAnimation.FlipType[1]
                };
                aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation>
                {
                    new AIAnimator.NamedDirectionalAnimation
                    {
                        name = "die",
                        anim = new DirectionalAnimation
                        {
                            Type      = DirectionalAnimation.DirectionType.Single,
                            Prefix    = "die",
                            AnimNames = new string[1],
                            Flipped   = new DirectionalAnimation.FlipType[1]
                        }
                    }
                };
                aiAnimator.IdleAnimation = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.TwoWayHorizontal,
                    AnimNames = new string[]
                    {
                        "idle_right",
                        "idle_left"
                    },
                    Flipped = new DirectionalAnimation.FlipType[2]
                };

                aiAnimator.IdleAnimation = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.Single,
                    Prefix    = "idle_right",
                    AnimNames = new string[1],
                    Flipped   = new DirectionalAnimation.FlipType[1]
                };

                DirectionalAnimation anim = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.Single,
                    Prefix    = "attack",
                    AnimNames = new string[1],
                    Flipped   = new DirectionalAnimation.FlipType[1]
                };
                aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation>
                {
                    new AIAnimator.NamedDirectionalAnimation
                    {
                        name = "attack",
                        anim = anim
                    }
                };
                AIAnimator.NamedDirectionalAnimation namedDirectionalAnimation = new AIAnimator.NamedDirectionalAnimation();
                namedDirectionalAnimation.name = "spawn";
                namedDirectionalAnimation.anim = new DirectionalAnimation
                {
                    Type      = DirectionalAnimation.DirectionType.Single,
                    Prefix    = "spawn",
                    AnimNames = new string[]
                    {
                        "spawn"
                    },
                    Flipped = new DirectionalAnimation.FlipType[1]
                };
                bool flag4 = AbilityRebel.AllyBoiCollection == null;
                bool flag5 = flag4;
                if (flag5)
                {
                    AbilityRebel.AllyBoiCollection = SpriteBuilder.ConstructCollection(AbilityRebel.AllyPrefab, "Ally_Boi_Collection");
                    UnityEngine.Object.DontDestroyOnLoad(AbilityRebel.AllyBoiCollection);
                    for (int i = 0; i < AbilityRebel.spritePaths.Length; i++)
                    {
                        SpriteBuilder.AddSpriteToCollection(AbilityRebel.spritePaths[i], AbilityRebel.AllyBoiCollection);
                    }
                    SpriteBuilder.AddAnimation(allyBehavior.spriteAnimator, AbilityRebel.AllyBoiCollection, new List <int>
                    {
                        43
                    }, "attack", tk2dSpriteAnimationClip.WrapMode.Once).fps = 20f;
                    SpriteBuilder.AddAnimation(allyBehavior.spriteAnimator, AbilityRebel.AllyBoiCollection, new List <int>
                    {
                        37,
                        38,
                        39,
                        40,
                        41,
                        42
                    }, "idle_left", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 12f;

                    SpriteBuilder.AddAnimation(allyBehavior.spriteAnimator, AbilityRebel.AllyBoiCollection, new List <int>
                    {
                        37,
                        38,
                        39,
                        40,
                        41,
                        42
                    }, "idle_right", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 12f;

                    SpriteBuilder.AddAnimation(allyBehavior.spriteAnimator, AbilityRebel.AllyBoiCollection, new List <int>
                    {
                        31,
                        32,
                        33,
                        34,
                        35,
                        36
                    }, "run", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 12f;

                    SpriteBuilder.AddAnimation(allyBehavior.spriteAnimator, AbilityRebel.AllyBoiCollection, new List <int>
                    {
                        31,
                        32,
                        33,
                        34,
                        35,
                        36
                    }, "run_right", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 12f;

                    SpriteBuilder.AddAnimation(allyBehavior.spriteAnimator, AbilityRebel.AllyBoiCollection, new List <int>
                    {
                        25,
                        26,
                        27,
                        28,
                        29,
                        30
                    }, "die", tk2dSpriteAnimationClip.WrapMode.Once).fps = 12f;
                    SpriteBuilder.AddAnimation(allyBehavior.spriteAnimator, AbilityRebel.AllyBoiCollection, new List <int>
                    {
                        0,
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24
                    }, "spawn", tk2dSpriteAnimationClip.WrapMode.Once).fps = 24f;
                }
                allyBehavior.aiActor.MovementSpeed    = 10f;
                allyBehavior.aiActor.HasShadow        = false;
                allyBehavior.aiActor.CanTargetPlayers = false;
                BehaviorSpeculator behaviorSpeculator = allyBehavior.behaviorSpeculator;
                behaviorSpeculator.AttackBehaviors.Add(new AbilityRebel.AllyAttackBehavior());
                behaviorSpeculator.MovementBehaviors.Add(new AbilityRebel.ApproachEnemiesBehavior());
                behaviorSpeculator.MovementBehaviors.Add(new CompanionFollowPlayerBehavior
                {
                    IdleAnimations = new string[]
                    {
                        "idle"
                    }
                });
                UnityEngine.Object.DontDestroyOnLoad(AbilityRebel.AllyPrefab);
                FakePrefab.MarkAsFakePrefab(AbilityRebel.AllyPrefab);
                AbilityRebel.AllyPrefab.SetActive(false);
                allyBehavior.CanInterceptBullets = true;
                allyBehavior.aiActor.healthHaver.PreventAllDamage = false;
                allyBehavior.aiActor.CollisionDamage = 0f;
                allyBehavior.aiActor.specRigidbody.CollideWithOthers  = true;
                allyBehavior.aiActor.specRigidbody.CollideWithTileMap = false;
                allyBehavior.aiActor.healthHaver.ForceSetCurrentHealth(12f);
                allyBehavior.aiActor.healthHaver.SetHealthMaximum(12f, null, false);
                allyBehavior.aiActor.specRigidbody.PixelColliders.Clear();
                allyBehavior.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider
                {
                    ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual,
                    CollisionLayer         = CollisionLayer.PlayerHitBox,
                    IsTrigger = false,
                    BagleUseFirstFrameOnly = false,
                    SpecifyBagelFrame      = string.Empty,
                    BagelColliderNumber    = 0,
                    ManualOffsetX          = 0,
                    ManualOffsetY          = 0,
                    ManualWidth            = 16,
                    ManualHeight           = 24,
                    ManualDiameter         = 0,
                    ManualLeftX            = 0,
                    ManualLeftY            = 0,
                    ManualRightX           = 0,
                    ManualRightY           = 0
                });;

                /*
                 * allyBehavior.aiAnimator.specRigidbody.PixelColliders.Add(new PixelCollider
                 * {
                 *      ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual,
                 *      CollisionLayer = CollisionLayer.PlayerHitBox,
                 *      IsTrigger = false,
                 *      BagleUseFirstFrameOnly = false,
                 *      SpecifyBagelFrame = string.Empty,
                 *      BagelColliderNumber = 0,
                 *      ManualOffsetX = 0,
                 *      ManualOffsetY = 0,
                 *      ManualWidth = 1,
                 *      ManualHeight = 1,
                 *      ManualDiameter = 0,
                 *      ManualLeftX = 0,
                 *      ManualLeftY = 0,
                 *      ManualRightX = 0,
                 *      ManualRightY = 0
                 * });*/
            }
        }
Beispiel #22
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);
            }
        }
Beispiel #23
0
        public static void AssignDirectionalAnimation(this AIAnimator aiAnimator, string name, DirectionalAnimation animation, AnimationType type)
        {
            switch (type)
            {
            case AnimationType.Idle:
                aiAnimator.IdleAnimation = animation;
                break;

            case AnimationType.Move:
                aiAnimator.MoveAnimation = animation;
                break;

            case AnimationType.Flight:
                aiAnimator.FlightAnimation = animation;
                break;

            case AnimationType.Hit:
                aiAnimator.HitAnimation = animation;
                break;

            case AnimationType.Talk:
                aiAnimator.TalkAnimation = animation;
                break;

            case AnimationType.Fidget:
                aiAnimator.IdleFidgetAnimations.Add(animation);
                break;

            default:
                aiAnimator.OtherAnimations.Add(new AIAnimator.NamedDirectionalAnimation()
                {
                    anim = animation,
                    name = name
                });
                break;
            }
        }
Beispiel #24
0
        public static void BuildPrefab()
        {
            if (pikaPrefab != null || CompanionBuilder.companionDictionary.ContainsKey(guid))
            {
                Tools.PrintError("Tried to make the same Pikachu prefab twice!");
                return;
            }

            pikaPrefab = CompanionBuilder.BuildPrefab("Pikachu", guid, spritePaths[0], new IntVector2(3, 2), new IntVector2(8, 9));
            var pika = pikaPrefab.AddComponent <PikaBehavior>();

            var aiAnimator = pika.aiAnimator;

            aiAnimator.MoveAnimation = new DirectionalAnimation()
            { //animation
                Type      = DirectionalAnimation.DirectionType.TwoWayHorizontal,
                Flipped   = new DirectionalAnimation.FlipType[] { DirectionalAnimation.FlipType.None, DirectionalAnimation.FlipType.None },
                AnimNames = new string[] { "run_right", "run_left" },
            };

            aiAnimator.IdleAnimation = new DirectionalAnimation()
            {
                Type      = DirectionalAnimation.DirectionType.TwoWayHorizontal,
                Flipped   = new DirectionalAnimation.FlipType[] { DirectionalAnimation.FlipType.None, DirectionalAnimation.FlipType.None },
                AnimNames = new string[] { "idle_right", "idle_left" },
            };


            var attackAnim = new DirectionalAnimation()
            {
                Type      = DirectionalAnimation.DirectionType.TwoWayHorizontal,
                Flipped   = new DirectionalAnimation.FlipType[] { DirectionalAnimation.FlipType.None, DirectionalAnimation.FlipType.None },
                AnimNames = new string[] { "attack_right", "attack_left" },
            };

            aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation>()
            {
                new AIAnimator.NamedDirectionalAnimation()
                {
                    name = "attack",
                    anim = attackAnim
                }
            };

            if (pikaCollection == null)
            {
                pikaCollection = SpriteBuilder.ConstructCollection(pikaPrefab, "Pikachu_Collection");
                GameObject.DontDestroyOnLoad(pikaCollection);
                for (int i = 0; i < spritePaths.Length; i++)
                {
                    SpriteBuilder.AddSpriteToCollection(spritePaths[i], pikaCollection);
                }
                SpriteBuilder.AddAnimation(pika.spriteAnimator, pikaCollection, new List <int>()
                {
                    0, 1, 2, 3
                }, "idle_left", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 5;
                SpriteBuilder.AddAnimation(pika.spriteAnimator, pikaCollection, new List <int>()
                {
                    4, 5, 6, 7
                }, "idle_right", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 5;
                SpriteBuilder.AddAnimation(pika.spriteAnimator, pikaCollection, new List <int>()
                {
                    8, 9, 10, 11, 12, 13
                }, "run_left", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 10;
                SpriteBuilder.AddAnimation(pika.spriteAnimator, pikaCollection, new List <int>()
                {
                    14, 15, 16, 17, 18, 19
                }, "run_right", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 10;
                SpriteBuilder.AddAnimation(pika.spriteAnimator, pikaCollection, new List <int>()
                {
                    20, 21
                }, "attack_left", tk2dSpriteAnimationClip.WrapMode.RandomLoop).fps = 20;
                SpriteBuilder.AddAnimation(pika.spriteAnimator, pikaCollection, new List <int>()
                {
                    22, 23
                }, "attack_right", tk2dSpriteAnimationClip.WrapMode.RandomLoop).fps = 20;
            }


            pika.aiActor.MovementSpeed = 7f;
            pika.specRigidbody.Reinitialize();

            var bs = pika.behaviorSpeculator;

            bs.AttackBehaviors.Add(new ElectricityAttackBehavior());
            bs.MovementBehaviors.Add(new ApproachEnemiesBehavior());
            bs.MovementBehaviors.Add(new CompanionFollowPlayerBehavior()
            {
                IdleAnimations = new string[] { "idle" }
            });

            GameObject.DontDestroyOnLoad(pikaPrefab);
            FakePrefab.MarkAsFakePrefab(pikaPrefab);
            pikaPrefab.SetActive(false);
        }
Beispiel #25
0
    void Start()
    {
        renderer = gameObject.GetComponent <SpriteRenderer>();

        current = south;
    }
Beispiel #26
0
        public static void AdvAddAnimation(this AIAnimator targetAnimator, string animationName, DirectionalAnimation.DirectionType directionality, CompanionBuilder.AnimationType AnimationType, List <DirectionalAnimationData> AnimData)
        {
            List <string> subAnimNames = new List <string>();

            foreach (DirectionalAnimationData data in AnimData)
            {
                subAnimNames.Add(data.subAnimationName);

                tk2dSpriteCollectionData tk2dSpriteCollectionData = targetAnimator.GetComponent <tk2dSpriteCollectionData>();
                if (!tk2dSpriteCollectionData)
                {
                    tk2dSpriteCollectionData = SpriteBuilder.ConstructCollection(targetAnimator.gameObject, targetAnimator.name + "_collection");
                }

                string[]   resourceNames = ResourceExtractor.GetResourceNames();
                List <int> list          = new List <int>();
                for (int i = 0; i < resourceNames.Length; i++)
                {
                    if (resourceNames[i].StartsWith(data.pathDirectory.Replace('/', '.'), StringComparison.OrdinalIgnoreCase))
                    {
                        // ETGModConsole.Log($"Resource Found: {resourceNames[i]}.");
                        list.Add(SpriteBuilder.AddSpriteToCollection(resourceNames[i], tk2dSpriteCollectionData));
                    }
                }
                //ETGModConsole.Log($"Adding animation {data.subAnimationName} with list length {list.Count}.");

                tk2dSpriteAnimationClip tk2dSpriteAnimationClip = SpriteBuilder.AddAnimation(targetAnimator.spriteAnimator, tk2dSpriteCollectionData, list, data.subAnimationName, data.wrapMode);
                tk2dSpriteAnimationClip.fps = (float)data.fps;
            }

            if (AnimationType != CompanionBuilder.AnimationType.Other)
            {
                DirectionalAnimation newDirectionalAnimation = new DirectionalAnimation
                {
                    Type      = directionality,
                    Flipped   = new DirectionalAnimation.FlipType[subAnimNames.Count],
                    AnimNames = subAnimNames.ToArray(),
                    Prefix    = string.Empty,
                };

                switch (AnimationType)
                {
                case CompanionBuilder.AnimationType.Idle:
                    targetAnimator.IdleAnimation = newDirectionalAnimation;
                    break;

                case CompanionBuilder.AnimationType.Move:
                    targetAnimator.MoveAnimation = newDirectionalAnimation;
                    break;

                case CompanionBuilder.AnimationType.Hit:
                    targetAnimator.HitAnimation = newDirectionalAnimation;
                    break;

                case CompanionBuilder.AnimationType.Talk:
                    targetAnimator.TalkAnimation = newDirectionalAnimation;
                    break;

                case CompanionBuilder.AnimationType.Flight:
                    targetAnimator.FlightAnimation = newDirectionalAnimation;
                    break;

                case CompanionBuilder.AnimationType.Fidget:
                    if (targetAnimator.IdleFidgetAnimations == null)
                    {
                        targetAnimator.IdleFidgetAnimations = new List <DirectionalAnimation>();
                    }
                    targetAnimator.IdleFidgetAnimations.Add(newDirectionalAnimation);
                    break;
                }
            }
            else
            {
                AIAnimator.NamedDirectionalAnimation newOtheranim = new AIAnimator.NamedDirectionalAnimation
                {
                    name = animationName,
                    anim = new DirectionalAnimation
                    {
                        Prefix    = animationName,
                        Type      = directionality,
                        Flipped   = new DirectionalAnimation.FlipType[subAnimNames.Count],
                        AnimNames = subAnimNames.ToArray(),
                    }
                };

                if (targetAnimator.OtherAnimations == null)
                {
                    targetAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation>();
                }
                targetAnimator.OtherAnimations.Add(newOtheranim);
            }
        }
Beispiel #27
0
        public static void BuildPrefab()
        {
            if (prefab == null || !EnemyBuilder.Dictionary.ContainsKey(guid))
            {
                //Sets up the prefab of the enemy. The spritepath, "CakeMod/Resources/Waterbulon/Idle/milton_idle_001", determines the setup sprite for your enemy. vvvv This bool right here determines whether or not an enemy has an AiShooter or not. AIShooters are necessary if you want your enemy to hold a gun for example. An example of this can be seen in Humphrey.
                prefab = EnemyBuilder.BuildPrefab("Waterbulon", guid, "CakeMod/Resources/Waterbulon/Idle/waterbulon_idle_001", new IntVector2(0, 0), new IntVector2(0, 0), false);
                //This line extends a BraveBehavior called EnemyBehavior, this is a generic behavior I use for setting up things that can't be setup in BuildPrefab.
                var enemy = prefab.AddComponent <EnemyBehavior>();
                //Here you can setup various things like movement speed, weight, and health. There's a lot you can do with the AiActor parameter so feel free to experiment.
                enemy.aiActor.MovementSpeed        = 6.7f;
                enemy.aiActor.knockbackDoer.weight = 500;
                enemy.aiActor.IgnoreForRoomClear   = false;
                enemy.aiActor.CollisionDamage      = 1f;
                enemy.aiActor.healthHaver.ForceSetCurrentHealth(15f);
                enemy.aiActor.healthHaver.SetHealthMaximum(15f, null, false);

                enemy.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider

                {
                    ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual,
                    CollisionLayer         = CollisionLayer.EnemyCollider,
                    IsTrigger = false,
                    BagleUseFirstFrameOnly = false,
                    SpecifyBagelFrame      = string.Empty,
                    BagelColliderNumber    = 0,
                    ManualOffsetX          = 0,
                    ManualOffsetY          = 0,
                    ManualWidth            = 19,
                    ManualHeight           = 14,
                    ManualDiameter         = 0,
                    ManualLeftX            = 0,
                    ManualLeftY            = 0,
                    ManualRightX           = 0,
                    ManualRightY           = 0
                });
                enemy.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider
                {
                    ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual,
                    CollisionLayer         = CollisionLayer.EnemyHitBox,
                    IsTrigger = false,
                    BagleUseFirstFrameOnly = false,
                    SpecifyBagelFrame      = string.Empty,
                    BagelColliderNumber    = 0,
                    ManualOffsetX          = 0,
                    ManualOffsetY          = 0,
                    ManualWidth            = 19,
                    ManualHeight           = 14,
                    ManualDiameter         = 0,
                    ManualLeftX            = 0,
                    ManualLeftY            = 0,
                    ManualRightX           = 0,
                    ManualRightY           = 0,
                });

                //This is where you setup your animations. Most animations need specific frame names to be recognized like idle or die.
                //The AddAnimation lines gets sprites from the folder specified in second phrase of the this line. At the very least you need an animation that contains the word idle for the idle animations for example.
                //AnimationType determines what kind of animation your making. In Gungeon there are 7 different Animation Types: Move, Idle, Fidget, Flight, Hit, Talk, Other. For a majority of these animations, these play automatically, however specific animations need to be told when to play such as Attack.
                //DirectionType determines the amount of ways an animation can face. You'll have to change your animation names to correspond with the DirectionType. For example if you want an animation to face eight ways you'll have to name your animations something like ""attack_south_west", "attack_north_east",  "attack_east", "attack_south_east",  "attack_north",  "attack_south", "attack_west", "attack_north_west" and change DirectionType to  DirectionType.EightWayOrdinal.
                //I suggest looking at the sprites of base game enemies to determine the names for the different directions.
                prefab.AddAnimation("idle_left", "CakeMod/Resources/Waterbulon/Idle", fps: 7, AnimationType.Idle, DirectionType.TwoWayHorizontal);
                prefab.AddAnimation("idle_right", "CakeMod/Resources/Waterbulon/Idle", fps: 7, AnimationType.Idle, DirectionType.TwoWayHorizontal);
                prefab.AddAnimation("run_left", "CakeMod/Resources/Waterbulon/Run", fps: 7, AnimationType.Move, DirectionType.TwoWayHorizontal);
                prefab.AddAnimation("run_right", "CakeMod/Resources/Waterbulon/Run", fps: 7, AnimationType.Move, DirectionType.TwoWayHorizontal);
                //Note that the "die" and "attack" animations are only set to Move because they will be overwritten later.
                //tk2dSpriteAnimationClip.WrapMode.Once determines how an animation plays out. If you don't want it to loop, leave it to Once, otherwise you can change it to Loop or something.
                //Assign animation well assigns an animation to an animation type. By default this is on, but since we're overwritting this set this to false.
                prefab.AddAnimation("attack_left", "CakeMod/Resources/Waterbulon/Attack", fps: 8, AnimationType.Move, DirectionType.TwoWayHorizontal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);
                prefab.AddAnimation("attack_right", "CakeMod/Resources/Waterbulon/Attack", fps: 8, AnimationType.Move, DirectionType.TwoWayHorizontal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);
                prefab.AddAnimation("die_left", "CakeMod/Resources/Waterbulon/Die", fps: 8, AnimationType.Move, DirectionType.TwoWayHorizontal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);
                prefab.AddAnimation("die_right", "CakeMod/Resources/Waterbulon/Die", fps: 8, AnimationType.Move, DirectionType.TwoWayHorizontal, tk2dSpriteAnimationClip.WrapMode.Once, assignAnimation: false);
                //Here we create a new DirectionalAnimation for our enemy to pull from.
                //Make sure the AnimNames correspong to the AddAnimation names.
                DirectionalAnimation attack = new DirectionalAnimation()
                {
                    AnimNames = new string[] { "attack_right", "attack_left" },
                    Flipped   = new FlipType[] { FlipType.None, FlipType.None },
                    Type      = DirectionType.TwoWayHorizontal,
                    Prefix    = string.Empty
                };
                DirectionalAnimation die = new DirectionalAnimation()
                {
                    AnimNames = new string[] { "die_right", "die_left" },
                    Flipped   = new FlipType[] { FlipType.None, FlipType.None },
                    Type      = DirectionType.TwoWayHorizontal,
                    Prefix    = string.Empty
                };
                //Because Dodge Roll is Dodge Roll and there is no animation types for attack and death, we have to assign them to the Other category.
                enemy.aiAnimator.AssignDirectionalAnimation("attack", attack, AnimationType.Other);
                enemy.aiAnimator.AssignDirectionalAnimation("die", die, AnimationType.Other);
                //This is where we get into the meat and potatoes of our enemy. This is where all the behaviors of our enemy are made.
                //This shootpoint block of code determines where our bullets will orginate from. In this case, the center of the enemy.
                shootpoint = new GameObject("Waterbuloncenter");
                shootpoint.transform.parent   = enemy.transform;
                shootpoint.transform.position = enemy.sprite.WorldCenter;
                GameObject position = enemy.transform.Find("Waterbuloncenter").gameObject;
                //this line adds a BehaviorSpeculator to our enemy which is the base for adding behaviors on to.
                var bs = prefab.GetComponent <BehaviorSpeculator>();
                //Here we will add some basic behaviors such as TargetPlayerBehavior and SeekTargetBehavior.
                //You can change many things in these behaviors so feel free to go nuts.
                BehaviorSpeculator BEHAVIORIAL = EnemyDatabase.GetOrLoadByGuid("0239c0680f9f467dbe5c4aab7dd1eca6").behaviorSpeculator;
                BehaviorSpeculator spec        = enemy.behaviorSpeculator;
                spec.OverrideBehaviors               = BEHAVIORIAL.OverrideBehaviors;
                spec.OtherBehaviors                  = BEHAVIORIAL.OtherBehaviors;
                spec.TargetBehaviors                 = BEHAVIORIAL.TargetBehaviors;
                spec.AttackBehaviors                 = BEHAVIORIAL.AttackBehaviors;
                spec.MovementBehaviors               = BEHAVIORIAL.MovementBehaviors;
                spec.InstantFirstTick                = BEHAVIORIAL.InstantFirstTick;
                spec.TickInterval                    = BEHAVIORIAL.TickInterval;
                spec.PostAwakenDelay                 = BEHAVIORIAL.PostAwakenDelay;
                spec.RemoveDelayOnReinforce          = BEHAVIORIAL.RemoveDelayOnReinforce;
                spec.OverrideStartingFacingDirection = BEHAVIORIAL.OverrideStartingFacingDirection;
                spec.StartingFacingDirection         = BEHAVIORIAL.StartingFacingDirection;
                spec.SkipTimingDifferentiator        = BEHAVIORIAL.SkipTimingDifferentiator;
                //Now this is one of the most important behaviors because it allows our enemy to shoot.
                bs.AttackBehaviors = new List <AttackBehaviorBase>()
                {
                    new ShootBehavior()
                    {
                        ShootPoint = position,
                        //This line selects our Bullet Script
                        BulletScript        = new CustomBulletScriptSelector(typeof(MiltonScript)),
                        LeadAmount          = 0f,
                        AttackCooldown      = 4f,
                        FireAnimation       = "attack",
                        RequiresLineOfSight = true,
                        Uninterruptible     = false,
                    }
                };
                bs.MovementBehaviors = new List <MovementBehaviorBase>
                {
                    new SeekTargetBehavior
                    {
                        StopWhenInRange     = false,
                        CustomRange         = 15f,
                        LineOfSight         = false,
                        ReturnToSpawn       = false,
                        SpawnTetherDistance = 0f,
                        PathInterval        = 0.5f,
                        SpecifyRange        = false,
                        MinActiveRange      = 0f,
                        MaxActiveRange      = 0f
                    }
                };
                //Adds the enemy to MTG spawn pool and spawn command
                Game.Enemies.Add("cak:waterbulon", enemy.aiActor);
            }
        }
Beispiel #28
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);
            }
        }