示例#1
0
 public void UpdateTrap(Vector3 position, bool armed)
 {
     if (this.armed)
     {
         return;
     }
     this.position = position;
     if (!this.armed && armed)
     {
         trapEffect.SetIntensity(1);
         trapEffect.Play();
     }
     this.armed = armed;
 }
示例#2
0
 protected virtual void Update()
 {
     if (loaded)
     {
         currentIntensity = Mathf.InverseLerp(data.minTorque, data.maxTorque, jointRb.angularVelocity.magnitude);
         effectInstance.SetIntensity(currentIntensity);
     }
 }
示例#3
0
        protected void Awake()
        {
            item = this.GetComponent <Item>();
            item.OnHeldActionEvent += OnHeldAction;
            thrustTransform         = item.GetCustomReference("Thrust");
            module = item.data.GetModule <ItemModuleThrust>();
            EffectData effectData = Catalog.GetData <EffectData>(module.effectId);

            effectInstance = effectData.Spawn(this.transform, false);
            effectInstance.Play();
            effectInstance.SetIntensity(0);
        }
示例#4
0
        protected IEnumerator BubbleCoroutine(float duration)
        {
            bubbleActive = true;
            StopCapture();
            EffectInstance bubbleEffect = null;

            if (bubbleEffectData != null)
            {
                bubbleEffect = bubbleEffectData.Spawn(captureTrigger.transform.position, Quaternion.identity, null, null, true, Array.Empty <Type>());
                bubbleEffect.SetIntensity(0f);
                bubbleEffect.Play(0);
            }
            yield return(new WaitForFixedUpdate());

            StartCapture(0f);
            captureTrigger.transform.SetParent(null);
            float startTime = Time.time;

            while (Time.time - startTime < duration)
            {
                if (!captureTrigger)
                {
                    yield break;
                }
                float num = bubbleScaleCurveOverTime.Evaluate((Time.time - startTime) / duration);
                captureTrigger.SetRadius(num * bubbleEffectMaxScale * 0.5f);
                if (bubbleEffect != null)
                {
                    bubbleEffect.SetIntensity(num);
                }
                yield return(null);
            }
            if (bubbleEffect != null)
            {
                bubbleEffect.End(false, -1f);
            }
            StopCapture();
            bubbleActive = false;
            yield break;
        }
示例#5
0
 public virtual void Load(ItemPhysic.EffectHinge effectHingeData)
 {
     if (effectHingeData != null && hingeJoint != null)
     {
         data = effectHingeData;
         EffectData effectData = Catalog.GetData <EffectData>(effectHingeData.effectId);
         effectInstance = effectData.Spawn(this.transform.position, this.transform.rotation, this.transform, pooled: false);
         effectInstance.SetIntensity(0);
         effectInstance.Play();
         jointRb = hingeJoint.GetComponent <Rigidbody>();
         loaded  = true;
     }
 }
示例#6
0
 protected void Update()
 {
     currentThrust = 0;
     if (rightHand)
     {
         currentThrust += Mathf.Lerp(module.minForce, module.maxForce, PlayerControl.GetHand(rightHand.side).useAxis);
     }
     if (leftHand)
     {
         currentThrust += Mathf.Lerp(module.minForce, module.maxForce, PlayerControl.GetHand(leftHand.side).useAxis);
     }
     effectInstance.SetIntensity(Mathf.InverseLerp(module.minForce * 2, module.maxForce * 2, currentThrust));
 }
示例#7
0
        private void SpawnBulletInstance()
        {
            rotatingMergePoint = new GameObject("rotmpoint");

            bulletInstance = bulletEffectData.Spawn(rotatingMergePoint.transform);
            bulletInstance.Play();
            bulletInstance.SetIntensity(1f);

            foreach (ParticleSystem child in bulletInstance.effects[0].GetComponentsInChildren <ParticleSystem>())
            {
                if (child.gameObject.name == "Bullets")
                {
                    BulletCollisionClass scr = child.gameObject.AddComponent <BulletCollisionClass>();
                    scr.part          = child;
                    scr.bulletColData = bulletCollisionEffectData;
                }
            }
        }
示例#8
0
 public override void Update()
 {
     base.Update();
     if (effectShown)
     {
         textObject.SetActive(true);
         ringEffect.SetSpeed(GetHandDistanceInGs());
         ringEffect.SetIntensity(GetHandDistanceInGs());
         lineEffect.SetSource(Player.currentCreature.handLeft.caster.magicSource);
         lineEffect.SetTarget(Player.currentCreature.handRight.caster.magicSource);
         Player.currentCreature.mana.mergePoint.transform.rotation = GetHandsPointingQuaternion();
         text.text = $"{Math.Round(GetHandDistanceInGs(), 1)}G";
         textObject.transform.position = Vector3.Lerp(
             textObject.transform.position,
             Player.currentCreature.mana.mergePoint.transform.position + new Vector3(0, 0.2f, 0),
             Time.deltaTime * 50.0f);
         textObject.transform.rotation = Quaternion.LookRotation(textObject.transform.position - Player.currentCreature.animator.GetBoneTransform(HumanBodyBones.Head).position);
     }
     else
     {
         textObject.SetActive(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;
        }
示例#10
0
 public void Start()
 {
     item = GetComponent <Item>();
     rb   = item.rb;
     //item.mainCollisionHandler.damagers.ForEach(damager => damager.penetrationExitOnMaxDepth = true);
     controller = Player.currentCreature.mana.gameObject.GetComponent <DaggerController>();
     Catalog.GetData <EffectData>("SlingshotGrabPoint").Spawn(transform).Play();
     trailEffect = Catalog.GetData <EffectData>("ShiftTrail").Spawn(transform);
     trailEffect.SetIntensity(0);
     trailEffect.Play();
     item.OnSnapEvent += holder => {
         // item.lastHandler?.ClearTouch();
         // item.lastHandler = null;
         IntoState <DefaultState>();
         if (item.transform.parent.GetComponentsInChildren <Item>() is Item[] items && items.Count() > 1)
         {
             var slotToUse = holder.slots.FirstOrDefault(slot => slot.GetComponentsInChildren <Item>().Count() == 0);
             if (slotToUse == null)
             {
                 return;
             }
             var holderPoint = item.GetHolderPoint(holder.data.targetAnchor);
             item.transform.MoveAlign(holderPoint.anchor, slotToUse.transform, slotToUse.transform);
         }
         if (holder.GetComponentInParent <Item>() is Item holderItem)
         {
             item.IgnoreObjectCollision(holderItem);
         }
     };
     item.OnUnSnapEvent += holder => {
         if (holder.GetComponentInParent <Item>() is Item holderItem)
         {
             item.IgnoreObjectCollision(holderItem);
             item.RunNextFrame(() => item.IgnoreObjectCollision(holderItem));
         }
     };
     item.OnTelekinesisGrabEvent += (handle, grabber) => {
         if (!state.Grabbable())
         {
             IntoState <DefaultState>();
         }
     };
     item.OnGrabEvent += (handle, hand) => {
         IntoState <DefaultState>();
         foreach (var collider in hand.colliderGroup.colliders)
         {
             foreach (var group in item.colliderGroups)
             {
                 foreach (var otherCollider in group.colliders)
                 {
                     Physics.IgnoreCollision(collider, otherCollider);
                 }
             }
         }
         controller.RunAfter(() => {
             if (hand.caster?.spellInstance is SpellCastCharge spell)
             {
                 spell.imbueEnabled = true;
             }
         }, 0.5f);
     };
     item.OnUngrabEvent += (handle, hand, throwing) => {
         var velocity = Player.local.transform.rotation * PlayerControl.GetHand(hand.side).GetHandVelocity();
         if (throwing && velocity.magnitude > 3)
         {
             lastNoOrbitTime = Time.time;
             IntoState <DefaultState>();
         }
     };
     pidController = new PIDRigidbodyHelper(rb, 5, 1);
     if (state == null)
     {
         IntoState <DefaultState>();
     }
 }
示例#11
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);
             */
        }
示例#12
0
        public void Update()
        {
            isHeld   = item.mainHandler != null;
            isStored = item.holder != null;

            item.rb.useGravity = false;
            item.rb.velocity  *= friction;

            if (Item.list.Where(
                    i => i.itemId == "BlackHoleSphere" ||
                    i.itemId == "WhiteHoleSphere").Count() > 2)
            {
                DestroyOldHoles();
            }

            if (!active)
            {
                return;
            }

            if (isHeld)
            {
                wasHeld = true;
                float axis = PlayerControl.GetHand(item.mainHandler.side).useAxis;
                effect.SetIntensity(axis);
                effect.SetSpeed(axis);
                if (type == White)
                {
                    if (axis > 0)
                    {
                        PushOrSucc(axis);
                        if (!hasFired)
                        {
                            hasFired = true;
                            FireObject();
                        }
                    }
                    else
                    {
                        hasFired = false;
                    }
                }
                else
                {
                    if (axis > 0)
                    {
                        PushOrSucc(axis);
                    }
                }
            }
            else if (isStored)
            {
                wasHeld = true;
                effect.SetIntensity(0);
                effect.SetSpeed(0);
                hasFired = false;
            }
            else
            {
                if (wasHeld)
                {
                    wasHeld      = false;
                    lastHeldTime = Time.time;
                }
                effect.SetIntensity(1);
                effect.SetSpeed(1);
                PushOrSucc();
                hasFired = false;
            }
            if (!isStored && !isHeld && storedItems.Count > 0 && type == White && Time.time - lastHeldTime > itemSpamDelay && Time.time - lastThrownItem > itemThrowDelay)
            {
                lastThrownItem = Time.time;
                GameObject storedObject = storedItems.Dequeue();
                storedObject.SetActive(true);
                TriggerHeadThrow(storedObject.GetComponent <Rigidbody>());
            }
        }