コード例 #1
0
        public static bool SetEnabled(CharacterInterpolatorBase interpolator)
        {
            HashSet <CharacterInterpolatorBase> set;
            HashSet <CharacterInterpolatorBase> set2;

            if (!iterating)
            {
                return((!swapped ? hashset1 : hashset2).Add(interpolator));
            }
            if (caughtIterating)
            {
                return((!swapped ? hashset2 : hashset1).Add(interpolator));
            }
            if (swapped)
            {
                set  = hashset2;
                set2 = hashset1;
            }
            else
            {
                set  = hashset1;
                set2 = hashset2;
            }
            if (set.Contains(interpolator))
            {
                return(false);
            }
            caughtIterating = true;
            set2.UnionWith(set);
            return(set2.Add(interpolator));
        }
コード例 #2
0
        public static bool SetEnabled(CharacterInterpolatorBase interpolator)
        {
            HashSet <CharacterInterpolatorBase> characterInterpolatorBases;
            HashSet <CharacterInterpolatorBase> characterInterpolatorBases1;

            if (!CharacterInterpolatorBase.Interpolators.iterating)
            {
                return(((!CharacterInterpolatorBase.Interpolators.swapped ? CharacterInterpolatorBase.Interpolators.hashset1 : CharacterInterpolatorBase.Interpolators.hashset2)).Add(interpolator));
            }
            if (CharacterInterpolatorBase.Interpolators.caughtIterating)
            {
                return(((!CharacterInterpolatorBase.Interpolators.swapped ? CharacterInterpolatorBase.Interpolators.hashset2 : CharacterInterpolatorBase.Interpolators.hashset1)).Add(interpolator));
            }
            if (!CharacterInterpolatorBase.Interpolators.swapped)
            {
                characterInterpolatorBases  = CharacterInterpolatorBase.Interpolators.hashset1;
                characterInterpolatorBases1 = CharacterInterpolatorBase.Interpolators.hashset2;
            }
            else
            {
                characterInterpolatorBases  = CharacterInterpolatorBase.Interpolators.hashset2;
                characterInterpolatorBases1 = CharacterInterpolatorBase.Interpolators.hashset1;
            }
            if (characterInterpolatorBases.Contains(interpolator))
            {
                return(false);
            }
            CharacterInterpolatorBase.Interpolators.caughtIterating = true;
            characterInterpolatorBases1.UnionWith(characterInterpolatorBases);
            return(characterInterpolatorBases1.Add(interpolator));
        }
コード例 #3
0
    private void UpdateStateNew(Vector3 origin, Angle2 eyesAngles, ushort stateFlags, double timestamp)
    {
        CharacterStateInterpolatorData characterStateInterpolatorDatum = new CharacterStateInterpolatorData();
        Character character = base.idMain;

        if (this.firstState)
        {
            this.firstState            = false;
            character.origin           = origin;
            character.eyesAngles       = eyesAngles;
            character.stateFlags.flags = stateFlags;
            return;
        }
        if (!base.networkView.isMine)
        {
            CharacterInterpolatorBase characterInterpolatorBase = base.interpolator;
            if (characterInterpolatorBase)
            {
                IStateInterpolator <CharacterStateInterpolatorData> stateInterpolator = characterInterpolatorBase as IStateInterpolator <CharacterStateInterpolatorData>;
                if (stateInterpolator == null)
                {
                    character.stateFlags.flags = stateFlags;
                    characterInterpolatorBase.SetGoals(origin, eyesAngles.quat, timestamp);
                }
                else
                {
                    characterStateInterpolatorDatum.origin      = origin;
                    characterStateInterpolatorDatum.state.flags = stateFlags;
                    characterStateInterpolatorDatum.eyesAngles  = eyesAngles;
                    stateInterpolator.SetGoals(ref characterStateInterpolatorDatum, ref timestamp);
                }
            }
        }
        else
        {
            character.origin           = origin;
            character.eyesAngles       = eyesAngles;
            character.stateFlags.flags = stateFlags;
            CCMotor cCMotor = base.ccmotor;
            if (cCMotor)
            {
                cCMotor.Teleport(origin);
            }
        }
    }
コード例 #4
0
    private void UpdateStateNew(Vector3 origin, Angle2 eyesAngles, ushort stateFlags, double timestamp)
    {
        Character idMain = base.idMain;

        if (this.firstState)
        {
            this.firstState         = false;
            idMain.origin           = origin;
            idMain.eyesAngles       = eyesAngles;
            idMain.stateFlags.flags = stateFlags;
        }
        else if (base.networkView.isMine)
        {
            idMain.origin           = origin;
            idMain.eyesAngles       = eyesAngles;
            idMain.stateFlags.flags = stateFlags;
            CCMotor ccmotor = base.ccmotor;
            if (ccmotor != null)
            {
                ccmotor.Teleport(origin);
            }
        }
        else
        {
            CharacterInterpolatorBase base2 = base.interpolator;
            if (base2 != null)
            {
                IStateInterpolator <CharacterStateInterpolatorData> interpolator = base2 as IStateInterpolator <CharacterStateInterpolatorData>;
                if (interpolator != null)
                {
                    CharacterStateInterpolatorData data;
                    data.origin      = origin;
                    data.state.flags = stateFlags;
                    data.eyesAngles  = eyesAngles;
                    interpolator.SetGoals(ref data, ref timestamp);
                }
                else
                {
                    idMain.stateFlags.flags = stateFlags;
                    base2.SetGoals(origin, eyesAngles.quat, timestamp);
                }
            }
        }
    }
コード例 #5
0
 public static bool SetEnabled(CharacterInterpolatorBase interpolator)
 {
     HashSet<CharacterInterpolatorBase> characterInterpolatorBases;
     HashSet<CharacterInterpolatorBase> characterInterpolatorBases1;
     if (!CharacterInterpolatorBase.Interpolators.iterating)
     {
         return ((!CharacterInterpolatorBase.Interpolators.swapped ? CharacterInterpolatorBase.Interpolators.hashset1 : CharacterInterpolatorBase.Interpolators.hashset2)).Add(interpolator);
     }
     if (CharacterInterpolatorBase.Interpolators.caughtIterating)
     {
         return ((!CharacterInterpolatorBase.Interpolators.swapped ? CharacterInterpolatorBase.Interpolators.hashset2 : CharacterInterpolatorBase.Interpolators.hashset1)).Add(interpolator);
     }
     if (!CharacterInterpolatorBase.Interpolators.swapped)
     {
         characterInterpolatorBases = CharacterInterpolatorBase.Interpolators.hashset1;
         characterInterpolatorBases1 = CharacterInterpolatorBase.Interpolators.hashset2;
     }
     else
     {
         characterInterpolatorBases = CharacterInterpolatorBase.Interpolators.hashset2;
         characterInterpolatorBases1 = CharacterInterpolatorBase.Interpolators.hashset1;
     }
     if (characterInterpolatorBases.Contains(interpolator))
     {
         return false;
     }
     CharacterInterpolatorBase.Interpolators.caughtIterating = true;
     characterInterpolatorBases1.UnionWith(characterInterpolatorBases);
     return characterInterpolatorBases1.Add(interpolator);
 }
コード例 #6
0
    protected void Push(ref T state, ref double timeStamp)
    {
        int num;
        int length = (int)this.tbuffer.Length;

        if (this.len >= length)
        {
            for (int i = 0; i < length; i++)
            {
                int num1 = this.tbuffer[i].index;
                if (this.tbuffer[num1].timeStamp < timeStamp)
                {
                    int num2 = this.tbuffer[length - 1].index;
                    for (int j = length - 1; j > i; j--)
                    {
                        this.tbuffer[j].index = this.tbuffer[j - 1].index;
                    }
                    this.tbuffer[i].index = num2;
                    this.tbuffer[num2].Set(ref state, ref timeStamp);
                    return;
                }
                if (this.tbuffer[num1].timeStamp == timeStamp)
                {
                    this.tbuffer[num1].Set(ref state, ref timeStamp);
                    return;
                }
            }
        }
        else
        {
            for (int k = 0; k < this.len; k++)
            {
                int num3 = this.tbuffer[k].index;
                if (this.tbuffer[num3].timeStamp < timeStamp)
                {
                    for (int l = this.len; l > k; l--)
                    {
                        this.tbuffer[l].index = this.tbuffer[l - 1].index;
                    }
                    this.tbuffer[k].index = this.len;
                    TimeStamped <T>[]             timeStampedArray          = this.tbuffer;
                    CharacterInterpolatorBase <T> characterInterpolatorBase = this;
                    int num4 = characterInterpolatorBase.len;
                    num = num4;
                    characterInterpolatorBase.len = num4 + 1;
                    timeStampedArray[num].Set(ref state, ref timeStamp);
                    return;
                }
                if (this.tbuffer[num3].timeStamp == timeStamp)
                {
                    this.tbuffer[num3].Set(ref state, ref timeStamp);
                    return;
                }
            }
            this.tbuffer[this.len].index = this.len;
            TimeStamped <T>[]             timeStampedArray1          = this.tbuffer;
            CharacterInterpolatorBase <T> characterInterpolatorBase1 = this;
            int num5 = characterInterpolatorBase1.len;
            num = num5;
            characterInterpolatorBase1.len = num5 + 1;
            timeStampedArray1[num].Set(ref state, ref timeStamp);
        }
    }