Пример #1
0
    //Only works serverside:
    public void DoMeleeDamage(Vector2 dmgPosition, GameObject originator, int dmgAmt)
    {
        Vector3Int   cellPos = metaTileMap.WorldToCell(dmgPosition);
        MetaDataNode data    = metaDataLayer.Get(cellPos);

        if (Layer.LayerType == LayerType.Windows)
        {
            if (metaTileMap.HasTile(cellPos, LayerType.Windows))
            {
                PlaySoundMessage.SendToAll("GlassHit", dmgPosition, Random.Range(0.9f, 1.1f));
                AddWindowDamage(dmgAmt, data, cellPos, dmgPosition);
                return;
            }
        }

        if (Layer.LayerType == LayerType.Grills)
        {
            //Make sure a window is not protecting it first:
            if (!metaTileMap.HasTile(cellPos, LayerType.Windows))
            {
                if (metaTileMap.HasTile(cellPos, LayerType.Grills))
                {
                    PlaySoundMessage.SendToAll("GrillHit", dmgPosition, Random.Range(0.9f, 1.1f));
                    AddGrillDamage(dmgAmt, data, cellPos, dmgPosition);
                }
            }
        }
    }
Пример #2
0
    private void AddWindowDamage(int damage, MetaDataNode data, Vector3Int cellPos, Vector3 bulletHitTarget)
    {
        data.AddDamage(damage);
        if (data.GetDamage >= 20 && data.GetDamage < 50 && data.WindowDmgType != "crack01")
        {
            tileChangeManager.ChangeTile("crack01", cellPos, TileChangeLayer.WindowDamage);
            data.WindowDmgType = "crack01";
        }

        if (data.GetDamage >= 50 && data.GetDamage < 75 && data.WindowDmgType != "crack02")
        {
            tileChangeManager.ChangeTile("crack02", cellPos, TileChangeLayer.WindowDamage);
            data.WindowDmgType = "crack02";
        }

        if (data.GetDamage >= 75 && data.GetDamage < 100 && data.WindowDmgType != "crack03")
        {
            tileChangeManager.ChangeTile("crack03", cellPos, TileChangeLayer.WindowDamage);
            data.WindowDmgType = "crack03";
        }

        if (data.GetDamage >= 100 && data.WindowDmgType != "broken")
        {
            tileChangeManager.RemoveTile(cellPos, TileChangeLayer.Window);

            //Spawn 3 glass shards with different sprites:
            SpawnGlassShards(bulletHitTarget);

            //Play the breaking window sfx:
            PlaySoundMessage.SendToAll("GlassBreak0" + Random.Range(1, 4).ToString(), bulletHitTarget, 1f);

            data.WindowDmgType = "broken";
            data.ResetDamage();
        }
    }
Пример #3
0
    public static PlaySoundMessage SendToAll(string sndName, Vector3 pos, float pitch,
                                             bool polyphonic  = false,
                                             bool shakeGround = false, byte shakeIntensity = 64, int shakeRange = 30, GameObject sourceObj = null)
    {
        var netId = NetId.Empty;

        if (sourceObj != null)
        {
            var netB = sourceObj.GetComponent <NetworkBehaviour>();
            if (netB != null)
            {
                netId = netB.netId;
            }
        }

        PlaySoundMessage msg = new PlaySoundMessage
        {
            SoundName      = sndName,
            Position       = pos,
            Pitch          = pitch,
            ShakeGround    = shakeGround,
            ShakeIntensity = shakeIntensity,
            ShakeRange     = shakeRange,
            Polyphonic     = polyphonic,
            TargetNetId    = netId
        };

        msg.SendToAll();

        return(msg);
    }
Пример #4
0
    //Only works serverside:
    public void DoMeleeDamage(Vector2 dmgPosition, GameObject originator, int dmgAmt)
    {
        var cellPos = tileChangeManager.baseTileMap.WorldToCell(dmgPosition);
        var data    = metaDataLayer.Get(cellPos);

        if (Layer.LayerType == LayerType.Windows)
        {
            var getTile = tileChangeManager.windowTileMap.GetTile(cellPos);
            if (getTile != null)
            {
                PlaySoundMessage.SendToAll("GlassHit", dmgPosition, Random.Range(0.9f, 1.1f));
                AddWindowDamage(dmgAmt, data, cellPos, dmgPosition);
                return;
            }
        }

        if (Layer.LayerType == LayerType.Grills)
        {
            var getWindowTile = tileChangeManager.windowTileMap.GetTile(cellPos);

            //Make sure a window is not protecting it first:
            if (!getWindowTile)
            {
                var getGrillTile = tileChangeManager.grillTileMap.GetTile(cellPos);
                if (getGrillTile != null)
                {
                    PlaySoundMessage.SendToAll("GrillHit", dmgPosition, Random.Range(0.9f, 1.1f));
                    AddGrillDamage(dmgAmt, data, cellPos, dmgPosition);
                }
            }
        }
    }
Пример #5
0
    protected virtual void OnHit(Vector3Int pos, ThrowInfo info, List <LivingHealthBehaviour> objects, List <TilemapDamage> tiles)
    {
        if (!ItemAttributes)
        {
            Logger.LogWarningFormat("{0}: Tried to hit stuff at pos {1} but have no ItemAttributes.", Category.Throwing, gameObject.name, pos);
            return;
        }
        //Hurting tiles
        for (var i = 0; i < tiles.Count; i++)
        {
            var tileDmg = tiles[i];
            var damage  = ( int )(ItemAttributes.throwDamage * 2);
            tileDmg.DoThrowDamage(pos, info, damage);
        }

        //Hurting objects
        if (objects != null && objects.Count > 0 && !Equals(info, ThrowInfo.NoThrow))
        {
            for (var i = 0; i < objects.Count; i++)
            {
                //Remove cast to int when moving health values to float
                var damage  = (int)(ItemAttributes.throwDamage * 2);
                var hitZone = info.Aim.Randomize();
                objects[i].ApplyDamage(info.ThrownBy, damage, DamageType.Brute, hitZone);
                PostToChatMessage.SendThrowHitMessage(gameObject, objects[i].gameObject, damage, hitZone);
            }
            //hit sound
            PlaySoundMessage.SendToAll("GenericHit", transform.position, 1f);
        }
        else
        {
            //todo different sound for no-damage hit?
            PlaySoundMessage.SendToAll("GenericHit", transform.position, 0.8f);
        }
    }
Пример #6
0
 public void PlayAdditionalSound()
 {
     if (!string.IsNullOrEmpty(additionalSfx))
     {
         PlaySoundMessage.SendToAll(additionalSfx, position, additionalSfxPitch);
     }
 }
Пример #7
0
    /// <summary>
    /// Play sound for all clients.
    /// If more than one sound is specified, one will be picked at random.
    /// </summary>
    /// <param name="addressableAudioSources">List of sounds to be played.  If more than one sound is specified, one will be picked at random</param>
    public static async Task PlayNetworked(List <AddressableAudioSource> addressableAudioSources, float pitch = -1,
                                           bool polyphonic  = false,
                                           bool shakeGround = false, byte shakeIntensity = 64, int shakeRange = 30)
    {
        ShakeParameters shakeParameters = null;

        if (shakeGround == true)
        {
            shakeParameters = new ShakeParameters
            {
                ShakeGround    = shakeGround,
                ShakeIntensity = shakeIntensity,
                ShakeRange     = shakeRange
            };
        }

        AudioSourceParameters audioSourceParameters = null;

        if (pitch > 0)
        {
            audioSourceParameters = new AudioSourceParameters
            {
                Pitch = pitch
            };
        }

        AddressableAudioSource addressableAudioSource = await GetAddressableAudioSourceFromCache(addressableAudioSources);

        PlaySoundMessage.SendToAll(addressableAudioSource, TransformState.HiddenPos, polyphonic, null, shakeParameters, audioSourceParameters);
    }
Пример #8
0
    //Server only
    public void ProcessDeconstructRequest(GameObject player, GameObject matrixRoot, TileType tileType,
                                          Vector3 cellPos, Vector3 worldCellPos)
    {
        if (Vector3.Distance(player.transform.position, worldCellPos) > 1.5f)
        {
            //Not in range on the server, do not process any further:
            return;
        }
        //Process Wall deconstruct request:
        if (tileType == TileType.Wall)
        {
            //Set up the action to be invoked when progress bar finishes:
            var progressFinishAction = new FinishProgressAction(
                FinishProgressAction.Action.TileDeconstruction,
                matrixRoot.GetComponent <TileChangeManager>(),
                tileType,
                cellPos,
                worldCellPos,
                player
                );

            //Start the progress bar:
            UIManager.ProgressBar.StartProgress(Vector3Int.RoundToInt(worldCellPos),
                                                10f, progressFinishAction, player, "Weld", 0.8f);

            PlaySoundMessage.SendToAll("Weld", worldCellPos, Random.Range(0.9f, 1.1f));
        }
    }
Пример #9
0
 /// <summary>
 /// Serverside: Play sound at given position for all clients.
 /// Accepts "#" wildcards for sound variations. (Example: "Punch#")
 /// </summary>
 public static void PlayNetworkedAtPos(string sndName, Vector3 pos, float pitch = -1,
                                       bool polyphonic  = false,
                                       bool shakeGround = false, byte shakeIntensity = 64, int shakeRange = 30)
 {
     sndName = Instance.ResolveSoundPattern(sndName);
     PlaySoundMessage.SendToAll(sndName, pos, pitch, polyphonic, shakeGround, shakeIntensity, shakeRange);
 }
Пример #10
0
    /// <summary>
    /// Serverside: Play sound for all clients.
    /// Accepts "#" wildcards for sound variations. (Example: "Punch#")
    /// </summary>
    public static void PlayNetworked(string sndName, float pitch = -1,
                                     bool polyphonic             = false,
                                     bool shakeGround            = false, byte shakeIntensity = 64, int shakeRange = 30)
    {
        ShakeParameters shakeParameters = null;

        if (shakeGround == true)
        {
            shakeParameters = new ShakeParameters
            {
                ShakeGround    = shakeGround,
                ShakeIntensity = shakeIntensity,
                ShakeRange     = shakeRange
            };
        }

        AudioSourceParameters audioSourceParameters = null;

        if (pitch > 0)
        {
            audioSourceParameters = new AudioSourceParameters
            {
                Pitch = pitch
            };
        }

        sndName = Instance.ResolveSoundPattern(sndName);
        PlaySoundMessage.SendToAll(sndName, TransformState.HiddenPos, polyphonic, null, shakeParameters, audioSourceParameters);
    }
Пример #11
0
    //Only works server side:
    public void WireCutGrill(Vector3 snipPosition)
    {
        var cellPos = tileChangeManager.baseTileMap.WorldToCell(snipPosition);
        var data    = metaDataLayer.Get(cellPos);

        if (Layer.LayerType == LayerType.Grills)
        {
            var getWindowTile = tileChangeManager.windowTileMap.GetTile(cellPos);

            //Make sure a window is not protecting it first:
            if (!getWindowTile)
            {
                var getGrillTile = tileChangeManager.grillTileMap.GetTile(cellPos);
                if (getGrillTile != null)
                {
                    tileChangeManager.RemoveTile(cellPos, TileChangeLayer.Grill);

                    PlaySoundMessage.SendToAll("WireCutter", snipPosition, 1f);
                    SpawnRods(snipPosition);
                }
            }
        }

        data.ResetDamage();
    }
Пример #12
0
    /// <summary>
    /// Serverside: Play sound at given position for all clients.
    /// </summary>
    /// <param name="addressableAudioSource">The sound to be played.</param>
    /// <param name="worldPos">The position at which the sound is played</param>
    /// <param name="audioSourceParameters">Extra parameters of the audio source.</param>
    /// <param name="polyphonic">Is the sound to be played polyphonic</param>
    /// <param name="global">Does everyone will receive the sound our just nearby players</param>
    /// <param name="shakeParameters">Camera shake effect associated with this sound</param>
    /// <param name="sourceObj">The object that is the source of the sound</param>
    /// <returns>The SoundSpawn Token generated that identifies the same sound spawn instance across server and clients</returns>
    public static async Task <string> PlayNetworkedAtPosAsync(AddressableAudioSource addressableAudioSource, Vector3 worldPos,
                                                              AudioSourceParameters audioSourceParameters = new AudioSourceParameters(), bool polyphonic = false, bool global = true,
                                                              ShakeParameters shakeParameters             = new ShakeParameters(), GameObject sourceObj = null)
    {
        if (addressableAudioSource == null || string.IsNullOrEmpty(addressableAudioSource.AssetAddress) ||
            addressableAudioSource.AssetAddress == "null")
        {
            Logger.LogWarning($"SoundManager received a null AudioSource to be played at World Position: {worldPos}",
                              Category.Audio);
            return(null);
        }

        addressableAudioSource = await AudioManager.GetAddressableAudioSourceFromCache(addressableAudioSource);

        if (global)
        {
            return(PlaySoundMessage.SendToAll(addressableAudioSource, worldPos, polyphonic, sourceObj, shakeParameters,
                                              audioSourceParameters));
        }
        else
        {
            return(PlaySoundMessage.SendToNearbyPlayers(addressableAudioSource, worldPos, polyphonic, sourceObj,
                                                        shakeParameters, audioSourceParameters));
        }
    }
Пример #13
0
    /// <summary>
    /// Plays a sound for all clients.
    /// </summary>
    /// <param name="addressableAudioSource">The sound to be played.</param>
    /// <param name="audioSourceParameters">Extra parameters of the audio source</param>
    /// <param name="polyphonic">Is the sound to be played polyphonic</param>
    /// <param name="shakeParameters">Extra parameters that define the sound's associated shake</param>
    public static async Task PlayNetworked(AddressableAudioSource addressableAudioSource,
                                           AudioSourceParameters audioSourceParameters = new AudioSourceParameters(), bool polyphonic = false,
                                           ShakeParameters shakeParameters             = new ShakeParameters())
    {
        addressableAudioSource = await GetAddressableAudioSourceFromCache(addressableAudioSource);

        PlaySoundMessage.SendToAll(addressableAudioSource, TransformState.HiddenPos, polyphonic, null, shakeParameters, audioSourceParameters);
    }
Пример #14
0
 /// <summary>
 /// Plays music for all clients.
 /// </summary>
 /// <param name="addressableAudioSource">The sound to be played.</param>
 /// <param name="audioSourceParameters">Extra parameters of the audio source</param>
 /// <param name="polyphonic">Is the sound to be played polyphonic</param>
 /// <param name="shakeParameters">Extra parameters that define the sound's associated shake</param>
 public static void PlayNetworked(AddressableAudioSource addressableAudioSource,
                                  AudioSourceParameters audioSourceParameters = new AudioSourceParameters(), bool polyphonic = false,
                                  ShakeParameters shakeParameters             = new ShakeParameters())
 {
     if (Instance.currentNetworkedSong != "")
     {
         StopNetworked(Instance.currentNetworkedSong);
     }
     audioSourceParameters.MixerType = MixerType.Music;
     Instance.currentNetworkedSong   = PlaySoundMessage.SendToAll(addressableAudioSource, TransformState.HiddenPos, polyphonic, null, shakeParameters, audioSourceParameters);
 }
Пример #15
0
    /// <summary>
    /// Text should be no less than 10 chars
    /// </summary>
    public static void MakeShuttleCallAnnouncement(string minutes, string text)
    {
        if (text.Trim() == string.Empty || text.Trim().Length < 10)
        {
            return;
        }

        Chat.AddSystemMsgToChat(string.Format(PriorityAnnouncementTemplate, string.Format(ShuttleCallSubTemplate, minutes, text)),
                                MatrixManager.MainStationMatrix);
        PlaySoundMessage.SendToAll("ShuttleCalled", Vector3.zero, 1f);
    }
Пример #16
0
 /// <summary>
 /// Serverside: Play sound at given position for all clients.
 /// Accepts "#" wildcards for sound variations. (Example: "Punch#")
 /// </summary>
 /// <param name="sndName">The name of the sound to be played</param>
 /// <param name="worldPos">The position at which the sound is played</param>
 /// <param name="polyphonic">Is the sound to be played polyphonic</param>
 /// <param name="audioSourceParameters">Extra parameters of the audio source.</param>
 /// <param name="Global">Does everyone will receive the sound our just nearby players</param>
 /// <param name="sourceObj">The object that is the source of the sound</param>
 /// <param name="shakeParameters">Camera shake effect associated with this sound</param>
 public static void PlayNetworkedAtPos(string sndName, Vector3 worldPos, AudioSourceParameters audioSourceParameters, bool polyphonic = false, bool Global = true, GameObject sourceObj = null, ShakeParameters shakeParameters = null)
 {
     sndName = Instance.ResolveSoundPattern(sndName);
     if (Global)
     {
         PlaySoundMessage.SendToAll(sndName, worldPos, polyphonic, sourceObj, shakeParameters, audioSourceParameters);
     }
     else
     {
         PlaySoundMessage.SendToNearbyPlayers(sndName, worldPos, polyphonic, sourceObj, shakeParameters, audioSourceParameters);
     }
 }
Пример #17
0
    public static PlaySoundMessage SendToAll(string sndName, Vector3 pos, float pitch)
    {
        PlaySoundMessage msg = new PlaySoundMessage {
            SoundName = sndName,
            Position  = pos,
            Pitch     = pitch
        };

        msg.SendToAll();

        return(msg);
    }
Пример #18
0
    //Serverside only
    public void OnTriggerEnter2D(Collider2D coll)
    {
        if (!isServer)
        {
            return;
        }

        //8 = Players layer
        if (coll.gameObject.layer == 8)
        {
            PlaySoundMessage.SendToAll("GlassStep", coll.transform.position, Random.Range(0.8f, 1.2f));
        }
    }
Пример #19
0
 /// <summary>
 /// Serverside: Play sound at given position for all clients.
 /// Accepts "#" wildcards for sound variations. (Example: "Punch#")
 /// </summary>
 public static void PlayNetworkedAtPos(string sndName, Vector3 worldPos, float pitch = -1,
                                       bool polyphonic  = false,
                                       bool shakeGround = false, byte shakeIntensity = 64, int shakeRange = 30, bool Global = true)
 {
     sndName = Instance.ResolveSoundPattern(sndName);
     if (Global)
     {
         PlaySoundMessage.SendToAll(sndName, worldPos, pitch, polyphonic, shakeGround, shakeIntensity, shakeRange);
     }
     else
     {
         PlaySoundMessage.SendToNearbyPlayers(sndName, worldPos, pitch, polyphonic, shakeGround, shakeIntensity, shakeRange);
     }
 }
Пример #20
0
    /// <summary>
    /// Serverside: Play sound at given position for all clients.
    /// If more than one sound is specified, the sound will be chosen at random
    /// </summary>
    /// <param name="addressableAudioSources">The sound to be played.  If more than one is specified, a single one will be picked at random</param>
    /// <param name="worldPos">The position at which the sound is played</param>
    /// <param name="polyphonic">Is the sound to be played polyphonic</param>
    /// <param name="audioSourceParameters">Extra parameters of the audio source.</param>
    /// <param name="Global">Does everyone will receive the sound our just nearby players</param>
    /// <param name="sourceObj">The object that is the source of the sound</param>
    /// <param name="shakeParameters">Camera shake effect associated with this sound</param>
    /// <returns>The SoundSpawn Token generated that identifies the same sound spawn instance across server and clients</returns>
    public static async Task <string> PlayNetworkedAtPos(List <AddressableAudioSource> addressableAudioSources, Vector3 worldPos, AudioSourceParameters audioSourceParameters,
                                                         bool polyphonic = false, bool Global = true, GameObject sourceObj = null, ShakeParameters shakeParameters = null)
    {
        AddressableAudioSource addressableAudioSource = await GetAddressableAudioSourceFromCache(addressableAudioSources);

        if (Global)
        {
            return(PlaySoundMessage.SendToAll(addressableAudioSource, worldPos, polyphonic, sourceObj, shakeParameters, audioSourceParameters));
        }
        else
        {
            return(PlaySoundMessage.SendToNearbyPlayers(addressableAudioSource, worldPos, polyphonic, sourceObj, shakeParameters, audioSourceParameters));
        }
    }
Пример #21
0
    private bool ValidateFloating(Vector3 origin, Vector3 goal)
    {
//		Logger.Log( $"{gameObject.name} check {origin}->{goal}. Speed={serverState.Speed}" );
        Vector3Int             intOrigin = Vector3Int.RoundToInt(origin);
        Vector3Int             intGoal   = Vector3Int.RoundToInt(goal);
        var                    info      = serverState.ActiveThrow;
        List <HealthBehaviour> hitDamageables;

        if (CanDriftTo(intOrigin, intGoal) & !HittingSomething(intGoal, info.ThrownBy, out hitDamageables))
        {
            //if object is solid, check if player is nearby to make it stop
            return(registerTile.IsPassable() ? true : !IsPlayerNearby(serverState));
        }
        else
        {
            //Can't drift to goal for some reason:
            //Check Tile damage from throw
            var hit2D = Physics2D.RaycastAll(origin, info.Trajectory.normalized, 1.5f, tileDmgMask);

            for (int i = 0; i < hit2D.Length; i++)
            {
                //Debug.Log("THROW HIT: " + hit2D[i].collider.gameObject.name);

                //TilemapDamage automatically detects if a layer is below another damageable layer and won't affect it
                var tileDmg = hit2D[i].collider.gameObject.GetComponent <TilemapDamage>();
                if (tileDmg != null)
                {
                    var damage = ( int )(ItemAttributes.throwDamage * 2);
                    tileDmg.DoThrowDamage(intGoal, info, damage);
                }
            }
        }

        //Hurting what we can
        if (hitDamageables != null && hitDamageables.Count > 0 && !Equals(info, ThrowInfo.NoThrow))
        {
            for (var i = 0; i < hitDamageables.Count; i++)
            {
                //Remove cast to int when moving health values to float
                var damage = ( int )(ItemAttributes.throwDamage * 2);
                hitDamageables[i].ApplyDamage(info.ThrownBy, damage, DamageType.BRUTE, info.Aim);
                PostToChatMessage.SendThrowHitMessage(gameObject, hitDamageables[i].gameObject, damage, info.Aim);
            }
            //hit sound
            PlaySoundMessage.SendToAll("GenericHit", transform.position, 1f);
        }

        return(false);
    }
Пример #22
0
    private void SpawnGlassShards(Vector3 pos)
    {
        //Spawn 3 glass shards with different sprites:
        PoolManager.Instance.PoolNetworkInstantiate(glassShardPrefab, Vector3Int.RoundToInt(pos),
                                                    Quaternion.identity, tileChangeManager.ObjectParent.transform).GetComponent <GlassShard>().SetSpriteAndScatter(0);

        PoolManager.Instance.PoolNetworkInstantiate(glassShardPrefab, Vector3Int.RoundToInt(pos),
                                                    Quaternion.identity, tileChangeManager.ObjectParent.transform).GetComponent <GlassShard>().SetSpriteAndScatter(1);

        PoolManager.Instance.PoolNetworkInstantiate(glassShardPrefab, Vector3Int.RoundToInt(pos),
                                                    Quaternion.identity, tileChangeManager.ObjectParent.transform).GetComponent <GlassShard>().SetSpriteAndScatter(2);

        //Play the breaking window sfx:
        PlaySoundMessage.SendToAll("GlassBreak0" + Random.Range(1, 4).ToString(), pos, 1f);
    }
Пример #23
0
    private void DoWallDeconstruction(Vector3Int cellPos, TileChangeManager tcm, Vector3 worldPos)
    {
        tcm.RemoveTile(cellPos, TileChangeLayer.Wall);
        PlaySoundMessage.SendToAll("Deconstruct", worldPos, 1f);

        //Spawn 4 metal sheets:
        int spawnMetalsAmt = 0;

        while (spawnMetalsAmt < 4)
        {
            spawnMetalsAmt++;
            PoolManager.Instance.PoolNetworkInstantiate(metalPrefab, worldPos, Quaternion.identity, tcm.transform);
        }

        //TODO spawn wall girder!
    }
Пример #24
0
    /// <summary>
    /// Calls the end of the round.true Server only
    /// </summary>
    public void RoundEnd()
    {
        if (CustomNetworkManager.Instance._isServer)
        {
            counting = false;

            // Prevents annoying sound duplicate when testing
            if (SystemInfo.graphicsDeviceType != GraphicsDeviceType.Null && !GameData.Instance.testServer)
            {
                PlaySoundMessage.SendToAll("ApcDestroyed", Vector3.zero, 1f);
            }

            waitForRestart = true;
            PlayerList.Instance.ReportScores();
        }
    }
Пример #25
0
    public static PlaySoundMessage SendToAll(string sndName, Vector3 pos, float pitch,
                                             bool shakeGround = false, byte shakeIntensity = 64, int shakeRange = 30)
    {
        PlaySoundMessage msg = new PlaySoundMessage
        {
            SoundName      = sndName,
            Position       = pos,
            Pitch          = pitch,
            ShakeGround    = shakeGround,
            ShakeIntensity = shakeIntensity,
            ShakeRange     = shakeRange
        };

        msg.SendToAll();

        return(msg);
    }
Пример #26
0
    private void AddGrillDamage(int damage, MetaDataNode data, Vector3Int cellPos, Vector3 bulletHitTarget)
    {
        data.Damage += damage;

        //Make grills a little bit weaker (set to 60 hp):
        if (data.Damage >= 60)
        {
            tileChangeManager.RemoveTile(cellPos, LayerType.Grills);
            tileChangeManager.UpdateTile(cellPos, TileType.WindowDamaged, "GrillDestroyed");

            PlaySoundMessage.SendToAll("GrillHit", bulletHitTarget, 1f);

            //Spawn rods:
            SpawnRods(bulletHitTarget);

            data.ResetDamage();
        }
    }
Пример #27
0
    private void AddGrillDamage(int damage, MetaDataNode data, Vector3Int cellPos, Vector3 bulletHitTarget)
    {
        data.AddDamage(damage);

        //Make grills a little bit weaker (set to 60 hp):
        if (data.GetDamage >= 60)
        {
            tileChangeManager.RemoveTile(cellPos, TileChangeLayer.Grill);
            tileChangeManager.ChangeTile("GrillDestroyed", cellPos, TileChangeLayer.BrokenGrill);

            PlaySoundMessage.SendToAll("GrillHit", bulletHitTarget, 1f);

            //Spawn rods:
            SpawnRods(bulletHitTarget);

            data.ResetDamage();
        }
    }
Пример #28
0
    private void SendReportToStation()
    {
        var commConsoles = FindObjectsOfType <CommConsole>();

        foreach (CommConsole console in commConsoles)
        {
            var p     = ItemFactory.SpawnItem(ItemFactory.Instance.paper, console.transform.position, console.transform.parent);
            var paper = p.GetComponent <Paper>();
            paper.SetServerString(CreateStartGameReport());
        }

        ChatEvent announcement = new ChatEvent {
            channels = ChatChannel.System,
            message  = CommandUpdateAnnouncementString()
        };

        ChatRelay.Instance.AddToChatLogServer(announcement);

        PlaySoundMessage.SendToAll("Notice1", Vector3.zero, 1f);
        PlaySoundMessage.SendToAll("InterceptMessage", Vector3.zero, 1f);
    }
Пример #29
0
    //Only works server side:
    public void WireCutGrill(Vector3 snipPosition)
    {
        Vector3Int   cellPos = metaTileMap.WorldToCell(snipPosition);
        MetaDataNode data    = metaDataLayer.Get(cellPos);

        if (Layer.LayerType == LayerType.Grills)
        {
            //Make sure a window is not protecting it first:
            if (!metaTileMap.HasTile(cellPos, LayerType.Windows))
            {
                if (metaTileMap.HasTile(cellPos, LayerType.Grills))
                {
                    tileChangeManager.RemoveTile(cellPos, LayerType.Grills);

                    PlaySoundMessage.SendToAll("WireCutter", snipPosition, 1f);
                    SpawnRods(snipPosition);
                }
            }
        }

        data.ResetDamage();
    }
Пример #30
0
 /// <summary>
 /// Plays a sound for all clients.
 /// </summary>
 /// <param name="addressableAudioSource">The sound to be played.</param>
 /// <param name="audioSourceParameters">Extra parameters of the audio source</param>
 /// <param name="polyphonic">Is the sound to be played polyphonic</param>
 /// <param name="shakeParameters">Extra parameters that define the sound's associated shake</param>
 public static string PlayNetworked(AddressableAudioSource addressableAudioSource,
                                    AudioSourceParameters audioSourceParameters = new AudioSourceParameters(), bool polyphonic = false,
                                    ShakeParameters shakeParameters             = new ShakeParameters())
 {
     return(PlaySoundMessage.SendToAll(addressableAudioSource, TransformState.HiddenPos, polyphonic, null, shakeParameters, audioSourceParameters));
 }