// Token: 0x0600041F RID: 1055 RVA: 0x000143D8 File Offset: 0x000125D8
    private void Update()
    {
        this.CalculateVelocity();
        global::Character idMain = base.idMain;
        bool flag = idMain;
        global::CharacterStateFlags characterStateFlags;

        if (flag)
        {
            characterStateFlags = idMain.stateFlags;
        }
        else
        {
            characterStateFlags = default(global::CharacterStateFlags);
        }
        bool    flag2  = !characterStateFlags.grounded;
        bool    focus  = characterStateFlags.focus;
        bool    crouch = characterStateFlags.crouch;
        Weights weights;

        weights.idle = 0f;
        if (this.movementNormal.x > 0f)
        {
            weights.east = this.movementNormal.x;
            weights.west = 0f;
        }
        else if (this.movementNormal.x < 0f)
        {
            weights.east = 0f;
            weights.west = -this.movementNormal.x;
        }
        else
        {
            weights.east = (weights.west = 0f);
        }
        if (this.movementNormal.y > 0f)
        {
            weights.north = this.movementNormal.y;
            weights.south = 0f;
        }
        else if (this.movementNormal.y < 0f)
        {
            weights.north = 0f;
            weights.south = -this.movementNormal.y;
        }
        else
        {
            weights.north = (weights.south = 0f);
        }
        if (this.movementNormal.y == 0f && this.movementNormal.x == 0f)
        {
            weights = this.lastHeadingWeights;
        }
        weights.idle            = 0f;
        this.lastHeadingWeights = weights;
        State state;

        if (flag2)
        {
            state = 1;
        }
        else if (crouch)
        {
            state = 0;
        }
        else if (characterStateFlags.sprint && this.speedPrecise >= (double)this.movement.configuration.runSpeed)
        {
            state = 2;
        }
        else
        {
            state = 1;
        }
        string text = this.itemHolder.animationGroupName;

        if (this.idealGroupName != text)
        {
            this.idealGroupName = text;
            text = (text ?? this.animationTrait.defaultGroupName);
            int?num = this.movement.configuration.GroupIndex(text);
            if (num == null)
            {
                Debug.LogWarning("Could not find group name " + this.idealGroupName);
                this.usingGroupName = this.animationTrait.defaultGroupName;
                int?num2 = this.movement.configuration.GroupIndex(this.usingGroupName);
                this.usingGroupIndex = ((num2 == null) ? 0 : num2.Value);
            }
            else
            {
                this.usingGroupName  = this.idealGroupName;
                this.usingGroupIndex = num.Value;
            }
        }
        int    group = this.usingGroupIndex;
        double num3;
        float  num4;

        if (!characterStateFlags.slipping)
        {
            num3 = (double)Time.deltaTime;
            this.movement.state = state;
            this.movement.group = group;
            num4 = this.movement.UpdateWeights(Time.deltaTime, flag2, !flag || characterStateFlags.movement);
        }
        else
        {
            num3 = (double)(-(double)Time.deltaTime);
            num4 = this.lastUnitScale;
        }
        this.wasAirborne   = flag2;
        this.lastUnitScale = num4;
        if (!double.IsNaN(this.speedPrecise) && !double.IsInfinity(this.speedPrecise))
        {
            float num5 = this.positionTime;
            this.positionTime = (float)(((double)this.positionTime + Math.Abs((double)num4 * this.speedPrecise * num3)) % 1.0);
            if (this.positionTime < 0f)
            {
                this.positionTime += 1f;
            }
            else if (float.IsNaN(this.positionTime) || float.IsInfinity(this.positionTime))
            {
                this.positionTime = num5;
            }
            this.movement.configuration.OffsetTime(this.positionTime, ref this.times);
        }
        float num6 = (!flag) ? (-base.transform.eulerAngles.x) : idMain.eyesPitch;

        this.movement.SetWeights(this.animation, ref weights, ref this.times, num6);
    }
 // Token: 0x06003C83 RID: 15491 RVA: 0x000D84F4 File Offset: 0x000D66F4
 public global::ActivationResult ActTrigger(global::Character instigator, ulong timestamp)
 {
     return(this.ActTrigger(instigator, (!this.isOn) ? global::ActivationToggleState.On : global::ActivationToggleState.Off, timestamp));
 }
 // Token: 0x06000E19 RID: 3609 RVA: 0x00036054 File Offset: 0x00034254
 public void Set(global::Character character, ref Vector3 localPoint, ref global::Angle2 localNormal, byte bodyPart, ref uLink.NetworkMessageInfo info)
 {
     this.Set(character.hitBoxSystem, ref localPoint, ref localNormal, bodyPart, ref info);
 }
Exemple #4
0
    // Token: 0x06002C68 RID: 11368 RVA: 0x000A6240 File Offset: 0x000A4440
    private global::ActivationResult ApplyActivatable(global::Activatable activatable, global::Character instigator, ulong timestamp, bool extra)
    {
        global::ActivationResult result;

        if (activatable)
        {
            global::ContextActivator.ActivationMode activationMode = this.activationMode;
            if (activationMode != global::ContextActivator.ActivationMode.TurnOn)
            {
                if (activationMode != global::ContextActivator.ActivationMode.TurnOff)
                {
                    result = activatable.Activate(instigator, timestamp);
                }
                else
                {
                    result = activatable.Activate(false, instigator, timestamp);
                }
            }
            else
            {
                result = activatable.Activate(true, instigator, timestamp);
            }
        }
        else
        {
            result = global::ActivationResult.Error_Destroyed;
        }
        return(result);
    }