//========================================SPELL METHODS====================================

        public static IEnumerator ScreamAbility_SulphurStorm(int charges)
        {
            int   burstAmount    = 1 * charges;
            int   shellsPerBurst = 6;
            float shellLifeTime  = 0.06f;

            for (int burst = 0; burst < burstAmount; burst++)
            {
                //AudioHandler.instance.PlayMiscSoundEffect(AudioHandler.HollowPointSoundType.MortarWhistleSFXGO, alteredPitch: false);
                float waveRotation = 60;
                for (int shells = 0; shells < shellsPerBurst; shells++)
                {
                    Vector3         knightPos = HeroController.instance.transform.position;
                    GameObject      shell     = HollowPointPrefabs.SpawnBulletAtCoordinate(waveRotation + Range(-10f, 10f), knightPos, 0);
                    BulletBehaviour hpbb      = shell.GetComponent <BulletBehaviour>();
                    hpbb.ignoreAllCollisions = true;
                    hpbb.bulletSpeed         = 70f;
                    hpbb.size         = new Vector2(0.6f, 0.7f);
                    hpbb.bulletSprite = BulletBehaviour.BulletSpriteType.dung;
                    shell.AddComponent <BulletIsExplosive>().explosionType = BulletIsExplosive.ExplosionType.DungGas;
                    shell.SetActive(true);
                    Destroy(shell, shellLifeTime);
                    shellLifeTime += 0.01f;
                    waveRotation  += 60;

                    yield return(new WaitForSeconds(0.08f));
                }
                //yield return new WaitForSeconds(1f);
            }
        }
Esempio n. 2
0
        public void OnDestroy()
        {
            if (explosionType == ExplosionType.DungGas)
            {
                HollowPointPrefabs.prefabDictionary.TryGetValue("Dung Explosion", out GameObject dungExplosion);
                GameObject dungExplosionGO = Instantiate(dungExplosion, gameObject.transform.position + new Vector3(0, 0, -1.5f), Quaternion.identity);
                dungExplosionGO.SetActive(true);
                dungExplosionGO.name += " KnightMadeDungExplosion";

                HollowPointPrefabs.prefabDictionary.TryGetValue("Knight Dung Cloud", out GameObject sporeCloud);
                GameObject sporeCloudGO = Instantiate(sporeCloud, gameObject.transform.position + new Vector3(0, 0, -.001f), Quaternion.identity);
                sporeCloudGO.SetActive(true);
                AudioHandler.instance.PlayMiscSoundEffect(AudioHandler.HollowPointSoundType.DiveDetonateSFXGO);
            }

            if (explosionType == ExplosionType.DungExplosion || explosionType == ExplosionType.DungExplosionSmall)
            {
                HollowPointPrefabs.prefabDictionary.TryGetValue("Dung Explosion", out GameObject dungExplosion);
                GameObject dungExplosionGO = Instantiate(dungExplosion, gameObject.transform.position + new Vector3(0, 0, -1.5f), Quaternion.identity);
                dungExplosionGO.SetActive(true);
                dungExplosionGO.name += " KnightMadeDungExplosion";

                if (explosionType == ExplosionType.DungExplosionSmall)
                {
                    dungExplosionGO.transform.localScale = new Vector3(0.6f, 0.6f, -1);
                }
            }

            //If its from a grenade launch or a offensive fire support projectile, make it explode
            else if (explosionType == ExplosionType.GasExplosion || explosionType == ExplosionType.ArtilleryShell)
            {
                Log("ARTILLERY!");
                GameObject explosionClone = HollowPointPrefabs.SpawnObjectFromDictionary("Gas Explosion Recycle M", gameObject.transform.position + new Vector3(0, 0, -.001f), Quaternion.identity);
                explosionClone.name += " KnightMadeExplosion";

                //Shrinks the explosion when its not a fire support bullet or its not an upgraded vengeful, as a nerf/downgrade
                if (explosionType == ExplosionType.ArtilleryShell)
                {
                    AudioHandler.instance.PlayMiscSoundEffect(AudioHandler.HollowPointSoundType.MortarExplosionSFXGO);
                    //StartCoroutine(SpawnCluster());
                    for (int shrapnel = 0; shrapnel < 6; shrapnel++)
                    {
                        GameObject s = HollowPointPrefabs.SpawnBulletAtCoordinate(UnityEngine.Random.Range(190, 350), gameObject.transform.position, 1);
                        s.AddComponent <BulletIsExplosive>().explosionType = ExplosionType.DungExplosion;
                        Destroy(s, 1f);
                    }
                }
                else if (PlayerData.instance.fireballLevel > 1)
                {
                    explosionClone.transform.localScale = new Vector3(1.3f, 1.3f, 0);
                }
                else
                {
                    explosionClone.transform.localScale = new Vector3(0.7f, 0.7f, 0);
                }
            }
        }
Esempio n. 3
0
        public void OnDestroy()
        {
            bulletTrailClone.transform.parent = null;
            Destroy(bulletTrailClone, 1f);                                                                                                                                  //just to make sure theres no lingering game objects in the background

            Destroy(Instantiate(HollowPointPrefabs.bulletFadePrefab, gameObject.transform.position + new Vector3(0, 0, -0.5f), gameObject.transform.localRotation), 0.03f); //bullet fade out sprite

            if (specialAttrib.Contains("Explosion") && PlayerData.instance.equippedCharm_17)
            {
                //HollowPointPrefabs.prefabDictionary.TryGetValue("Knight Spore Cloud", out GameObject sporeCloud);
                //GameObject sporeCloudGO = Instantiate(sporeCloud, gameObject.transform.position + new Vector3(0, 0, -.001f), Quaternion.identity);
                //sporeCloudGO.SetActive(true);
            }

            if (specialAttrib.Contains("DungExplosion"))
            {
                HollowPointPrefabs.prefabDictionary.TryGetValue("Dung Explosion", out GameObject dungExplosion);
                GameObject dungExplosionGO = Instantiate(dungExplosion, gameObject.transform.position + new Vector3(0, 0, -.001f), Quaternion.identity);
                dungExplosionGO.SetActive(true);
                dungExplosionGO.name += " KnightMadeDungExplosion";

                if (specialAttrib.Contains("Small"))
                {
                    dungExplosionGO.transform.localScale = new Vector3(0.6f, 0.6f, 0);
                }
            }

            //If its from a grenade launch or a offensive fire support projectile, make it explode
            else if (gameObject.GetComponent <BulletBehaviour>().specialAttrib.Contains("Explosion") || isFireSupportBullet)
            {
                GameObject explosionClone = HollowPointPrefabs.SpawnObjectFromDictionary("Gas Explosion Recycle M", gameObject.transform.position + new Vector3(0, 0, -.001f), Quaternion.identity);
                explosionClone.name += " KnightMadeExplosion";

                if (false)
                {
                    for (int shrap = 0; shrap <= 5; shrap++)
                    {
                        GameObject bul = HollowPointPrefabs.SpawnBulletAtCoordinate(rand.Next(0, 360), gameObject.transform.position, 6);
                        bul.GetComponent <BulletBehaviour>().specialAttrib = "DungExplosion";
                    }
                }

                //Shrinks the explosion when its not a fire support bullet or its not an upgraded vengeful, as a nerf/downgrade
                if (isFireSupportBullet)
                {
                    SpellControlOverride.PlayAudio("mortarexplosion", true);
                }
                else if (PlayerData.instance.fireballLevel > 1)
                {
                    explosionClone.transform.localScale = new Vector3(1.3f, 1.3f, 0);
                }
                else
                {
                    explosionClone.transform.localScale = new Vector3(0.7f, 0.7f, 0);
                }
            }
        }
Esempio n. 4
0
        //========================================FIRE SUPPORT SPAWN METHODS====================================

        //Regular steel rain (non tracking)
        public static IEnumerator StartSteelRainNoTrack(Vector3 targetCoordinates, int totalShells)
        {
            int artyDirection = (HeroController.instance.cState.facingRight) ? 1 : -1;

            Modding.Logger.Log("SPELL CONTROL STEEL RAIN NO TRACKING");
            float shellAimPosition = 5 * artyDirection; //Allows the shell to "walk" slowly infront of the player

            for (int shells = 0; shells < totalShells; shells++)
            {
                //GameObject shell = Instantiate(HollowPointPrefabs.bulletPrefab, targetCoordinates + new Vector3(Range(-5, 5), Range(25, 50), -0.1f), new Quaternion(0, 0, 0, 0));
                GameObject shell = HollowPointPrefabs.SpawnBulletAtCoordinate(270, HeroController.instance.transform.position + new Vector3(shellAimPosition, 30, -0.1f), 0);
                shellAimPosition += 3 * artyDirection;
                BulletBehaviour hpbb = shell.GetComponent <BulletBehaviour>();
                hpbb.isFireSupportBullet = true;
                hpbb.ignoreCollisions    = true;
                hpbb.targetDestination   = targetCoordinates + new Vector3(0, Range(3f, 6f), -0.1f);
                shell.SetActive(true);
                yield return(new WaitForSeconds(0.5f));
            }
        }
        public static IEnumerator QuakeAbility_DangerClose(int charges)
        {
            int     totalShells = 3 * charges;
            Vector3 knightPos   = HeroController.instance.transform.position;

            AudioHandler.instance.PlayMiscSoundEffect(AudioHandler.HollowPointSoundType.MortarWhistleSFXGO, alteredPitch: false);
            yield return(new WaitForSeconds(0.65f));

            for (int shells = 0; shells < totalShells; shells++)
            {
                //GameObject shell = Instantiate(HollowPointPrefabs.bulletPrefab, targetCoordinates + new Vector3(Range(-5, 5), Range(25, 50), -0.1f), new Quaternion(0, 0, 0, 0));
                GameObject      shell = HollowPointPrefabs.SpawnBulletAtCoordinate(270, knightPos + new Vector3(Range(-6, 6), 80, -1f), 0);
                BulletBehaviour hpbb  = shell.GetComponent <BulletBehaviour>();
                hpbb.fuseTimerXAxis      = true;
                hpbb.targetDestination   = knightPos + new Vector3(0, Range(2f, 7f), -0.1f);
                hpbb.ignoreAllCollisions = true;
                shell.AddComponent <BulletIsExplosive>().explosionType = BulletIsExplosive.ExplosionType.DungExplosion;
                shell.SetActive(true);
                yield return(new WaitForSeconds(0.05f));
            }
        }
        public static IEnumerator ScreamAbility_CreepingAirburst(int charges)
        {
            Vector3 targetCoordinates = HeroController.instance.transform.position;
            int     totalShells       = 2 + 1 * charges;
            int     artyDirection     = (HeroController.instance.cState.facingRight) ? 1 : -1;
            float   shellAimPosition  = 5 * artyDirection; //Allows the shell to "walk" slowly infront of the player

            AudioHandler.instance.PlayMiscSoundEffect(AudioHandler.HollowPointSoundType.MortarWhistleSFXGO, alteredPitch: false);
            yield return(new WaitForSeconds(0.65f));

            for (int shells = 0; shells < totalShells; shells++)
            {
                GameObject shell = HollowPointPrefabs.SpawnBulletAtCoordinate(270, HeroController.instance.transform.position + new Vector3(shellAimPosition, 80, -1f), 0);
                shellAimPosition += 2 * artyDirection;
                BulletBehaviour hpbb = shell.GetComponent <BulletBehaviour>();
                hpbb.fuseTimerXAxis      = true;
                hpbb.ignoreAllCollisions = true;
                hpbb.targetDestination   = targetCoordinates + new Vector3(0, Range(5f, 6f), -0.1f);
                //shell.AddComponent<BulletIsExplosive>().explosionType = BulletIsExplosive.ExplosionType.ArtilleryShell;
                shell.AddComponent <BulletIsExplosive>().explosionType = BulletIsExplosive.ExplosionType.ArtilleryShell;
                shell.SetActive(true);
                yield return(new WaitForSeconds(0.30f));
            }
        }