示例#1
0
        void Start()
        {
            try
            {
                //Log("[DamageOverride:DamageOvertime] Awakening Damage Overtime");
                stack    = 1;
                damage   = 1;
                tick     = 0f;
                duration = 2f;

                hm = gameObject.GetComponent <HealthManager>();
                Vector2 enemySize = gameObject.GetComponent <BoxCollider2D>().size;
                particles = HollowPointPrefabs.SpawnObjectFromDictionary("SpellParticlePrefab", gameObject.transform.position, Quaternion.identity);

                ParticlesController fpc = particles.AddComponent <ParticlesController>();
                fpc.parent = gameObject;
                fpc.rateOverTimeMultiplier = 100;
                fpc.size = enemySize;

                particles.SetActive(true);
                particleSystem = particles.GetComponent <ParticleSystem>();
                particleSystem.Stop();
                //Log("ENEMY SIZE IS " + enemySize);
                //gameObject.GetComponent<SetParticleScale>().transform.localScale = enemySize - new Vector2(0.3f, 0.3f);
            }
            catch (Exception e)
            {
                Log("DamageOvertime " + e);
            }
        }
示例#2
0
        IEnumerator SpawnTyphoon(Vector3 spawnPos, float explosionAmount)
        {
            Modding.Logger.Log("Spawning Typhoon");
            float degreeTotal = 0;
            float addedDegree = 180 / (explosionAmount + 1);

            GameObject dungCloud;

            for (int pulse = 0; pulse < 1; pulse++)
            {
                dungCloud = HollowPointPrefabs.SpawnObjectFromDictionary("Knight Spore Cloud", HeroController.instance.transform.position + new Vector3(0, 0, -.001f), Quaternion.identity);
                dungCloud.transform.localScale = new Vector3(1.75f, 1.75f, 0);
                dungCloud.GetComponent <DamageEffectTicker>().SetAttr <float>("damageInterval", 0.2f); //DEFAULT: 0.15
            }
            yield break;
            for (; explosionAmount > 0; explosionAmount--)
            {
                yield return(new WaitForEndOfFrame());

                degreeTotal += addedDegree;
                GameObject      typhoon_ball = Instantiate(HollowPointPrefabs.bulletPrefab, spawnPos, new Quaternion(0, 0, 0, 0));
                BulletBehaviour hpbb         = typhoon_ball.GetComponent <BulletBehaviour>();
                hpbb.bulletDegreeDirection = degreeTotal;
                hpbb.specialAttrib         = "DungExplosionSmall";
                typhoon_ball.SetActive(true);

                //Destroy(typhoon_ball, Range(0.115f, 0.315f));
                Destroy(typhoon_ball, Range(0.115f, 0.315f));
            }
            yield return(null);
        }
示例#3
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);
                }
            }
        }
示例#4
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);
                }
            }
        }
 void Update()
 {
     if (OrientationHandler.pressingAttack && typhoonTimer > 0)
     {
         typhoonTimer = -1;
         int        pelletAmnt     = (PlayerData.instance.quakeLevel == 2) ? 8 : 6;
         GameObject explosionClone = HollowPointPrefabs.SpawnObjectFromDictionary("Gas Explosion Recycle M", HeroController.instance.transform.position, Quaternion.identity);
         explosionClone.transform.localScale = new Vector3(1.5f, 1.5f, 1);
         //StartCoroutine(SpawnGasPulse(HeroController.instance.transform.position, pelletAmnt));
     }
 }
示例#6
0
        //TODO: Create an "explosion component" to spawn on destroy instead of creating the object at the Destroy of the bullet
        public void OnDestroy()
        {
            if (bulletSprite != BulletSpriteType.soul)
            {
                return;
            }

            GameObject fireballImpact = HollowPointPrefabs.SpawnObjectFromDictionary("FireballImpact", gameObject.transform.position, Quaternion.identity);

            fireballImpact.transform.Rotate(0, 0, gameObject.transform.eulerAngles.z, 0);
            fireballImpact.transform.localScale = size - new Vector3(0, 0.50f, 0);
            Destroy(fireballImpact, 1.5f);
        }
        IEnumerator QuakeAbility_SporeRelease(int charges)
        {
            Vector3 spawnPos    = HeroController.instance.transform.position;
            float   pulseAmount = 2 * charges;

            Log("Spawning Gas Pulse");

            AudioHandler.instance.PlayMiscSoundEffect(AudioHandler.HollowPointSoundType.DiveDetonateSFXGO);
            GameObject dungCloud;
            float      cloudIntensity = (PlayerData.instance.equippedCharm_10) ? 0.11f : 0.15f; //DEFAULT: 0.15

            for (int pulse = 0; pulse < pulseAmount; pulse++)
            {
                dungCloud = HollowPointPrefabs.SpawnObjectFromDictionary("Knight Spore Cloud", HeroController.instance.transform.position + new Vector3(0, 0, -.001f), Quaternion.identity);
                dungCloud.transform.localScale = new Vector3(2f, 2f, 0);
                dungCloud.GetComponent <DamageEffectTicker>().SetAttr <float>("damageInterval", cloudIntensity);

                yield return(new WaitForSeconds(0.80f));
            }
            yield break;
        }
示例#8
0
        public void Start()
        {
            rb2d = GetComponent <Rigidbody2D>();
            bc2d = GetComponent <BoxCollider2D>();
            bulletSpriteRenderer = GetComponent <SpriteRenderer>();
            bc2d.enabled         = !ignoreAllCollisions;

            gameObject.tag = "Wall Breaker";

            // +---| Bullet Origin for Distance Calculation |---+
            bulletOriginPosition = gameObject.transform.position;

            //float size = bulletSizeOverride;
            gameObject.transform.localScale = size;
            bc2d.size = size;//Collider size

            // +---| Air Strike Bullet Modifier |---+
            if (fuseTimerXAxis)
            {
                HollowPointPrefabs.projectileSprites.TryGetValue("specialbullet.png", out Sprite fireSupportBulletSprite);
                bulletSpriteRenderer.sprite = fireSupportBulletSprite;
                bulletSpeed = 120;
            }

            /*
             * else if (isDagger)
             * {
             *  //HollowPointPrefabs.projectileSprites.TryGetValue("daggerSprite.png", out Sprite fireSupportBulletSprite);
             *  //bulletSprite.sprite = fireSupportBulletSprite;
             *  bulletSpriteRenderer.sprite = HollowPointPrefabs.projectileSprites["bullet_daggerSprite.png"];
             * }
             */
            if (!bulletSprite.Equals(BulletSpriteType.soul))
            {
                bulletSpriteRenderer.sprite = HollowPointPrefabs.projectileSprites["sprite_bullet_" + bulletSprite.ToString() + ".png"];
            }

            //Particle Effects

            if (enableSoulParticles)
            {
                string     particlePrefabName = (useDefaultParticles) ? "SpellParticlePrefab" : "GrimmParticlePrefab";
                GameObject fireballParticles  = HollowPointPrefabs.SpawnObjectFromDictionary(particlePrefabName, gameObject.transform.position, Quaternion.identity);
                fireballParticles.AddComponent <ParticlesController>().parent = gameObject;
                //fireballParticles.GetComponent<ParticlesController>().size = bullet.size;
                fireballParticles.SetActive(true);
            }

            // +---| Bullet Heat |---+
            float deviationFromHeat = (noHeat) ? 0 : (float)Math.Pow(HeatHandler.currentHeat, 2f) / 500;                     //exponential

            deviationFromHeat *= (PlayerData.instance.equippedCharm_37) ? 1.25f : 1.15f;                                     //Increase movement penalty when equipping sprint master
            deviationFromHeat -= (PlayerData.instance.equippedCharm_14 && HeroController.instance.cState.onGround) ? 18 : 0; //Decrease innacuracy when on ground and steady body is equipped

            float deviation = (perfectAccuracy) ? 0 : (deviationFromHeat);

            deviation = Mathf.Clamp(deviation, 0, 20); //just set up the minimum value, bullets starts acting weird when deviation is negative
            //deviation = (deviation < 0) ? 0 : deviation;

            // +---| Bullet Spread and Recoil |---+
            //a moving pivot for where the bullet can spread, with its maximum and minimum deviation, this allows the bullet to smoothly spread instead of being just random
            bulletPivot = Mathf.Clamp(bulletPivot, deviation * -1, deviation); //Clamps the max/min deviation, shrinking the cone of fire
            //float bulletPivotDelta = rand.Next(0, 2) * 2 - 1; //gives either -1 or 1
            bulletBias = !bulletBias;
            float bulletPivotDelta = (bulletBias) ? 1 : -1;

            bulletPivotDelta = (bulletPivot >= deviation || bulletPivot <= (deviation * -1)) ? bulletPivotDelta * -1 : bulletPivotDelta;
            bulletPivot     += bulletPivotDelta * rand.Next(Stats.instance.current_minWeaponSpreadFactor, Stats.instance.current_minWeaponSpreadFactor + 5); //1 can be changed by the amount of distance each bullet deviation should have
            float degree = bulletDegreeDirection + Mathf.Clamp(bulletPivot, deviation * -1, deviation);;
            float radian = (float)(degree * Math.PI / 180);

            xDeg = bulletSpeed * Math.Cos(radian) * bulletSpeedMult;
            yDeg = bulletSpeed * Math.Sin(radian) * bulletSpeedMult;

            //Changes the degree of bullet sprite rotation and the bullet direction when wall sliding
            if (HeroController.instance.cState.wallSliding)
            {
                xDeg  *= -1;
                degree = (HeroController.instance.cState.facingRight) ? ((degree <= 90 ? 180 : -180) - degree) : (180 - degree);
            }

            rb2d.velocity = new Vector2((float)xDeg, (float)yDeg);  //Bullet speed
            bulletSpriteRenderer.transform.Rotate(0, 0, degree, 0); //Bullet rotation
        }
示例#9
0
        public void CharmUpdate(PlayerData data, HeroController controller)
        {
            if (furyParticle == null)
            {
                furyParticle = HollowPointPrefabs.SpawnObjectFromDictionary("FuryParticlePrefab", HeroController.instance.transform);
                furyParticle.SetActive(false);
            }

            if (furyBurst == null)
            {
                furyBurst = HollowPointPrefabs.SpawnObjectFromDictionary("FuryBurstPrefab", HeroController.instance.transform);
                furyBurst.SetActive(false);
            }

            Log("Charm Update Called");
            //Initialise stats
            currentEquippedGun = WeaponSwapAndStatHandler.instance.EquipWeapon();

            current_weapon                = currentEquippedGun.gunName;
            current_class                 = currentEquippedGun.gunSubClass;
            current_damagePerShot         = currentEquippedGun.damageBase;
            current_damagePerLevel        = currentEquippedGun.damageScale;
            current_energyGainOnHit       = currentEquippedGun.energyGainOnHit;
            current_bulletLifetime        = currentEquippedGun.bulletLifetime;
            current_boostMultiplier       = currentEquippedGun.boostMultiplier;
            current_bulletVelocity        = currentEquippedGun.bulletVelocity;
            current_fireRateCooldown      = currentEquippedGun.fireRate;
            current_soulCostPerShot       = currentEquippedGun.soulCostPerShot;
            current_heatPerShot           = currentEquippedGun.heatPerShot;
            current_soulGainedPerHit      = currentEquippedGun.soulGainOnHit;
            current_soulGainedPerKill     = currentEquippedGun.soulGainOnHit;
            current_soulRegenSpeed        = currentEquippedGun.soulRegenSpeed;
            current_minWeaponSpreadFactor = currentEquippedGun.minWeaponSpreadFactor;
            current_walkSpeed             = 3f;

            current_class = WeaponSwapAndStatHandler.instance.ChangeClass(current_class);

            if (pd_instance.equippedCharm_6) //Fury of the Fallen
            {
                current_soulGainedPerKill += 10;
                current_soulRegenSpeed    -= 0.10f;
                current_energyGainOnHit   *= 2;
            }

            if (pd_instance.equippedCharm_19) //Shaman Stone
            {
                current_fireRateCooldown *= 0.75f;
                current_heatPerShot      += 10;
            }

            if (pd_instance.equippedCharm_21) //Soul Eater
            {
                current_soulGainedPerKill     += 24;
                current_soulGainedPerHit      += 3;
                current_soulRegenSpeed        -= 0.015f;
                current_heatPerShot           += 15;
                current_minWeaponSpreadFactor += 3;
            }

            if (pd_instance.equippedCharm_25) //Strength
            {
                current_damagePerShot    += 3;
                current_damagePerLevel   += 2;
                current_fireRateCooldown *= 0.75f;
                current_heatPerShot      += 15f;
            }

            Log("currentFireCooldown " + current_fireRateCooldown);

            if (pd_instance.equippedCharm_28) //Shape of Unn
            {
                current_bulletVelocity        *= 1.2f;
                current_heatPerShot           -= 10;
                current_minWeaponSpreadFactor -= 3;
            }

            if (pd_instance.equippedCharm_27) //Joni
            {
                current_soulRegenSpeed -= 0.033f;
            }

            //Dash Master
            if (pd_instance.equippedCharm_31)
            {
                current_boostMultiplier *= 1.35f;
            }

            //Spell Twister
            if (pd_instance.equippedCharm_33)
            {
                current_soulCostPerShot = (int)(current_soulCostPerShot * 0.75f);
            }


            if (pd_instance.equippedCharm_7)
            {
                current_energyGainOnHit = (int)(current_energyGainOnHit * 1.5f);
            }
            current_energyRequirement = (pd_instance.equippedCharm_34) ? 140 : 100;   //Deep Focus
            current_energyPenalty     = (pd_instance.equippedCharm_23) ? 0.7f : 0.5f; // Fragile Heart

            if (pd_instance.equippedCharm_24)                                         //Fragile Greed
            {
                current_soulGainedPerKill *= 3;
                current_soulGainedPerHit  *= 0;
                current_soulRegenTimer    *= 2f;
                current_fireRateCooldown  *= 0.80f;
            }

            recentlyKilledTimer = 0;
            hc_instance.NAIL_CHARGE_TIME_DEFAULT = 0.75f;

            //Charge Abilities
            adrenalineCharges      = 0;
            adrenalineEnergy       = 0;
            heal_ChargesDecayTimer = 0;
            adenalineCooldownTimer = 0;
            adrenalineOnCooldown   = false;

            fireModeIcon?.Invoke("hudicon_omni.png");
            adrenalineChargeIcons?.Invoke("0");
            nailArtIcon?.Invoke("true");

            PlayerData.instance.focusMP_amount = current_soulCostPerShot;

            //Minimum value setters, NOTE: soul cost doesnt like having it at 1 so i set it up as 2 minimum
            if (current_soulCostPerShot < 2)
            {
                current_soulCostPerShot = 2;
            }
            if (current_walkSpeed < 1)
            {
                current_walkSpeed = 1;
            }
            if (current_fireRateCooldown < 0.01f)
            {
                current_fireRateCooldown = 0.05f;
            }
            if (current_soulRegenSpeed < 0.01f)
            {
                current_soulRegenSpeed = 0.005f;
            }
            if (current_bulletVelocity > 80)
            {
                current_bulletVelocity = 80;
            }
            if (current_heatPerShot < 1)
            {
                current_heatPerShot = 1;
            }
            if (current_minWeaponSpreadFactor < 1)
            {
                current_minWeaponSpreadFactor = 1;
            }
        }