예제 #1
0
            public void Unearth()
            {
                if (NetworkServer.active)
                {
                    EffectManager.SimpleEffect(effectPrefab, transform.position, Quaternion.identity, true);
                    PointSoundManager.EmitSoundServer(soundEventDef.index, transform.position);

                    var dropCount = 1;
                    if (dropItemForEachPlayer)
                    {
                        dropCount = Mathf.Max(Run.instance.participatingPlayerCount, 1);
                    }
                    float      angle    = 360f / (float)dropCount;
                    Vector3    vector   = Vector3.up * dropUpVelocityStrength + dropTransform.forward * dropForwardVelocityStrength;
                    Quaternion rotation = Quaternion.AngleAxis(angle, Vector3.up);
                    for (int i = 0; i < dropCount; i++)
                    {
                        PickupDropletController.CreatePickupDroplet(dropPickup, dropTransform.position + Vector3.up * 1.5f, vector);
                        vector = rotation * vector;
                    }
                }

                if (holdoutZoneController && holdoutZoneController.radiusIndicator)
                {
                    holdoutZoneController.radiusIndicator.transform.localScale = Vector3.zero;
                }

                Object.Destroy(gameObject);
            }
예제 #2
0
            public void Awake()
            {
                PurchaseInteraction purchaseInteraction = GetComponent <PurchaseInteraction>();

                purchaseInteraction.onPurchase = new PurchaseEvent();
                purchaseInteraction.onPurchase.AddListener((interactor) =>
                {
                    if (OnUnlock != null)
                    {
                        OnUnlock(interactor);
                    }
                    CharacterBody body = interactor.GetComponent <CharacterBody>();
                    if (body)
                    {
                        Inventory inventory = body.inventory;
                        if (inventory)
                        {
                            inventory.GiveItem(MysticsItemsContent.Items.MysticsItems_Spotter);
                            GenericPickupController.PickupMessage msg = new GenericPickupController.PickupMessage
                            {
                                masterGameObject = body.master.gameObject,
                                pickupIndex      = PickupCatalog.FindPickupIndex(MysticsItemsContent.Items.MysticsItems_Spotter.itemIndex),
                                pickupQuantity   = 1u
                            };
                            NetworkServer.SendByChannelToAll(57, msg, QosChannelIndex.chat.intVal);
                        }
                    }
                    PointSoundManager.EmitSoundServer(repairSoundEventDef.index, transform.position);
                });
            }
예제 #3
0
 // Token: 0x0600055E RID: 1374 RVA: 0x00015BF4 File Offset: 0x00013DF4
 public static void SpawnEffect(EffectIndex effectIndex, EffectData effectData, bool transmit)
 {
     if (transmit)
     {
         EffectManager.TransmitEffect(effectIndex, effectData, null);
         if (NetworkServer.active)
         {
             return;
         }
     }
     if (NetworkClient.active)
     {
         if (effectData.networkSoundEventIndex != NetworkSoundEventIndex.Invalid)
         {
             PointSoundManager.EmitSoundLocal(NetworkSoundEventCatalog.GetAkIdFromNetworkSoundEventIndex(effectData.networkSoundEventIndex), effectData.origin);
         }
         EffectDef effectDef = EffectCatalog.GetEffectDef(effectIndex);
         if (effectDef == null)
         {
             return;
         }
         string spawnSoundEventName = effectDef.spawnSoundEventName;
         if (!string.IsNullOrEmpty(spawnSoundEventName))
         {
             PointSoundManager.EmitSoundLocal((AkEventIdArg)spawnSoundEventName, effectData.origin);
         }
         SurfaceDef surfaceDef = SurfaceDefCatalog.GetSurfaceDef(effectData.surfaceDefIndex);
         if (surfaceDef != null)
         {
             string impactSoundString = surfaceDef.impactSoundString;
             if (!string.IsNullOrEmpty(impactSoundString))
             {
                 PointSoundManager.EmitSoundLocal((AkEventIdArg)impactSoundString, effectData.origin);
             }
         }
         if (!VFXBudget.CanAffordSpawn(effectDef.prefabVfxAttributes))
         {
             return;
         }
         if (effectDef.cullMethod != null && !effectDef.cullMethod(effectData))
         {
             return;
         }
         EffectData      effectData2 = effectData.Clone();
         EffectComponent component   = UnityEngine.Object.Instantiate <GameObject>(effectDef.prefab, effectData2.origin, effectData2.rotation).GetComponent <EffectComponent>();
         if (component)
         {
             component.effectData = effectData2.Clone();
         }
     }
 }
예제 #4
0
            public void FixedUpdate()
            {
                if (!NetworkServer.active)
                {
                    return;
                }
                interval -= Time.fixedDeltaTime;
                if (interval <= 0f && ammo > 0)
                {
                    interval = intervalMax;
                    ammo--;

                    var characterBody = equipmentSlot.characterBody;
                    if (characterBody)
                    {
                        if (!characterBody.characterMotor || !characterBody.characterMotor.isGrounded)
                        {
                            var height = boostDistance.Value;
                            var mass   = characterBody.characterMotor ? characterBody.characterMotor.mass : (characterBody.rigidbody ? characterBody.rigidbody.mass : 1f);
                            var ySpeed = Trajectory.CalculateInitialYSpeedForHeight(height, -characterBody.acceleration);

                            var force = -ySpeed *mass *equipmentSlot.GetAimRay().direction;

                            if (characterBody.characterMotor)
                            {
                                characterBody.characterMotor.ApplyForce(force, false, false);
                            }
                            else if (characterBody.rigidbody)
                            {
                                characterBody.rigidbody.AddForce(force, ForceMode.Impulse);
                            }
                        }
                    }

                    Vector3 position = transform.position;
                    for (int i = 0; i < shotsPerCast; i++)
                    {
                        ProjectileManager.instance.FireProjectile(waveProjectilesScaled[i], position + (10f * (float)i) * aimRay.direction.normalized, Util.QuaternionSafeLookRotation(aimRay.direction), equipmentSlot.gameObject, 0f, 0f, false, DamageColorIndex.Default, null, -1f);
                    }
                    PointSoundManager.EmitSoundServer(sound.index, position);
                }
            }