Example #1
0
        private void Start()
        {
            self = base.GetComponent <Projectile>();
            if (self)
            {
                self.OnHitEnemy += OnHitEnemy;
                int random = UnityEngine.Random.Range(1, 7);
                switch (random)
                {
                case 1:
                    PierceProjModifier piercing = self.gameObject.GetOrAddComponent <PierceProjModifier>();
                    piercing.penetration += 2;
                    break;

                case 2:
                    BounceProjModifier bouncing = self.gameObject.GetOrAddComponent <BounceProjModifier>();
                    bouncing.numberOfBounces += 2;
                    break;

                case 3:
                    RemoteBulletsProjectileBehaviour remote = self.gameObject.GetOrAddComponent <RemoteBulletsProjectileBehaviour>();
                    break;

                case 4:
                    AngryBulletsProjectileBehaviour angry = self.gameObject.GetOrAddComponent <AngryBulletsProjectileBehaviour>();
                    break;

                case 5:
                    OrbitalBulletsBehaviour orbital = self.gameObject.gameObject.GetOrAddComponent <OrbitalBulletsBehaviour>();
                    break;

                case 6:
                    HomingModifier homing = self.gameObject.gameObject.AddComponent <HomingModifier>(); homing.HomingRadius = 100f;
                    break;
                }
            }
        }
        public static void Add()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("Pillarocket", "pillarocket");

            Game.Items.Rename("outdated_gun_mods:pillarocket", "nn:pillarocket");
            var behav = gun.gameObject.AddComponent <Pillarocket>();

            behav.preventNormalFireAudio    = true;
            behav.preventNormalReloadAudio  = true;
            behav.overrideNormalFireAudio   = "Play_ENM_statue_stomp_01";
            behav.overrideNormalReloadAudio = "Play_ENM_statue_charge_01";
            gun.SetShortDescription("Ancient Shrine");
            gun.SetLongDescription("Fires vengeful effigies, under your command." + "\n\nInhabited by the souls of ancient gundead heroes.");

            gun.SetupSprite(null, "pillarocket_idle_001", 8);


            gun.gunSwitchGroup = (PickupObjectDatabase.GetById(37) as Gun).gunSwitchGroup;
            gun.AddProjectileModuleFrom(PickupObjectDatabase.GetById(39) as Gun, true, false);

            //GUN STATS
            gun.DefaultModule.ammoCost      = 1;
            gun.DefaultModule.shootStyle    = ProjectileModule.ShootStyle.SemiAutomatic;
            gun.DefaultModule.sequenceStyle = ProjectileModule.ProjectileSequenceStyle.Random;
            gun.reloadTime = 4f;
            gun.DefaultModule.cooldownTime        = 2f;
            gun.DefaultModule.angleVariance       = 20;
            gun.DefaultModule.numberOfShotsInClip = 4;
            gun.muzzleFlashEffects = (PickupObjectDatabase.GetById(372) as Gun).muzzleFlashEffects;
            gun.barrelOffset.transform.localPosition = new Vector3(2.18f, 1.68f, 0f);
            gun.SetBaseMaxAmmo(30);
            gun.ammo = 30;

            //BULLET STATS
            Projectile projectile = UnityEngine.Object.Instantiate <Projectile>(gun.DefaultModule.projectiles[0]);

            projectile.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(projectile.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(projectile);
            projectile.baseData.speed        = 6.5f;
            projectile.baseData.damage       = 80f;
            projectile.baseData.range        = 100;
            projectile.baseData.force        = 10;
            projectile.pierceMinorBreakables = true;
            RemoteBulletsProjectileBehaviour remote = projectile.gameObject.GetOrAddComponent <RemoteBulletsProjectileBehaviour>();

            remote.trackingTime = 1000;
            PillarocketFiring firing = projectile.gameObject.GetOrAddComponent <PillarocketFiring>();

            projectile.AnimateProjectile(new List <string> {
                "pillarocket_proj_001",
                "pillarocket_proj_002",
                "pillarocket_proj_003",
                "pillarocket_proj_004",
                "pillarocket_proj_005",
                "pillarocket_proj_006",
                "pillarocket_proj_007",
                "pillarocket_proj_008",
                "pillarocket_proj_008",
                "pillarocket_proj_008",
                "pillarocket_proj_008",
                "pillarocket_proj_008",
                "pillarocket_proj_008",
                "pillarocket_proj_008",
                "pillarocket_proj_009",
                "pillarocket_proj_010",
                "pillarocket_proj_011",
                "pillarocket_proj_012",
                "pillarocket_proj_013",
                "pillarocket_proj_014",
            }, 20,                                                                                                        //FPS
                                         true,                                                                            //LOOPS
                                         AnimateBullet.ConstructListOfSameValues <IntVector2>(new IntVector2(15, 8), 20), //PIXELSIZES
                                         AnimateBullet.ConstructListOfSameValues(false, 20),                              //LIGHTENEDS
                                         AnimateBullet.ConstructListOfSameValues(tk2dBaseSprite.Anchor.MiddleLeft, 20),   //ANCHORS
                                         AnimateBullet.ConstructListOfSameValues(false, 20),                              //ANCHORSCHANGECOLLIDERS
                                         AnimateBullet.ConstructListOfSameValues(false, 20),
                                         AnimateBullet.ConstructListOfSameValues <Vector3?>(null, 20),
                                         AnimateBullet.ConstructListOfSameValues <IntVector2?>(new IntVector2(15, 6), 20),
                                         AnimateBullet.ConstructListOfSameValues <IntVector2?>(null, 20),
                                         AnimateBullet.ConstructListOfSameValues <Projectile>(null, 20));

            gun.DefaultModule.ammoType       = GameUIAmmoType.AmmoType.CUSTOM;
            gun.DefaultModule.customAmmoType = CustomClipAmmoTypeToolbox.AddCustomAmmoType("Pillarocket Bullets", "NevernamedsItems/Resources/CustomGunAmmoTypes/pillarocket_clipfull", "NevernamedsItems/Resources/CustomGunAmmoTypes/pillarocket_clipempty");

            gun.DefaultModule.projectiles[0] = projectile;
            gun.gunClass = GunClass.EXPLOSIVE;
            gun.quality  = PickupObject.ItemQuality.S;
            ETGMod.Databases.Items.Add(gun, null, "ANY");

            Projectile akproj = UnityEngine.Object.Instantiate <Projectile>((PickupObjectDatabase.GetById(15) as Gun).DefaultModule.projectiles[0]);

            akproj.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(akproj.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(akproj);
            akproj.SetProjectileSpriteRight("pillarocket_subprojectile", 5, 5, true, tk2dBaseSprite.Anchor.MiddleCenter, 3, 3);
            PillarocketAKProj = akproj;

            Projectile magnum = UnityEngine.Object.Instantiate <Projectile>((PickupObjectDatabase.GetById(38) as Gun).DefaultModule.projectiles[0]);

            magnum.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(magnum.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(magnum);
            magnum.SetProjectileSpriteRight("pillarocket_subprojectile", 5, 5, true, tk2dBaseSprite.Anchor.MiddleCenter, 3, 3);
            PillarocketMagnumProj = magnum;

            Projectile shotproj = UnityEngine.Object.Instantiate <Projectile>((PickupObjectDatabase.GetById(51) as Gun).DefaultModule.projectiles[0]);

            shotproj.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(shotproj.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(shotproj);
            shotproj.SetProjectileSpriteRight("pillarocket_subprojectile", 5, 5, true, tk2dBaseSprite.Anchor.MiddleCenter, 3, 3);
            PillarocketShotgunProj = shotproj;
            ID = gun.PickupObjectId;
        }