Example #1
0
    private void Initialize(IDBase self)
    {
        Material material;

        if (self)
        {
            TakeDamage local      = self.GetLocal <TakeDamage>();
            TakeDamage takeDamage = local;
            if (local)
            {
                MeshRenderer[] componentsInChildren = self.GetComponentsInChildren <MeshRenderer>(true);
                MeshRenderer[] meshRendererArray    = componentsInChildren;
                if (!HealthDimmer.GetFirstMaterial <MeshRenderer>(componentsInChildren, out material))
                {
                    this.renderers  = null;
                    this.valid      = false;
                    this.takeDamage = null;
                    return;
                }
                this.renderers      = meshRendererArray;
                this.takeDamage     = takeDamage;
                this.valid          = true;
                this.structureStyle = self.idMain is StructureComponent;
                Color color = material.GetColor(HealthDimmer.PropOnce._Color);
                this.averageRGB = (color.r + color.g + color.b) * 0.333333343f;
                this.propBlock  = new MaterialPropertyBlock();
                this.percent    = null;
                return;
            }
        }
        this.renderers  = null;
        this.valid      = false;
        this.takeDamage = null;
    }
    // Token: 0x06002E81 RID: 11905 RVA: 0x000B2BF4 File Offset: 0x000B0DF4
    private void Initialize(IDBase self)
    {
        global::TakeDamage local;

        MeshRenderer[] componentsInChildren;
        Material       material;

        if (!self || !(local = self.GetLocal <global::TakeDamage>()) || !global::HealthDimmer.GetFirstMaterial <MeshRenderer>(componentsInChildren = self.GetComponentsInChildren <MeshRenderer>(true), out material))
        {
            this.renderers  = null;
            this.valid      = false;
            this.takeDamage = null;
        }
        else
        {
            this.renderers      = componentsInChildren;
            this.takeDamage     = local;
            this.valid          = true;
            this.structureStyle = (self.idMain is global::StructureComponent);
            Color color = material.GetColor(global::HealthDimmer.PropOnce._Color);
            this.averageRGB = (color.r + color.g + color.b) * 0.333333343f;
            this.propBlock  = new MaterialPropertyBlock();
            this.percent    = null;
        }
    }
Example #3
0
    private void Initialize(IDBase self)
    {
        Material material;

        MeshRenderer[] rendererArray;
        TakeDamage     damage;

        if (((self == null) || ((damage = self.GetLocal <TakeDamage>()) == null)) || !GetFirstMaterial <MeshRenderer>(rendererArray = self.GetComponentsInChildren <MeshRenderer>(true), out material))
        {
            this.renderers  = null;
            this.valid      = false;
            this.takeDamage = null;
        }
        else
        {
            this.renderers      = rendererArray;
            this.takeDamage     = damage;
            this.valid          = true;
            this.structureStyle = self.idMain is StructureComponent;
            Color color = material.GetColor(PropOnce._Color);
            this.averageRGB = ((color.r + color.g) + color.b) * 0.3333333f;
            this.propBlock  = new MaterialPropertyBlock();
            this.percent    = null;
        }
    }
    // Token: 0x06003536 RID: 13622 RVA: 0x000C3AF8 File Offset: 0x000C1CF8
    public virtual void Local_SecondaryFire(global::ViewModel vm, global::ItemRepresentation itemRep, global::IMeleeWeaponItem itemInstance, ref global::HumanController.InputSample sample)
    {
        global::Character character = itemInstance.character;

        if (character == null)
        {
            return;
        }
        Ray        eyesRay = character.eyesRay;
        RaycastHit raycastHit;
        bool       flag = Physics.SphereCast(eyesRay, 0.3f, ref raycastHit, this.GetRange(), 406721553);

        if (flag)
        {
            IDBase component = raycastHit.collider.gameObject.GetComponent <IDBase>();
            if (component)
            {
                global::NetEntityID    netEntityID = global::NetEntityID.Get(component);
                global::RepairReceiver local       = component.GetLocal <global::RepairReceiver>();
                if (local != null && netEntityID != global::NetEntityID.unassigned)
                {
                    if (vm)
                    {
                        vm.PlayFireAnimation();
                    }
                    itemInstance.QueueSwingSound(Time.time + this.swingSoundDelay);
                    itemRep.Action <global::NetEntityID>(2, 0, netEntityID);
                }
            }
        }
    }
Example #5
0
    public virtual void Local_SecondaryFire(ViewModel vm, ItemRepresentation itemRep, IMeleeWeaponItem itemInstance, ref HumanController.InputSample sample)
    {
        RaycastHit raycastHit;
        Character  character = itemInstance.character;

        if (character == null)
        {
            return;
        }
        if (Physics.SphereCast(character.eyesRay, 0.3f, out raycastHit, this.GetRange(), 406721553))
        {
            IDBase component = raycastHit.collider.gameObject.GetComponent <IDBase>();
            if (component)
            {
                NetEntityID netEntityID = NetEntityID.Get(component);
                if (component.GetLocal <RepairReceiver>() != null && netEntityID != NetEntityID.unassigned)
                {
                    if (vm)
                    {
                        vm.PlayFireAnimation();
                    }
                    itemInstance.QueueSwingSound(Time.time + this.swingSoundDelay);
                    itemRep.Action <NetEntityID>(2, uLink.RPCMode.Server, netEntityID);
                }
            }
        }
    }
Example #6
0
    public virtual void Local_SecondaryFire(ViewModel vm, ItemRepresentation itemRep, IMeleeWeaponItem itemInstance, ref HumanController.InputSample sample)
    {
        RaycastHit hit;
        Character  character = itemInstance.character;

        if ((character != null) && Physics.SphereCast(character.eyesRay, 0.3f, out hit, this.GetRange(), 0x183e1411))
        {
            IDBase component = hit.collider.gameObject.GetComponent <IDBase>();
            if (component != null)
            {
                NetEntityID argument = NetEntityID.Get((MonoBehaviour)component);
                if ((component.GetLocal <RepairReceiver>() != null) && (argument != NetEntityID.unassigned))
                {
                    if (vm != null)
                    {
                        vm.PlayFireAnimation();
                    }
                    itemInstance.QueueSwingSound(Time.time + this.swingSoundDelay);
                    itemRep.Action <NetEntityID>(2, RPCMode.Server, argument);
                }
            }
        }
    }