Exemplo n.º 1
0
    // Token: 0x06002D9D RID: 11677 RVA: 0x000ABDD8 File Offset: 0x000A9FD8
    public static void DoImpact(GameObject go, global::SurfaceInfoObject.ImpactType type, Vector3 worldPos, Quaternion rotation)
    {
        global::SurfaceInfoObject surfaceInfoFor = global::SurfaceInfo.GetSurfaceInfoFor(go, worldPos);
        Object @object = Object.Instantiate(surfaceInfoFor.GetImpactEffect(type), worldPos, rotation);

        Object.Destroy(@object, 1f);
    }
Exemplo n.º 2
0
    // Token: 0x06002DBD RID: 11709 RVA: 0x000AC79C File Offset: 0x000AA99C
    private void Update()
    {
        if (this.terraincheck)
        {
            int textureIndex = global::TerrainTextureHelper.GetTextureIndex(base.origin);
        }
        bool timeLimited;

        if (!base.stateFlags.grounded || ((timeLimited = this.trait.timeLimited) && this.nextAllowTime > Time.time) || (base.masterControllable && base.masterControllable.idMain != base.idMain))
        {
            return;
        }
        bool    crouch = base.stateFlags.crouch;
        Vector3 origin = base.origin;

        this.movedAmount    += Vector3.Distance(this.lastFootstepPos, origin);
        this.lastFootstepPos = origin;
        if (this.movedAmount >= this.trait.sqrStrideDist)
        {
            this.movedAmount = 0f;
            AudioClip audioClip = null;
            if (global::footsteps.quality >= 2 || (global::footsteps.quality == 1 && base.character.localControlled))
            {
                Collider belowObj = this.GetBelowObj();
                if (belowObj)
                {
                    global::SurfaceInfoObject surfaceInfoFor = global::SurfaceInfo.GetSurfaceInfoFor(belowObj, origin);
                    if (surfaceInfoFor)
                    {
                        audioClip       = ((!this.trait.animal) ? surfaceInfoFor.GetFootstepBiped(this.lastPlayed) : surfaceInfoFor.GetFootstepAnimal());
                        this.lastPlayed = audioClip;
                    }
                }
            }
            if (!audioClip)
            {
                audioClip = this.trait.defaultFootsteps[Random.Range(0, this.trait.defaultFootsteps.Length)];
                if (!audioClip)
                {
                    return;
                }
            }
            float minAudioDist = this.trait.minAudioDist;
            float maxAudioDist = this.trait.maxAudioDist;
            if (crouch)
            {
                audioClip.Play(origin, 0.2f, Random.Range(0.95f, 1.05f), minAudioDist * 0.333f, maxAudioDist * 0.333f, 30);
            }
            else
            {
                audioClip.Play(origin, 0.65f, Random.Range(0.95f, 1.05f), minAudioDist, maxAudioDist, 30);
            }
            if (timeLimited)
            {
                this.nextAllowTime = Time.time + this.trait.minInterval;
            }
        }
    }
    // Token: 0x06000267 RID: 615 RVA: 0x0000CBF4 File Offset: 0x0000ADF4
    private void Update()
    {
        if (this.impacted)
        {
            return;
        }
        float num = Time.time - this.lastUpdateTime;

        this.lastUpdateTime = Time.time;
        RaycastHit  raycastHit = default(RaycastHit);
        RaycastHit2 invalid    = RaycastHit2.invalid;

        base.transform.Rotate(Vector3.right, this.dropDegreesPerSec * num);
        Ray ray;

        ray..ctor(base.transform.position, base.transform.forward);
        float num2 = this.speedPerSec * num;
        bool  flag = true;

        if (Physics2.Raycast2(ray, ref invalid, this.speedPerSec * num, this.layerMask))
        {
            Vector3    normal;
            Vector3    point;
            GameObject gameObject;
            Rigidbody  rigidbody;
            if (flag)
            {
                normal     = invalid.normal;
                point      = invalid.point;
                gameObject = invalid.gameObject;
                rigidbody  = invalid.rigidbody;
            }
            else
            {
                normal     = raycastHit.normal;
                point      = raycastHit.point;
                gameObject = raycastHit.collider.gameObject;
                rigidbody  = raycastHit.rigidbody;
            }
            Quaternion quaternion = Quaternion.LookRotation(normal);
            Vector3    vector     = Vector3.zero;
            int        layer      = gameObject.layer;
            if (rigidbody && !rigidbody.isKinematic && !rigidbody.CompareTag("Door"))
            {
                rigidbody.AddForceAtPosition(Vector3.up * 200f, point);
                rigidbody.AddForceAtPosition(ray.direction * 1000f, point);
            }
            if (layer != 17 && layer != 18 && layer != 27 && layer != 21)
            {
                vector = point + normal * 0.01f;
            }
            this.impacted           = true;
            base.transform.position = point;
            this.TryReportHit(gameObject);
            base.transform.parent = gameObject.transform;
            TrailRenderer component = base.GetComponent <TrailRenderer>();
            if (component)
            {
                component.enabled = false;
            }
            base.audio.enabled = false;
            if (gameObject)
            {
                global::SurfaceInfoObject surfaceInfoFor = global::SurfaceInfo.GetSurfaceInfoFor(gameObject, point);
                surfaceInfoFor.GetImpactEffect(global::SurfaceInfoObject.ImpactType.Bullet);
                Object @object = Object.Instantiate(surfaceInfoFor.GetImpactEffect(global::SurfaceInfoObject.ImpactType.Bullet), point, quaternion);
                Object.Destroy(@object, 1.5f);
                this.TryReportMiss();
            }
            Object.Destroy(base.gameObject, 20f);
        }
        else
        {
            base.transform.position += base.transform.forward * this.speedPerSec * num;
            this.distance           += this.speedPerSec * num;
        }
        if (this.distance > this.maxRange || Time.time - this.spawnTime > this.maxLifeTime)
        {
            Object.Destroy(base.gameObject);
        }
    }