示例#1
0
    void Awake()
    {
        if (cardImage == null)
        {
            cardImage = GetComponent <Image>();
        }

        if (canvas == null)
        {
            canvas = GetComponent <Canvas>();
        }

        if (playerHandController == null)
        {
            playerHandController = GetComponentInParent <PlayerHandController>();
        }

        if (battleController == null)
        {
            battleController = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <BattleController>();
        }

        if (playerController == null)
        {
            playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <MonsterController>();
        }
        if (userController == null)
        {
            userController = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <UserController>();
        }
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        if (playerHandController == null)
        {
            //this will allow us to reference our deck
            playerHandController = GameObject.FindGameObjectWithTag("Hand").GetComponent <PlayerHandController>();
        }

        if (userController == null)
        {
            userController = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <UserController>();
        }

        if (canvasRect == null)
        {
            canvasRect = GameObject.FindGameObjectWithTag("Canvas").GetComponent <RectTransform>();
        }

        if (DeckViewerPrefab == null)
        {
            DeckViewerPrefab = Resources.Load <GameObject>("Menu/DeckViewWindowPrefab");
        }

        if (blankImagePrefab == null)
        {
            //blankImagePrefab = Resources.Load<GameObject>("Menu/BlankImage");
            blankImagePrefab = Resources.Load <GameObject>("Menu/CardWithEmptyObject");
        }
    }
示例#3
0
    private void Start()
    {
        hand       = GameObject.FindWithTag("Hand").GetComponent <PlayerHandController>();
        player     = GameObject.FindWithTag("Player").GetComponent <PlayerController>();
        noticeText = GameObject.FindWithTag("NoticeText").GetComponent <Text>();

        gameObject.GetComponent <Image>().sprite = cardTypes[type];
    }
示例#4
0
 void Start()
 {
     //get reference to UserController to check if mouse is on top of this monster
     userController = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <UserController>();
     if (team == Team.PLAYER && playerController == null)
     {
         playerController = GetComponent <PlayerController>();
         playerHand       = GameObject.FindGameObjectWithTag("Hand").GetComponent <PlayerHandController>();
     }
     SpawnEnemy();
 }
示例#5
0
    void Awake()
    {
        if (playerHandController == null)
        {
            playerHandController = GameObject.FindGameObjectWithTag("Hand").GetComponent <PlayerHandController>();
        }

        if (texts == null)
        {
            texts = GetComponentsInChildren <Text>();
        }
    }
示例#6
0
 private void Update()
 {
     //Checa se recebeu o valor final da carta na mao para permitir aumentar a carta
     if (!showCard && (!isAEnemyCard || !isPrizeCard))
     {
         if (transform.parent.name.Equals("Player Hand") && Vector3.Distance(transform.position, positionToGoBack) < 0.1f)
         {
             hand     = transform.GetComponentInParent <PlayerHandController>();
             position = transform.GetSiblingIndex();
             showCard = true;
         }
     }
 }
示例#7
0
 public static void DuplicateAIShooterAndAIBulletBank(GameObject targetObject, AIShooter sourceShooter, AIBulletBank sourceBulletBank, int startingGunOverrideID = 0, Transform gunAttachPointOverride = null, Transform bulletScriptAttachPointOverride = null, PlayerHandController overrideHandObject = null)
 {
     if (targetObject.GetComponent <AIShooter>() && targetObject.GetComponent <AIBulletBank>())
     {
         return;
     }
     if (!targetObject.GetComponent <AIBulletBank>())
     {
         AIBulletBank aibulletBank = targetObject.AddComponent <AIBulletBank>();
         aibulletBank.Bullets = new List <AIBulletBank.Entry>(0);
         if (sourceBulletBank.Bullets.Count > 0)
         {
             foreach (AIBulletBank.Entry entry in sourceBulletBank.Bullets)
             {
                 aibulletBank.Bullets.Add(new AIBulletBank.Entry
                 {
                     Name               = entry.Name,
                     BulletObject       = entry.BulletObject,
                     OverrideProjectile = entry.OverrideProjectile,
                     ProjectileData     = new ProjectileData
                     {
                         damage  = entry.ProjectileData.damage,
                         speed   = entry.ProjectileData.speed,
                         range   = entry.ProjectileData.range,
                         force   = entry.ProjectileData.force,
                         damping = entry.ProjectileData.damping,
                         UsesCustomAccelerationCurve     = entry.ProjectileData.UsesCustomAccelerationCurve,
                         AccelerationCurve               = entry.ProjectileData.AccelerationCurve,
                         CustomAccelerationCurveDuration = entry.ProjectileData.CustomAccelerationCurveDuration,
                         onDestroyBulletScript           = entry.ProjectileData.onDestroyBulletScript,
                         IgnoreAccelCurveTime            = entry.ProjectileData.IgnoreAccelCurveTime
                     },
                     PlayAudio               = entry.PlayAudio,
                     AudioSwitch             = entry.AudioSwitch,
                     AudioEvent              = entry.AudioEvent,
                     AudioLimitOncePerFrame  = entry.AudioLimitOncePerFrame,
                     AudioLimitOncePerAttack = entry.AudioLimitOncePerAttack,
                     MuzzleFlashEffects      = new VFXPool
                     {
                         effects = entry.MuzzleFlashEffects.effects,
                         type    = entry.MuzzleFlashEffects.type
                     },
                     MuzzleLimitOncePerFrame          = entry.MuzzleLimitOncePerFrame,
                     MuzzleInheritsTransformDirection = entry.MuzzleInheritsTransformDirection,
                     ShellTransform                = entry.ShellTransform,
                     ShellPrefab                   = entry.ShellPrefab,
                     ShellForce                    = entry.ShellForce,
                     ShellForceVariance            = entry.ShellForceVariance,
                     DontRotateShell               = entry.DontRotateShell,
                     ShellGroundOffset             = entry.ShellGroundOffset,
                     ShellsLimitOncePerFrame       = entry.ShellsLimitOncePerFrame,
                     rampBullets                   = entry.rampBullets,
                     conditionalMinDegFromNorth    = entry.conditionalMinDegFromNorth,
                     forceCanHitEnemies            = entry.forceCanHitEnemies,
                     suppressHitEffectsIfOffscreen = entry.suppressHitEffectsIfOffscreen,
                     preloadCount                  = entry.preloadCount
                 });
             }
         }
         aibulletBank.useDefaultBulletIfMissing = true;
         aibulletBank.transforms = new List <Transform>();
         if (sourceBulletBank.transforms != null && sourceBulletBank.transforms.Count > 0)
         {
             foreach (Transform item in sourceBulletBank.transforms)
             {
                 aibulletBank.transforms.Add(item);
             }
         }
         aibulletBank.RegenerateCache();
     }
     if (!targetObject.GetComponent <AIShooter>())
     {
         AIShooter aishooter = targetObject.AddComponent <AIShooter>();
         aishooter.volley = sourceShooter.volley;
         if (startingGunOverrideID != 0)
         {
             aishooter.equippedGunId = startingGunOverrideID;
         }
         else
         {
             aishooter.equippedGunId = sourceShooter.equippedGunId;
         }
         aishooter.shouldUseGunReload        = true;
         aishooter.volleyShootPosition       = sourceShooter.volleyShootPosition;
         aishooter.volleyShellCasing         = sourceShooter.volleyShellCasing;
         aishooter.volleyShellTransform      = sourceShooter.volleyShellTransform;
         aishooter.volleyShootVfx            = sourceShooter.volleyShootVfx;
         aishooter.usesOctantShootVFX        = sourceShooter.usesOctantShootVFX;
         aishooter.bulletName                = sourceShooter.bulletName;
         aishooter.customShootCooldownPeriod = sourceShooter.customShootCooldownPeriod;
         aishooter.doesScreenShake           = sourceShooter.doesScreenShake;
         aishooter.rampBullets               = sourceShooter.rampBullets;
         aishooter.rampStartHeight           = sourceShooter.rampStartHeight;
         aishooter.rampTime = sourceShooter.rampTime;
         if (gunAttachPointOverride)
         {
             aishooter.gunAttachPoint = gunAttachPointOverride;
         }
         else
         {
             aishooter.gunAttachPoint = sourceShooter.gunAttachPoint;
         }
         if (bulletScriptAttachPointOverride)
         {
             aishooter.bulletScriptAttachPoint = bulletScriptAttachPointOverride;
         }
         else
         {
             aishooter.bulletScriptAttachPoint = sourceShooter.bulletScriptAttachPoint;
         }
         aishooter.overallGunAttachOffset = sourceShooter.overallGunAttachOffset;
         aishooter.flippedGunAttachOffset = sourceShooter.flippedGunAttachOffset;
         if (overrideHandObject)
         {
             aishooter.handObject = overrideHandObject;
         }
         else
         {
             aishooter.handObject = sourceShooter.handObject;
         }
         aishooter.AllowTwoHands            = sourceShooter.AllowTwoHands;
         aishooter.ForceGunOnTop            = sourceShooter.ForceGunOnTop;
         aishooter.IsReallyBigBoy           = sourceShooter.IsReallyBigBoy;
         aishooter.BackupAimInMoveDirection = sourceShooter.BackupAimInMoveDirection;
         aishooter.RegenerateCache();
     }
 }
示例#8
0
 public static void BuildSynergyPrefab()
 {
     if (synergyPrefab == null && !CompanionBuilder.companionDictionary.ContainsKey("Synergy_Cross_Chamber"))
     {
         synergyPrefab = CompanionBuilder.BuildPrefab("Synergy Cross Chamber", "Synergy_Cross_Chamber", "LichItems/Resources/CrossChamber/IdleRight/tomb_idle_right_001", new IntVector2(0, 0), new IntVector2(14, 16));
         var           companion = synergyPrefab.AddComponent <CompanionController>();
         PixelCollider collider  = new PixelCollider();
         collider.ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual;
         collider.CollisionLayer         = CollisionLayer.PlayerHitBox;
         collider.ManualWidth            = 14;
         collider.ManualHeight           = 16;
         collider.ManualOffsetX          = 0;
         collider.ManualOffsetY          = 0;
         KnockbackDoer knockback = companion.gameObject.GetOrAddComponent <KnockbackDoer>();
         knockback.weight = 100f;
         companion.aiActor.IsNormalEnemy = false;
         companion.CanInterceptBullets   = true;
         companion.specRigidbody.PrimaryPixelCollider.CollisionLayer = CollisionLayer.PlayerCollider;
         companion.specRigidbody.PixelColliders.Add(collider);
         companion.gameObject.AddComponent <IgnoreEnemyCollisions>();
         companion.specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask(CollisionLayer.EnemyHitBox));
         companion.specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask(CollisionLayer.EnemyCollider));
         companion.specRigidbody.CollideWithOthers = true;
         companion.aiActor.CollisionDamage         = 0f;
         companion.aiActor.MovementSpeed           = 3f;
         companion.aiActor.CanDropCurrency         = false;
         companion.healthHaver.PreventAllDamage    = false;
         GameObject gunAttachPointObject = new GameObject("GunAttachPoint");
         FakePrefab.MarkAsFakePrefab(gunAttachPointObject);
         UnityEngine.Object.DontDestroyOnLoad(gunAttachPointObject);
         Transform gunAttachPoint = gunAttachPointObject.transform;
         gunAttachPoint.parent        = synergyPrefab.transform;
         gunAttachPoint.localPosition = new Vector3(-0.1250f, 0.3125f, 0f);
         GameObject hand = SpriteBuilder.SpriteFromResource("LichItems/Resources/CrossChamber/Hand/hand_001", new GameObject("SynergyCrossChamberHand"));
         FakePrefab.MarkAsFakePrefab(hand);
         UnityEngine.Object.DontDestroyOnLoad(hand);
         LichsBookItem.ConstructOffsetsFromAnchor(hand.GetComponent <tk2dBaseSprite>().GetCurrentSpriteDef(), tk2dBaseSprite.Anchor.MiddleCenter);
         PlayerHandController handController = hand.AddComponent <PlayerHandController>();
         handController.ForceRenderersOff = false;
         handController.attachPoint       = null;
         handController.handHeightFromGun = 0.05f;
         SetupBasicAIShooter(synergyPrefab, 38 /*38 is the id of magnum*/, gunAttachPoint, hand);
         synergyPrefab.AddAnimation("idle_right", "LichItems/Resources/CrossChamber/IdleRight", 4, AnimationType.Idle, DirectionType.TwoWayHorizontal);
         synergyPrefab.AddAnimation("idle_left", "LichItems/Resources/CrossChamber/IdleLeft", 4, AnimationType.Idle, DirectionType.TwoWayHorizontal);
         synergyPrefab.AddAnimation("run_right", "LichItems/Resources/CrossChamber/MoveRight", 10, AnimationType.Move, DirectionType.TwoWayHorizontal);
         synergyPrefab.AddAnimation("run_left", "LichItems/Resources/CrossChamber/MoveLeft", 10, AnimationType.Move, DirectionType.TwoWayHorizontal);
         synergyPrefab.AddAnimation("hit_left", "LichItems/Resources/CrossChamber/HitLeft", 6, AnimationType.Hit, DirectionType.TwoWayHorizontal).wrapMode   = tk2dSpriteAnimationClip.WrapMode.Once;
         synergyPrefab.AddAnimation("hit_right", "LichItems/Resources/CrossChamber/HitRight", 6, AnimationType.Hit, DirectionType.TwoWayHorizontal).wrapMode = tk2dSpriteAnimationClip.WrapMode.Once;
         BehaviorSpeculator component = CrossChamber.synergyPrefab.GetComponent <BehaviorSpeculator>();
         component.MovementBehaviors.Add(new CompanionFollowPlayerBehavior
         {
             IdleAnimations = new string[]
             {
                 "idle"
             },
             DisableInCombat = false
         });
         component.TargetBehaviors = new List <TargetBehaviorBase>
         {
             new TargetPlayerBehavior
             {
                 Radius              = 35f,
                 LineOfSight         = true,
                 ObjectPermanence    = true,
                 SearchInterval      = 0.25f,
                 PauseOnTargetSwitch = false,
                 PauseTime           = 0.25f
             }
         };
         component.AttackBehaviors = new List <AttackBehaviorBase>
         {
             new ShootGunBehavior()
             {
                 GroupCooldownVariance        = -1f,
                 LineOfSight                  = true,
                 WeaponType                   = WeaponType.AIShooterProjectile,
                 OverrideBulletName           = "default",
                 BulletScript                 = null,
                 FixTargetDuringAttack        = false,
                 StopDuringAttack             = false,
                 LeadAmount                   = 0f,
                 LeadChance                   = 1f,
                 RespectReload                = true,
                 MagazineCapacity             = 6,
                 ReloadSpeed                  = 2f,
                 EmptiesClip                  = false,
                 SuppressReloadAnim           = false,
                 TimeBetweenShots             = -1f,
                 PreventTargetSwitching       = false,
                 OverrideAnimation            = string.Empty,
                 OverrideDirectionalAnimation = string.Empty,
                 HideGun                      = false,
                 UseLaserSight                = false,
                 UseGreenLaser                = false,
                 PreFireLaserTime             = -1f,
                 AimAtFacingDirectionWhenSafe = false
             }
         };
         AIBulletBank bulletBank = synergyPrefab.GetOrAddComponent <AIBulletBank>();
         bulletBank.Bullets = new List <AIBulletBank.Entry>
         {
             new AIBulletBank.Entry()
             {
                 Name = "default",
                 OverrideProjectile = true,
                 ProjectileData     = new ProjectileData()
                 {
                     damage  = 10f,
                     speed   = 16f,
                     range   = 60f,
                     force   = 20f,
                     damping = 0f,
                     UsesCustomAccelerationCurve     = false,
                     AccelerationCurve               = null,
                     CustomAccelerationCurveDuration = 0f,
                     IgnoreAccelCurveTime            = 0f,
                     onDestroyBulletScript           = null
                 },
                 BulletObject = null
             }
         };
         bulletBank.useDefaultBulletIfMissing = false;
         bulletBank.transforms = new List <Transform>
         {
             synergyPrefab.transform
         };
         bulletBank.rampBullets                   = false;
         bulletBank.rampStartHeight               = 0f;
         bulletBank.rampTime                      = 0f;
         bulletBank.OverrideGun                   = null;
         bulletBank.OnProjectileCreated           = null;
         bulletBank.OnProjectileCreatedWithSource = null;
         bulletBank.FixedPlayerPosition           = null;
     }
 }
        public static void GenerateGungeoneerMimicBoss(AssetBundle expandSharedAssets1, GameObject aiActorObject, PlayerController sourcePlayer = null)
        {
            if (sourcePlayer == null)
            {
                sourcePlayer = GameManager.Instance.PrimaryPlayer;
            }
            if (sourcePlayer == null)
            {
                return;
            }

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

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

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

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

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

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

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

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

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

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

            CachedEnemyActor.aiShooter.handObject = m_HandController;

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



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

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


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

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

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

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

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


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

            playerMimicController.m_Player = sourcePlayer;

            aiActorObject.AddComponent <ExpandGungeoneerMimicDeathController>();

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

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

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

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

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

            CachedEnemyActor.healthHaver.RegenerateCache();

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

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

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

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

            CachedEnemyActor.RegenerateCache();
            return;
        }
示例#10
0
 public void SetPlayerHandController(PlayerHandController playerHandController)
 {
     this.playerHandController = playerHandController;
 }