Beispiel #1
0
 protected HumanController(Controller.ControllerFlags controllerFlags) : base(controllerFlags)
 {
     this.firstState              = true;
     this.sprintInMulTime         = 1f;
     this.crouchInMulTime         = 1f;
     this.server_last_pos         = Vector3.zero;
     this.server_was_grounded     = true;
     this.landingSpeedPenaltyTime = float.MaxValue;
 }
Beispiel #2
0
 protected HumanController(Controller.ControllerFlags controllerFlags) : base(controllerFlags)
 {
 }
Beispiel #3
0
 protected Controller(Controller.ControllerFlags controllerFlags, IDLocalCharacterAddon.AddonFlags addonFlags) : base(addonFlags)
 {
     this.controllerFlags = controllerFlags;
 }
Beispiel #4
0
    internal void ControllerSetup(Controllable controllable, uLink.NetworkView view, ref uLink.NetworkMessageInfo info)
    {
        bool flag;

        Controller.ControllerFlags controllerFlag;
        Controller.ControllerFlags controllerFlag1;
        if (this.wasSetup)
        {
            throw new InvalidOperationException("Already was setup");
        }
        this.wasSetup = true;
        Controller.ControllerFlags controllerFlag2 = this.controllerFlags & Controller.ControllerFlags.DontMessWithEnabled;
        if (controllerFlag2 == Controller.ControllerFlags.AlwaysSavedAsDisabled)
        {
            flag = false;
            if (base.enabled)
            {
                base.enabled = false;
                UnityEngine.Debug.LogError("this was not saved as enabled", this);
            }
        }
        else if (controllerFlag2 == Controller.ControllerFlags.AlwaysSavedAsEnabled)
        {
            flag = false;
            if (!base.enabled)
            {
                base.enabled = true;
                UnityEngine.Debug.LogError("this was not saved as disabled", this);
            }
        }
        else
        {
            flag = (controllerFlag2 == Controller.ControllerFlags.DontMessWithEnabled ? true : false);
        }
        this._controllable = controllable;
        if (this.playerControlled)
        {
            if (this.localPlayerControlled)
            {
                if ((this.controllerFlags & Controller.ControllerFlags.IncompatibleAsLocalPlayer) == Controller.ControllerFlags.IncompatibleAsLocalPlayer)
                {
                    throw new NotSupportedException();
                }
            }
            else if ((this.controllerFlags & Controller.ControllerFlags.IncompatibleAsRemotePlayer) == Controller.ControllerFlags.IncompatibleAsRemotePlayer)
            {
                throw new NotSupportedException();
            }
        }
        else if (this.localAIControlled)
        {
            if ((this.controllerFlags & Controller.ControllerFlags.IncompatibleAsLocalAI) == Controller.ControllerFlags.IncompatibleAsLocalAI)
            {
                throw new NotSupportedException();
            }
        }
        else if ((this.controllerFlags & Controller.ControllerFlags.IncompatibleAsRemoteAI) == Controller.ControllerFlags.IncompatibleAsRemoteAI)
        {
            throw new NotSupportedException();
        }
        this.OnControllerSetup(view, ref info);
        if (!flag)
        {
            if (this.playerControlled)
            {
                if (!this.localPlayerControlled)
                {
                    controllerFlag  = Controller.ControllerFlags.EnableWhenRemotePlayer;
                    controllerFlag1 = Controller.ControllerFlags.DisableWhenRemotePlayer;
                }
                else
                {
                    controllerFlag  = Controller.ControllerFlags.EnableWhenLocalPlayer;
                    controllerFlag1 = Controller.ControllerFlags.DisableWhenLocalPlayer;
                }
            }
            else if (!this.localAIControlled)
            {
                controllerFlag  = Controller.ControllerFlags.EnableWhenRemoteAI;
                controllerFlag1 = Controller.ControllerFlags.DisableWhenRemoteAI;
            }
            else
            {
                controllerFlag  = Controller.ControllerFlags.EnableWhenLocalAI;
                controllerFlag1 = Controller.ControllerFlags.DisableWhenLocalAI;
            }
            if ((this.controllerFlags & controllerFlag) == controllerFlag)
            {
                if ((this.controllerFlags & controllerFlag1) != controllerFlag1)
                {
                    base.enabled = true;
                }
                else
                {
                    base.enabled = !base.enabled;
                }
            }
            else if ((this.controllerFlags & controllerFlag1) == controllerFlag1)
            {
                base.enabled = false;
            }
        }
    }
Beispiel #5
0
 protected Controller(Controller.ControllerFlags controllerFlags) : this(controllerFlags, 0)
 {
 }