Пример #1
0
 public override void Merge(bool active)
 {
     base.Merge(active);
     if (!active)
     {
         currentCharge = 0f;
         if (bulletInstance != null)
         {
             bulletInstance.Despawn();
             bulletInstance = null;
         }
     }
 }
Пример #2
0
        IEnumerator SpawnBloodWave()
        {
            EffectInstance effectInstance = Catalog.GetData <EffectData>("BloodWave").Spawn(Player.currentCreature.locomotion.transform.position + Player.currentCreature.transform.forward * 2, Quaternion.LookRotation(Player.currentCreature.transform.forward));
            float          startTime      = Time.time;
            GameObject     wave           = effectInstance.effects[0].gameObject;

            while (Time.time - startTime < 2)
            {
                wave.transform.position += (wave.transform.forward * 2 * Time.deltaTime);

                foreach (Creature creature in Creature.list)
                {
                    if (creature != Player.currentCreature)
                    {
                        if (Vector3.Distance(wave.transform.position, creature.transform.position) < 3)
                        {
                            creature.ragdoll.SetState(Ragdoll.State.Destabilized);
                            creature.ragdoll.GetPart(RagdollPart.Type.Torso).rb.AddForce((wave.transform.forward + Vector3.up) * BookUIHandler.saveData.wavePushStrenght, ForceMode.Impulse);
                        }
                    }
                }

                yield return(new WaitForEndOfFrame());
            }

            BloodWave.waveCreated = false;
            effectInstance.Despawn();
        }
Пример #3
0
 public override void Merge(bool active)
 {
     base.Merge(active);
     if (active)
     {
         effectShown = true;
         textObject.transform.position = Player.currentCreature.mana.mergePoint.transform.position + new Vector3(0, 0.2f, 0);
         ringEffect = ringEffectData.Spawn(Player.currentCreature.mana.mergePoint.transform);
         ringEffect.Play();
         lineEffect = lineEffectData.Spawn(Player.currentCreature.mana.mergePoint.transform.position, Player.currentCreature.mana.mergePoint.transform.rotation);
         lineEffect.Play();
     }
     else
     {
         effectShown = false;
         ringEffect.Stop();
         ringEffect.Despawn();
         lineEffect.Stop();
         lineEffect.Despawn();
         textObject.SetActive(false);
         if (currentCharge == 1)
         {
             Physics.gravity = GetHandsPointingQuaternion() * Vector3.forward * 9.8f * GetHandDistanceInGs();
         }
     }
 }
Пример #4
0
        public override void Merge(bool active)
        {
            base.Merge(active);
            if (active)
            {
                if (cloudEffectInstance != null)
                {
                    cloudEffectInstance.Despawn();
                }

                cloudEffectInstance = stormStartEffectData.Spawn(Player.currentCreature.transform.position, Quaternion.identity);
                cloudEffectInstance.Play();

                return;
            }
            Vector3 from  = Player.local.transform.rotation * PlayerControl.GetHand(Side.Left).GetHandVelocity();
            Vector3 from2 = Player.local.transform.rotation * PlayerControl.GetHand(Side.Right).GetHandVelocity();

            if (from.magnitude > SpellCaster.throwMinHandVelocity && from2.magnitude > SpellCaster.throwMinHandVelocity)
            {
                if (Vector3.Angle(from, mana.casterLeft.magicSource.position - mana.mergePoint.position) < 45f || Vector3.Angle(from2, mana.casterRight.magicSource.position - mana.mergePoint.position) < 45f)
                {
                    if (currentCharge > stormMinCharge && !EarthBendingController.LightningActive)
                    {
                        EarthBendingController.LightningActive = true;
                        mana.StartCoroutine(StormCoroutine());
                        mana.StartCoroutine(DespawnEffectDelay(cloudEffectInstance, 15f));
                        currentCharge = 0;
                        return;
                    }
                }
            }

            mana.StartCoroutine(DespawnEffectDelay(cloudEffectInstance, 1f));
        }
Пример #5
0
        public void UnFreezeCreature(Creature targetCreature)
        {
            if (!targetCreature.isKilled)
            {
                targetCreature.ragdoll.SetState(Ragdoll.State.Destabilized);
                targetCreature.ragdoll.RemoveNoStandUpModifier(this);

                targetCreature.brain.Load(targetCreature.brain.instance.id);
            }


            effectInstance.Despawn();
        }
        IEnumerator FreezeCreature(Creature targetCreature, float duration)
        {
            EffectInstance effectInstance = frozenEffectData.Spawn(targetCreature.transform.position, Quaternion.identity, targetCreature.transform);

            effectInstance.Play();

            targetCreature.ragdoll.SetState(Ragdoll.State.Frozen);
            targetCreature.ragdoll.AddNoStandUpModifier(this);

            targetCreature.brain.Stop();

            yield return(new WaitForSeconds(duration));

            if (!targetCreature.isKilled)
            {
                targetCreature.ragdoll.SetState(Ragdoll.State.Destabilized);
                targetCreature.ragdoll.RemoveNoStandUpModifier(this);

                targetCreature.brain.Load(targetCreature.brain.instance.id);
            }

            effectInstance.Despawn();
        }
Пример #7
0
        IEnumerator SlowCoroutine(Creature targetCreature, float energy, float maxSlow, float minSlow, float duration)
        {
            EffectData imbueHitRagdollEffectData = Catalog.GetData <EffectData>("ImbueIceRagdoll", true);

            effectInstance = imbueHitRagdollEffectData.Spawn(targetCreature.ragdoll.rootPart.transform, true, Array.Empty <Type>());
            effectInstance.SetRenderer(targetCreature.GetRendererForVFX(), false);
            effectInstance.Play(0);
            effectInstance.SetIntensity(1f);

            float animSpeed = Mathf.Lerp(minSlow, maxSlow, energy / 100);

            if (animSpeed != 0)
            {
                targetCreature.animator.speed   *= (animSpeed / 100);
                targetCreature.locomotion.speed *= (animSpeed / 100);
            }
            else
            {
                targetCreature.ragdoll.SetState(Ragdoll.State.Frozen);
                targetCreature.ragdoll.AddNoStandUpModifier(this);

                targetCreature.brain.Stop();
            }


            /*
             * targetCreature.animator.speed *= (animSpeed / 100);
             * targetCreature.locomotion.speed *= (animSpeed / 100);
             */



            yield return(new WaitForSeconds(duration));

            /*
             * targetCreature.animator.speed = 1;
             * targetCreature.locomotion.speed = targetCreature.data.locomotionSpeed;
             *
             *
             *
             * if (!targetCreature.brain.instance.isActive)
             * {
             *  targetCreature.brain.instance.Start();
             * }*/


            if (animSpeed != 0)
            {
                targetCreature.animator.speed   = 1;
                targetCreature.locomotion.speed = targetCreature.data.locomotionSpeed;
            }
            else
            {
                if (!targetCreature.isKilled)
                {
                    targetCreature.ragdoll.SetState(Ragdoll.State.Destabilized);
                    targetCreature.ragdoll.RemoveNoStandUpModifier(this);

                    targetCreature.brain.Load(targetCreature.brain.instance.id);
                }
            }



            effectInstance.Despawn();

            /*
             * targetCreature.umaCharacter.umaDCS.SetColor("Skin", defaultSkinColor, default(Color), 0, true);
             */
        }
Пример #8
0
        IEnumerator DespawnEffectDelay(EffectInstance effect, float delay)
        {
            yield return(new WaitForSeconds(delay));

            effect.Despawn();
        }
Пример #9
0
 void Update()
 {
     if (isPlayer)
     {
         if (Time.time - timer > RPGManager.statInfo.updateLevelTime)
         {
             timer             = Time.time;
             VampireSave.blood = blood;
             File.WriteAllText(Path.Combine(Application.streamingAssetsPath, "Mods/Amnesia RPG/Saves/vampiresave.json"), JsonConvert.SerializeObject(new VampireSave(), Formatting.Indented));
         }
     }
     foreach (Item item in Item.list)
     {
         if (Vector3.Distance(item.transform.position, vampire.ragdoll.GetPart(RagdollPart.Type.Head).transform.position + (vampire.ragdoll.GetPart(RagdollPart.Type.Head).transform.up * 0.1f)) < 0.25f)
         {
             foreach (Paintable paintable in item.paintables)
             {
                 if (Vector3.Distance(paintable.transform.position, vampire.ragdoll.GetPart(RagdollPart.Type.Head).transform.position + (vampire.ragdoll.GetPart(RagdollPart.Type.Head).transform.up * 0.1f)) < 0.10f)
                 {
                     paintable.Clear();
                 }
             }
         }
     }
     if (isPlayer && blood > 1 && vampire.currentHealth < vampire.maxHealth)
     {
         blood -= 0.01f * Time.deltaTime;
         vampire.currentHealth += 0.05f * Time.deltaTime;
     }
     blood -= 0.0025f * Time.deltaTime;
     foreach (Creature creature in Creature.list)
     {
         if (Vector3.Distance(vampire.ragdoll.GetPart(RagdollPart.Type.Head).transform.position, creature.ragdoll.GetPart(RagdollPart.Type.Neck).transform.position) < 0.3f && creature != vampire && !biteVictim)
         {
             biteVictim = creature;
         }
     }
     if (biteVictim)
     {
         if (biteEffect is null)
         {
             biteEffect = Catalog.GetData <EffectData>("Bleeding").Spawn(biteVictim.ragdoll.GetPart(RagdollPart.Type.Neck).transform.position, Quaternion.identity, biteVictim.ragdoll.GetPart(RagdollPart.Type.Neck).transform);
         }
         biteEffect.Play();
         if (isPlayer)
         {
             damage = TraitsManager.vampirismLvl * Time.deltaTime;
         }
         else
         {
             damage = Random.Range(1 * Time.deltaTime, 3 * Time.deltaTime);
         }
         if (biteVictim.currentHealth > damage)
         {
             biteVictim.currentHealth -= damage;
             vampire.currentHealth    += damage;
         }
         else
         {
             biteVictim.Kill();
             if (isPlayer)
             {
                 TraitsManager.vampirismExp += damage;
             }
         }
         if (isPlayer)
         {
             int divider;
             if (biteVictim.isKilled)
             {
                 divider = 100;
             }
             else
             {
                 divider = 50;
             }
             TraitsManager.vampirismExp += damage / divider;
             if (blood < 100)
             {
                 blood += damage / divider;
             }
         }
         if (Vector3.Distance(vampire.ragdoll.GetPart(RagdollPart.Type.Head).transform.position, biteVictim.ragdoll.GetPart(RagdollPart.Type.Neck).transform.position) > 0.3f)
         {
             biteVictim = null;
             biteEffect.Despawn();
             biteEffect = null;
         }
     }
 }