Beispiel #1
0
    private void Client_OnKilledShared(bool killedBy, Character attacker, ref uLink.NetworkMessageInfo info)
    {
        Controllable   controllable;
        bool           flag;
        AudioClipArray trait = base.GetTrait <CharacterSoundsTrait>().death;
        AudioClip      item  = trait[UnityEngine.Random.Range(0, trait.Length)];

        item.Play(base.transform.position, 1f, 1f, 10f);
        bool flag1 = base.localControlled;

        if (flag1)
        {
            base.rposLimitFlags = RPOSLimitFlags.KeepOff | RPOSLimitFlags.HideInventory | RPOSLimitFlags.HideContext | RPOSLimitFlags.HideSprites;
            DeathScreen.Show();
        }
        BaseHitBox remote = base.idMain.GetRemote <BaseHitBox>();

        if (remote)
        {
            remote.collider.enabled = false;
        }
        if (!killedBy || !attacker)
        {
            controllable = null;
            flag         = false;
        }
        else
        {
            controllable = attacker.controllable;
            flag         = (!controllable ? false : controllable.localPlayerControlled);
        }
        base.AdjustClientSideHealth(0f);
        if (flag1 || flag)
        {
            InterpTimedEvent.Queue(this, "ClientLocalDeath", ref info);
            if (!flag1)
            {
                InterpTimedEvent.Remove(this, true);
            }
            else
            {
                InterpTimedEvent.Clear(true);
            }
        }
        else
        {
            Collider[] componentsInChildren = base.GetComponentsInChildren <Collider>();
            for (int i = 0; i < (int)componentsInChildren.Length; i++)
            {
                Collider collider = componentsInChildren[i];
                if (collider)
                {
                    collider.enabled = false;
                }
            }
            InterpTimedEvent.Queue(this, "RAG", ref info);
            NetCull.DontDestroyWithNetwork(this);
        }
    }
Beispiel #2
0
        public SoundEffectData()
        {
            Map = new SoundEffectDict();

            foreach (var type in Utility.GetEnumValues <SoundEffect>())
            {
                Map[type] = new AudioClipArray();
            }
        }
Beispiel #3
0
    private void Client_OnKilledShared(bool killedBy, Character attacker, ref NetworkMessageInfo info)
    {
        Controllable   controllable;
        bool           flag2;
        AudioClipArray death = base.GetTrait <CharacterSoundsTrait>().death;

        death[Random.Range(0, death.Length)].Play(base.transform.position, (float)1f, (float)1f, (float)10f);
        bool localControlled = base.localControlled;

        if (localControlled)
        {
            base.rposLimitFlags = RPOSLimitFlags.HideSprites | RPOSLimitFlags.HideContext | RPOSLimitFlags.HideInventory | RPOSLimitFlags.KeepOff;
            DeathScreen.Show();
        }
        BaseHitBox remote = base.idMain.GetRemote <BaseHitBox>();

        if (remote != null)
        {
            remote.collider.enabled = false;
        }
        if (killedBy && (attacker != null))
        {
            controllable = attacker.controllable;
            flag2        = (controllable != null) && controllable.localPlayerControlled;
        }
        else
        {
            controllable = null;
            flag2        = false;
        }
        base.AdjustClientSideHealth(0f);
        if (!localControlled && !flag2)
        {
            foreach (Collider collider in base.GetComponentsInChildren <Collider>())
            {
                if (collider != null)
                {
                    collider.enabled = false;
                }
            }
            InterpTimedEvent.Queue(this, "RAG", ref info);
            NetCull.DontDestroyWithNetwork((MonoBehaviour)this);
        }
        else
        {
            InterpTimedEvent.Queue(this, "ClientLocalDeath", ref info);
            if (localControlled)
            {
                InterpTimedEvent.Clear(true);
            }
            else
            {
                InterpTimedEvent.Remove(this, true);
            }
        }
    }
Beispiel #4
0
    void OnSceneChange(Scene scene, LoadSceneMode mode)
    {
        sceneChangeComplete = false;
        if (sceneClipArray != null)
        {
            foreach (Clip s in sceneClips)
            {
                Destroy(s.source);
            }
        }
        string clipName = "Scene" + scene.buildIndex.ToString() + "Audio";

        sceneClipArray = Resources.Load <AudioClipArray>("Scriptable Object/" + clipName);
        if (sceneClipArray != null)
        {
            sceneClips.Clear();
            sceneClipArray.Initialize();
            foreach (Sound s in sceneClipArray.sounds)
            {
                Clip newClip = new Clip();
                newClip.name                     = s.name;
                newClip.hash                     = s.hashCode;
                newClip.isFX                     = s.isFX;
                newClip.volume                   = s.volume;
                newClip.source                   = gameObject.AddComponent <AudioSource>();
                newClip.source.clip              = s.clip;
                newClip.source.volume            = s.volume;
                newClip.source.pitch             = s.pitch;
                newClip.source.loop              = s.loop;
                newClip.source.spatialBlend      = s.blend;
                newClip.source.bypassEffects     = true;
                newClip.source.bypassReverbZones = true;
                sceneClips.Add(newClip);
            }
            foreach (Clip clip in sceneClips)
            {
                clip.source.Play();
            }
        }
        sceneChangeComplete = true;
    }
Beispiel #5
0
 public void SetClips(AudioClipArray clips)
 {
     this.clips = clips;
 }