示例#1
0
    public void Local_HealthChange(float amount, uLink.NetworkViewID attackerID, uLink.NetworkMessageInfo info)
    {
        GameObject gameObject;

        object[] objArray;
        bool     flag;

        if (attackerID != uLink.NetworkViewID.unassigned)
        {
            uLink.NetworkView networkView  = uLink.NetworkView.Find(attackerID);
            uLink.NetworkView networkView1 = networkView;
            if (!networkView)
            {
                gameObject = null;
                objArray   = new object[] { amount, gameObject };
                flag       = InterpTimedEvent.Queue(this, "DMG", ref info, objArray);
                return;
            }
            gameObject = networkView1.gameObject;
            objArray   = new object[] { amount, gameObject };
            flag       = InterpTimedEvent.Queue(this, "DMG", ref info, objArray);
            return;
        }
        gameObject = null;
        objArray   = new object[] { amount, gameObject };
        flag       = InterpTimedEvent.Queue(this, "DMG", ref info, objArray);
    }
示例#2
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);
        }
    }
示例#3
0
 protected void RODone(uLink.NetworkMessageInfo info)
 {
     if (!this.__done)
     {
         NetCull.DontDestroyWithNetwork(this);
         InterpTimedEvent.Queue(this, "_done", ref info);
     }
 }
示例#4
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);
            }
        }
    }
示例#5
0
 protected void InterpDestroy(uLink.NetworkMessageInfo info)
 {
     if ((base.networkView != null) && base.networkView.isMine)
     {
         InterpTimedEvent.Remove(this, true);
     }
     else
     {
         InterpTimedEvent.Queue(this, "InterpDestroy", ref info);
         NetCull.DontDestroyWithNetwork((Facepunch.MonoBehaviour) this);
     }
 }
示例#6
0
 protected void InterpDestroy(uLink.NetworkMessageInfo info)
 {
     if (!base.networkView || !base.networkView.isMine)
     {
         InterpTimedEvent.Queue(this, "InterpDestroy", ref info);
         NetCull.DontDestroyWithNetwork(this);
     }
     else
     {
         InterpTimedEvent.Remove(this, true);
     }
 }
示例#7
0
 protected void Snd(byte type, uLink.NetworkMessageInfo info)
 {
     try
     {
         InterpTimedEvent.Queue(this, "SOUND", ref info, new object[] { (int)type });
     }
     catch (Exception exception)
     {
         Debug.LogException(exception);
         Debug.LogWarning("Running emergency dump because of previous exception in Snd", this);
         InterpTimedEvent.EMERGENCY_DUMP(true);
     }
 }
示例#8
0
    protected void OnClientDeath(ref Vector3 deathPosition, uLink.NetworkViewID attackerNetViewID, ref uLink.NetworkMessageInfo info)
    {
        Vector3 vector;
        Vector3 vector2;

        TransformHelpers.GetGroundInfo(deathPosition + new Vector3(0f, 0.25f, 0f), 10f, out vector, out vector2);
        deathPosition = vector;
        Quaternion rot = TransformHelpers.LookRotationForcedUp((Vector3)(this._myTransform.rotation * Vector3.forward), vector2);

        this._interp.SetGoals(deathPosition, rot, info.timestamp);
        if (attackerNetViewID.isMine)
        {
            this.DoClientDeath();
        }
        else
        {
            InterpTimedEvent.Queue(this, "DEATH", ref info);
        }
    }
示例#9
0
    protected void uLink_OnNetworkInstantiate(uLink.NetworkMessageInfo info)
    {
        PosRot posRot = new PosRot();

        this.view = (Facepunch.NetworkView)info.networkView;
        uLink.BitStream bitStream = this.view.initialData;
        if (this.expectsInitialVelocity)
        {
            this.initialVelocity = bitStream.ReadVector3();
        }
        if (this.expectsOwner)
        {
            this.ownerViewID = bitStream.ReadNetworkViewID();
        }
        this.spawnTime      = info.timestamp;
        this.updateInterval = 1 / ((double)NetCull.sendRate * (double)Mathf.Max(1f, this.updateRate));
        this.hasInterp      = this._interp;
        if (this.hasInterp)
        {
            this._interp.running = false;
        }
        this.rigidbody.isKinematic = true;
        this.__hiding = this.spawnTime > Interpolation.time;
        if (!this.__hiding)
        {
            this.OnShow();
        }
        else
        {
            this.OnHide();
            if (this.hasInterp)
            {
                posRot.position = this.view.position;
                posRot.rotation = this.view.rotation;
                this._interp.SetGoals(posRot, this.spawnTime);
            }
            InterpTimedEvent.Queue(this, "_init", ref info);
        }
    }
示例#10
0
 public void CL_Attack(NetworkMessageInfo info)
 {
     InterpTimedEvent.Queue(this, "ATK", ref info);
 }
示例#11
0
 protected void Action1(uLink.BitStream stream, uLink.NetworkMessageInfo info)
 {
     object[] args = new object[] { stream };
     InterpTimedEvent.Queue(this, "Action1", ref info, args);
 }
示例#12
0
 private void ClientBounce(NetworkMessageInfo info)
 {
     InterpTimedEvent.Queue(this, "bounce", ref info);
 }
示例#13
0
 public void Landed(uLink.NetworkMessageInfo info)
 {
     InterpTimedEvent.Queue(this, "LAND", ref info);
 }
示例#14
0
 protected void Action3(uLink.BitStream stream, uLink.NetworkMessageInfo info)
 {
     InterpTimedEvent.Queue(this, "Action3", ref info, new object[] { stream });
 }