public override void DoAction1(uLink.BitStream stream, ItemRepresentation rep, ref uLink.NetworkMessageInfo info)
    {
        GameObject       gameObject;
        NetEntityID      netEntityID;
        IDRemoteBodyPart dRemoteBodyPart;
        bool             flag;
        bool             flag1;
        bool             flag2;
        BodyPart         bodyPart;
        Vector3          vector3;
        Vector3          vector31;
        Transform        transforms;
        Component        componentInChildren;
        bool             flag3;

        this.ReadHitInfo(stream, out gameObject, out flag, out flag1, out bodyPart, out dRemoteBodyPart, out netEntityID, out transforms, out vector3, out vector31, out flag2);
        if (flag2)
        {
            this.headshotSound.Play(gameObject.transform.position, 1f, 4f, 30f);
        }
        Transform transforms1 = rep.transform.parent;
        Vector3   vector32    = rep.muzzle.position;
        Vector3   vector33    = vector3;

        Socket.LocalSpace localSpace = rep.muzzle;
        if (dRemoteBodyPart)
        {
            componentInChildren = dRemoteBodyPart;
        }
        else if (!gameObject)
        {
            componentInChildren = null;
        }
        else
        {
            componentInChildren = gameObject.GetComponentInChildren <CapsuleCollider>();
        }
        if (!flag)
        {
            flag3 = false;
        }
        else
        {
            flag3 = (!dRemoteBodyPart || bodyPart.IsDefined() ? true : gameObject.GetComponent <TakeDamage>() != null);
        }
        this.DoWeaponEffects(transforms1, vector32, vector33, localSpace, false, componentInChildren, flag3, rep);
    }
Exemple #2
0
    protected bool CheckParent()
    {
        Vector3    vector3;
        Quaternion quaternion;

        if (this._parentView)
        {
            return(true);
        }
        if (this._parentViewID != uLink.NetworkViewID.unassigned)
        {
            this._parentView = Facepunch.NetworkView.Find(this._parentViewID);
            if (this._parentView)
            {
                this._parentMain = null;
                Socket.LocalSpace component = this._parentView.GetComponent <PlayerAnimation>().itemAttachment;
                if (component != null)
                {
                    if (!this.hand.parent || !(this.hand.parent != base.transform))
                    {
                        vector3    = this.hand.offset;
                        quaternion = Quaternion.Euler(this.hand.eulerRotate);
                    }
                    else
                    {
                        vector3 = base.transform.InverseTransformPoint(this.hand.position);
                        Quaternion quaternion1 = this.hand.rotation;
                        Vector3    vector31    = quaternion1 * Vector3.forward;
                        Vector3    vector32    = quaternion1 * Vector3.up;
                        vector31   = base.transform.InverseTransformDirection(vector31);
                        vector32   = base.transform.InverseTransformDirection(vector32);
                        quaternion = Quaternion.LookRotation(vector31, vector32);
                    }
                    component.AddChildWithCoords(base.transform, vector3, quaternion);
                }
                if (base.networkView.isMine)
                {
                    this.worldModels = actor.forceThirdPerson;
                }
                this.FindSignalee();
                return(true);
            }
        }
        this.ClearSignals();
        return(false);
    }
 protected bool CheckParent()
 {
     if (this._parentView != null)
     {
         return(true);
     }
     if (this._parentViewID != NetworkViewID.unassigned)
     {
         this._parentView = NetworkView.Find(this._parentViewID);
         if (this._parentView != null)
         {
             this._parentMain = null;
             Socket.LocalSpace itemAttachment = this._parentView.GetComponent <PlayerAnimation>().itemAttachment;
             if (itemAttachment != null)
             {
                 Vector3    offset;
                 Quaternion quaternion;
                 if ((this.hand.parent != null) && (this.hand.parent != base.transform))
                 {
                     offset = base.transform.InverseTransformPoint(this.hand.position);
                     Quaternion rotation  = this.hand.rotation;
                     Vector3    direction = (Vector3)(rotation * Vector3.forward);
                     Vector3    vector3   = (Vector3)(rotation * Vector3.up);
                     direction  = base.transform.InverseTransformDirection(direction);
                     vector3    = base.transform.InverseTransformDirection(vector3);
                     quaternion = Quaternion.LookRotation(direction, vector3);
                 }
                 else
                 {
                     offset     = this.hand.offset;
                     quaternion = Quaternion.Euler(this.hand.eulerRotate);
                 }
                 itemAttachment.AddChildWithCoords(base.transform, offset, quaternion);
             }
             if (base.networkView.isMine)
             {
                 this.worldModels = actor.forceThirdPerson;
             }
             this.FindSignalee();
             return(true);
         }
     }
     this.ClearSignals();
     return(false);
 }