Exemplo n.º 1
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);
            }
        }
    }
Exemplo n.º 2
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);
                }
            }
        }
    }