Exemple #1
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);
                }
            }
        }
Exemple #2
0
        /* ======================================================FIRE SUPPORT OFFENSIVE TARGET===========================
         * NOTE:
         *  Heres the thing with this method
         *
         *  Turns out if the game object that gets deleted, whatever coroutine they do also gets deleted
         *  Which is why the coroutine only fires 1 round before destroying itself
         *  This method just ensures that theres a long enough lifespan on the bullet once it hits that it'll be able to
         *  deplete all the rounds
         */
        public void OffensiveFireSupport_Target(GameObject fireSupportGO, GameObject enemyGO, bool trackTarget)
        {
            Vector3 pos = gameObject.transform.position;

            Modding.Logger.Log("CALL AN AIR STRIKE AT THIS POSITION " + pos);

            fireSupportGO.GetComponent <BoxCollider2D>().enabled  = false;             //If i dont disable the collider, itll keep colliding and keep calling fire support on wtv it collides on
            fireSupportGO.GetComponent <SpriteRenderer>().enabled = false;             //Just to make sure it stops showing up visually
            fireSupportGO.GetComponent <Rigidbody2D>().velocity   = new Vector2(0, 0); //Stop the bullet movement, so the line renderer wont show up
            int totalShells = (PlayerData.instance.screamLevel > 1) ? 10 : 6;

            //Modding.Logger.Log(enemyGO.transform == null);
            if (trackTarget && enemyGO != null)
            {
                StartCoroutine(SpellControlOverride.StartSteelRain(enemyGO, totalShells));
            }
            else
            {
                StartCoroutine(SpellControlOverride.StartSteelRainNoTrack(pos, totalShells));
            }

            Destroy(fireSupportGO, 25f);
        }