示例#1
0
 public void Start()
 {
     Stance.change(0);
 }
示例#2
0
 public void Update()
 {
     if (!Network.isServer)
     {
         if (Movement.isDriving)
         {
             Stance.range = 48;
             Stance.aim   = 10f;
         }
         else if (Movement.isSprinting)
         {
             Stance.range = (int)(32f * (1f - Player.skills.sneakybeaky() / 2f));
             Stance.aim   = 2f;
         }
         else if (Movement.isMoving)
         {
             if (Stance.state == 0)
             {
                 Stance.range = (int)(24f * (1f - Player.skills.sneakybeaky() / 2f));
                 Stance.aim   = 1.5f;
             }
             else if (Stance.state != 1)
             {
                 Stance.range = (int)(8f * (1f - Player.skills.sneakybeaky() / 2f));
                 Stance.aim   = 1f;
             }
             else
             {
                 Stance.range = (int)(16f * (1f - Player.skills.sneakybeaky() / 2f));
                 Stance.aim   = 1.25f;
             }
         }
         else if (Stance.state == 0)
         {
             Stance.range = (int)(16f * (1f - Player.skills.sneakybeaky() / 2f));
             Stance.aim   = 1f;
         }
         else if (Stance.state != 1)
         {
             Stance.range = (int)(4f * (1f - Player.skills.sneakybeaky() / 2f));
             Stance.aim   = 0.5f;
         }
         else
         {
             Stance.range = (int)(8f * (1f - Player.skills.sneakybeaky() / 2f));
             Stance.aim   = 0.75f;
         }
         Stance.cross = Mathf.Lerp(Stance.cross, Stance.aim, 4f * Time.deltaTime);
         if (base.transform.position.y >= Ocean.level && !Movement.isClimbing)
         {
             if (Movement.isGrounded && !Movement.isDriving && Screen.lockCursor)
             {
                 if (!Input.GetKeyDown(InputSettings.proneKey))
                 {
                     if (!Input.GetKey(InputSettings.proneKey) && !InputSettings.proneToggle && Stance.state == 2 && (int)Physics.OverlapSphere(Player.model.transform.position + new Vector3(0f, 1.7f, 0f), 0.3f, -225580823).Length == 0)
                     {
                         Stance.change(0);
                     }
                 }
                 else if (!InputSettings.proneToggle || Stance.state != 2)
                 {
                     Stance.change(2);
                 }
                 else if ((int)Physics.OverlapSphere(Player.model.transform.position + new Vector3(0f, 1.7f, 0f), 0.3f, -225580823).Length == 0)
                 {
                     Stance.change(0);
                 }
                 if (!Input.GetKeyDown(InputSettings.crouchKey))
                 {
                     if (!Input.GetKey(InputSettings.crouchKey) && !InputSettings.crouchToggle && Stance.state == 1 && (int)Physics.OverlapSphere(Player.model.transform.position + new Vector3(0f, 1.7f, 0f), 0.3f, -225580823).Length == 0)
                     {
                         Stance.change(0);
                     }
                 }
                 else if (Stance.state == 1 && InputSettings.crouchToggle)
                 {
                     if ((int)Physics.OverlapSphere(Player.model.transform.position + new Vector3(0f, 1.7f, 0f), 0.3f, -225580823).Length == 0)
                     {
                         Stance.change(0);
                     }
                 }
                 else if (Stance.state != 2)
                 {
                     Stance.change(1);
                 }
                 else if ((int)Physics.OverlapSphere(Player.model.transform.position + new Vector3(0f, 0.7f, 0f), 0.3f, -225580823).Length == 0)
                 {
                     Stance.change(1);
                 }
             }
         }
         else if (Stance.state != 0)
         {
             Stance.change(0);
         }
     }
 }
示例#3
0
    public void tellEnter(int index)
    {
        if (this.real)
        {
            if (Movement.isDriving)
            {
                base.networkView.RPC("updateSpeed", RPCMode.All, new object[] { 0 });
            }
            if (index != -1)
            {
                Movement.vehicle         = this;
                Movement.seat            = base.transform.FindChild("seats").FindChild(index.ToString());
                Movement.isDriving       = index == 0;
                Movement.control.enabled = false;

                if (index == 0)
                {
                    base.rigidbody.useGravity  = true;
                    base.rigidbody.isKinematic = false;
                    this.stop();
                }
                else if (!Network.isServer || this.passengers[0] != null)
                {
                    base.rigidbody.useGravity  = false;
                    base.rigidbody.isKinematic = true;
                    this.stop();
                }
                else
                {
                    base.rigidbody.isKinematic = false;
                    base.rigidbody.useGravity  = true;
                    base.rigidbody.AddForce(base.transform.right * (float)this.lastSpeed);
                    this.stop();
                }
            }
            else
            {
                Vector3 position = this.getPosition();
                if (position.y < Ocean.level)
                {
                    position = new Vector3(position.x, Ocean.level + 5f, position.z);
                }
                Player.model.transform.position = position;
                Movement.vehicle         = null;
                Movement.seat            = null;
                Movement.isDriving       = false;
                Movement.control.enabled = true;
                if (!Network.isServer)
                {
                    base.rigidbody.useGravity  = false;
                    base.rigidbody.isKinematic = true;
                    this.stop();
                }
            }
            Look.resetCameraPosition();
            if (index == -1)
            {
                Quaternion quaternion = base.transform.rotation;
                Look.yaw = quaternion.eulerAngles.y + 90f;
            }
            Stance.change(0);
        }
    }