示例#1
0
    public void PushHit(GameObject go, Vector3 hit_dir)
    {
        LeavesPusherData leavesPusherData = this.GetDataByObject(go);

        if (leavesPusherData != null)
        {
            leavesPusherData.m_HitAxis = Vector3.Cross(hit_dir, Vector3.up);
            leavesPusherData.m_HitTime = Time.time;
        }
        else
        {
            float           def_shake_mul      = 0f;
            float           def_shake_time_mul = 0f;
            PushLeaves      component          = go.GetComponent <PushLeaves>();
            List <Material> materialsToModify  = component.GetMaterialsToModify();
            int             num = 0;
            if (num < materialsToModify.Count)
            {
                Material material = materialsToModify[num];
                if (material.HasProperty(LeavesPusher.s_ShaderPropertyShakeAdd))
                {
                    def_shake_mul = material.GetFloat(LeavesPusher.s_ShaderPropertyShakeAdd);
                }
                if (material.HasProperty(LeavesPusher.s_ShaderPropertyShakeTimeAdd))
                {
                    def_shake_time_mul = material.GetFloat(LeavesPusher.s_ShaderPropertyShakeTimeAdd);
                }
            }
            leavesPusherData           = new LeavesPusherData(go, go.transform.rotation, Player.Get().transform.right, 0f, go.GetComponent <PushLeaves>(), def_shake_mul, def_shake_time_mul);
            leavesPusherData.m_HitAxis = Vector3.Cross(hit_dir, Vector3.up);
            leavesPusherData.m_HitTime = Time.time;
            this.m_Data.Add(leavesPusherData);
        }
    }
示例#2
0
    public void Push(GameObject pusher_obj, float radius, Vector3?position_offset = null)
    {
        if (!this.m_SOM)
        {
            return;
        }
        float radius2 = this.GetRadius(pusher_obj.ReplIsOwner());

        foreach (KeyValuePair <StaticObjectClass, GameObject> keyValuePair in this.m_SOM.m_ReplacedMap)
        {
            GameObject value = keyValuePair.Value;
            if (value == null)
            {
                return;
            }
            float      num                = value.transform.position.Distance2D(pusher_obj.transform.position + (position_offset ?? Vector3.zero));
            float      def_shake_mul      = 0f;
            float      def_shake_time_mul = 0f;
            PushLeaves pushLeaves         = null;
            value.GetComponents <PushLeaves>(this.m_PushLeavesCache);
            if (this.m_PushLeavesCache.Count > 0)
            {
                pushLeaves = this.m_PushLeavesCache[0];
            }
            if (num < radius2 && this.GetDataByObject(value) == null && pushLeaves != null)
            {
                List <Material> materialsToModify = pushLeaves.GetMaterialsToModify();
                int             num2 = 0;
                if (num2 < materialsToModify.Count)
                {
                    Material material = materialsToModify[num2];
                    if (material.HasProperty(LeavesPusher.s_ShaderPropertyShakeAdd))
                    {
                        def_shake_mul = material.GetFloat(LeavesPusher.s_ShaderPropertyShakeAdd);
                    }
                    if (material.HasProperty(LeavesPusher.s_ShaderPropertyShakeTimeAdd))
                    {
                        def_shake_time_mul = material.GetFloat(LeavesPusher.s_ShaderPropertyShakeTimeAdd);
                    }
                }
                this.m_Data.Add(new LeavesPusherData(value, value.transform.rotation, pusher_obj.transform.right, radius2, value.GetComponent <PushLeaves>(), def_shake_mul, def_shake_time_mul));
                if (pusher_obj.gameObject.ReplIsOwner())
                {
                    PlayerInjuryModule.Get().SetLeechNextTime(PlayerInjuryModule.Get().GetLeechNextTime() - this.m_LeechCooldownDecrease2);
                    PlayerInjuryModule.Get().CheckLeeches();
                }
            }
        }
    }
示例#3
0
 public void Push(Vector3 pos, float radius)
 {
     if (!this.m_SOM)
     {
         return;
     }
     foreach (KeyValuePair <StaticObjectClass, GameObject> keyValuePair in this.m_SOM.m_ReplacedMap)
     {
         GameObject value = keyValuePair.Value;
         if (value == null)
         {
             return;
         }
         Vector3 vector = value.transform.position - pos;
         vector.y = 0f;
         float      def_shake_mul      = 0f;
         float      def_shake_time_mul = 0f;
         PushLeaves pushLeaves         = null;
         value.GetComponents <PushLeaves>(this.m_PushLeavesCache);
         if (this.m_PushLeavesCache.Count > 0)
         {
             pushLeaves = this.m_PushLeavesCache[0];
         }
         if (vector.magnitude < this.GetRadius() && this.GetDataByObject(value) == null && pushLeaves != null)
         {
             List <Material> materialsToModify = pushLeaves.GetMaterialsToModify();
             int             num = 0;
             if (num < materialsToModify.Count)
             {
                 Material material = materialsToModify[num];
                 if (material.HasProperty(LeavesPusher.s_ShaderPropertyShakeAdd))
                 {
                     def_shake_mul = material.GetFloat(LeavesPusher.s_ShaderPropertyShakeAdd);
                 }
                 if (material.HasProperty(LeavesPusher.s_ShaderPropertyShakeTimeAdd))
                 {
                     def_shake_time_mul = material.GetFloat(LeavesPusher.s_ShaderPropertyShakeTimeAdd);
                 }
             }
             this.m_Data.Add(new LeavesPusherData(value, value.transform.rotation, Player.Get().transform.right, this.GetRadius(), value.GetComponent <PushLeaves>(), def_shake_mul, def_shake_time_mul));
             PlayerInjuryModule.Get().SetLeechNextTime(PlayerInjuryModule.Get().GetLeechNextTime() - this.m_LeechCooldownDecrease2);
             PlayerInjuryModule.Get().CheckLeeches();
         }
     }
 }
示例#4
0
 public LeavesPusherData(GameObject go, Quaternion rot, Vector3 rotation_axis, float enter_radius_size, PushLeaves push_leaves, float def_shake_mul, float def_shake_time_mul)
 {
     this.m_Object          = go;
     this.m_OriginalQuat    = rot;
     this.m_RotationAxis    = rotation_axis;
     this.m_EnterRadiusSize = enter_radius_size;
     this.m_PushLeaves      = push_leaves;
     this.m_DefShake        = def_shake_mul;
     this.m_DefShakeTime    = def_shake_time_mul;
 }