IEnumerator IceSpikesCoroutine()
        {
            Vector3 pos = Player.currentCreature.transform.position;

            EffectInstance frostEffectInstance = frostEffectData.Spawn(pos, Quaternion.identity);

            frostEffectInstance.Play();

            foreach (Creature creature in Creature.list)
            {
                if (creature != Player.currentCreature && !creature.isKilled)
                {
                    float dist = Vector3.Distance(creature.transform.position, pos);
                    if (dist < frostRadius)
                    {
                        mana.StartCoroutine(FreezeCreature(creature, frozenDuration));
                    }
                }
            }

            yield return(new WaitForSeconds(6f));

            //stop
            frostEffectInstance.Stop();
            EarthBendingController.IceActive = false;
        }
Exemplo n.º 2
0
 public override void OnCrystalUse(Side side, bool active)
 {
     staffActive = active;
     if (active)
     {
         staffEffect = chargeEffectData.Spawn(imbue.colliderGroup.imbueShoot.position, Quaternion.identity);
         staffEffect.SetSource(imbue.colliderGroup.imbueShoot);
         staffEffect.SetParent(imbue.colliderGroup.collisionHandler.item.transform);
         ((EffectVfx)staffEffect.effects.Find(effect => effect is EffectVfx)).vfx.SetInt("State", 1);
         staffEffect.Play();
         Player.currentCreature.mana.StartCoroutine(StaffCoroutine());
     }
     else
     {
         if (previousItems != null)
         {
             previousItems.ForEach(item => item?.HeldItem().Reset(CastSource.Staff));
         }
         if (items != null)
         {
             items.ForEach(item => item?.HeldItem()?.Reset(CastSource.Staff));
         }
         staffEffect?.Stop();
         Throw(imbue.colliderGroup.collisionHandler.item.rb.GetPointVelocity(imbue.colliderGroup.imbueShoot.position), CastSource.Staff);
     }
     base.OnCrystalUse(side, active);
 }
Exemplo n.º 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();
         }
     }
 }
Exemplo n.º 4
0
 public override void Exit()
 {
     base.Exit();
     trapEffect.SetIntensity(0);
     trapEffect.Stop();
     dagger.ResetPhysics();
 }
        public IEnumerator PlayEffectSound(float delay, EffectData effectData, Vector3 position, float despawnDelay = 0)
        {
            yield return(new WaitForSeconds(delay));

            EffectInstance effectInstance = effectData.Spawn(position, Quaternion.identity);

            effectInstance.Play();
            if (despawnDelay != 0)
            {
                yield return(new WaitForSeconds(despawnDelay));

                effectInstance.Stop();
            }
        }
Exemplo n.º 6
0
 void Update()
 {
     foreach (Creature creature in Creature.list)
     {
         if (creature.gameObject.GetComponent <VampirismBoth>())
         {
             if (Vector3.Distance(creature.ragdoll.GetPart(RagdollPart.Type.Head).transform.position, transform.position) < 0.3f && !attacker)
             {
                 attacker = creature;
                 bleedEffect.Play();
             }
             else
             {
                 bleedEffect.Stop();
             }
         }
     }
     if (Vector3.Distance(Player.currentCreature.transform.position, transform.position) < 1)
     {
         scared      = true;
         scaredTimer = Time.time;
     }
     if (Time.time - scaredTimer > 10 && scared)
     {
         scared = false;
     }
     if (scared)
     {
         if (!animation.isPlaying)
         {
             animation.Play("Armature_Jump");
         }
         itemSheep.transform.position = itemSheep.transform.position + (gameObject.transform.forward * movementSpeed * Time.deltaTime);
         if (Physics.Raycast(itemSheep.transform.position + (itemSheep.transform.up * 0.1f), itemSheep.transform.forward, out RaycastHit hit, 999))
         {
             Debug.Log(Vector3.Distance(hit.point, itemSheep.transform.position));
         }
     }
     if (health <= 0)
     {
         itemSheep.Despawn();
     }
     if (Time.time - rotationTimer > 1)
     {
         rotationTimer = Time.time;
         itemSheep.transform.LookAt(transform);
     }
 }
Exemplo n.º 7
0
        public async void Fire()
        {
            playing        = true;
            effectInstance = effectData.Spawn(mana.mergePoint.position, mana.mergePoint.rotation);
            effectInstance.Play();

            await Task.Delay(2300);

            Collider[] hit = Physics.OverlapCapsule(mana.mergePoint.position, mana.mergePoint.position + (mana.mergePoint.forward * 8f), 0.7f);

            foreach (Collider collider in hit)
            {
                if (collider.attachedRigidbody)
                {
                    if (collider.GetComponentInParent <Creature>())
                    {
                        Creature creature = collider.GetComponentInParent <Creature>();

                        if (!creature.isPlayer)
                        {
                            if (!creature.isKilled)
                            {
                                creature.ragdoll.SetState(Ragdoll.State.Frozen);
                                collider.attachedRigidbody.AddForce(mana.mergePoint.forward * 30, ForceMode.Impulse);

                                CollisionInstance l_Dmg = new CollisionInstance(new DamageStruct(DamageType.Energy, damage));
                                creature.Damage(l_Dmg);
                            }
                        }
                    }
                }
            }

            await Task.Delay(2300);

            effectInstance.Stop();
            playing = false;
        }
        public IEnumerator BubbleCoroutine()
        {
            Vector3 centerPoint = mana.mergePoint.transform.position;


            EffectInstance bubbleEffect = null;

            bubbleEffect = bubbleEffectData.Spawn(centerPoint, Quaternion.identity);
            bubbleEffect.SetIntensity(0f);
            bubbleEffect.Play(0);

            ParticleSystem parentParticleSystem = bubbleEffect.effects[0].gameObject.GetComponent <ParticleSystem>();


            foreach (ParticleSystem particleSystem in parentParticleSystem.gameObject.GetComponentsInChildren <ParticleSystem>())
            {
                if (particleSystem.gameObject.name == "Portal")
                {
                    float startDelay = particleSystem.main.startDelay.constant;
                    Player.currentCreature.mana.StartCoroutine(PlayEffectSound(startDelay, portalEffectData, particleSystem.transform.position, 3f));
                }

                if (particleSystem.gameObject.name == "Rock")
                {
                    RockCollision scr = particleSystem.gameObject.AddComponent <RockCollision>();
                    scr.rockCollisionEffectData = rockCollisionEffectData;
                    scr.rockExplosionForce      = rockExplosionForce;
                    scr.rockExplosionRadius     = rockExplosionRadius;
                    scr.part = particleSystem;
                }
            }
            yield return(new WaitForSeconds(4.5f));

            bubbleEffect.Stop();
            EarthBendingController.GravActive = false;
        }