// Use this for initialization void Start () { if (!isLocalPlayer) { return; } this.rigidbody = this.GetComponent<Rigidbody> (); state = MovementState.Walking; walkSpeed = 6; sprintSpeed = 10; crouchSpeed = 2; jumpForce = 400; isGrounded = true; isJumpReady = true; walkSource = this.gameObject.AddComponent<AudioSource>(); runSource = this.gameObject.AddComponent<AudioSource>(); walkSource.clip = walkSound; runSource.clip = runSound; walkSource.loop = true; runSource.loop = true; staminaScript = this.GetComponent <Player_Stamina>(); StartCoroutine ("SprintStamina"); }
//*************************************************************************************************** void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } PlayerMovement = gameObject.GetComponent <Player_Movement>(); PlayerShoot = gameObject.GetComponent <Player_Shoot>(); PlayerStamina = gameObject.GetComponent <Player_Stamina>(); }
// Use this for initialization void Start() { originalPosition = this.transform.localPosition; // -0.3 0.1 0.2 pos 0 0 0 rot originalRotation = this.transform.localEulerAngles; // -0.3 0.1 0.2 pos 0 0 0 rot staminaScript = this.GetComponent <Player_Stamina>(); }