void Start() { paramter = GetComponent <Fps_PlayerParamter>(); characterCtrl = GetComponent <CharacterController>(); curAnimator = GetComponent <Animator>(); playerCtrl = GetComponent <PlayerController>(); }
void Start() { // 设置鼠标不可见,并且锁定在游戏中 Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; paramter = GetComponent <Fps_PlayerParamter>(); input = GameObject.FindGameObjectWithTag(Tags.root).GetComponent <Fps_Input>(); }
private void Awake() { mainCamera = Camera.main.transform; bodyTran = upperBDTran.root; audioSource = GetComponent <AudioSource>(); controller = GetComponent <CharacterController>(); hitCollider = GetComponent <CapsuleCollider>(); paramter = GetComponent <Fps_PlayerParamter>(); }
public void SetTarget(GameObject go) { targetGo = go; if (targetGo) { player = targetGo.GetComponent <Fps_Player>();; // 确保刚体不改变旋转 if (targetGo.GetComponent <Rigidbody>()) { targetGo.GetComponent <Rigidbody>().freezeRotation = true; } CameraFollowPoint = player.playerCtrl.CameraFollowPoint; upperBDTran = player.playerCtrl.upperBDTran; bodyTran = upperBDTran.root; paramter = targetGo.GetComponent <Fps_PlayerParamter>(); } }
void Start() { player = transform.root.GetComponent <Fps_Player>(); player.playerAnim.Reload1Cb += Reload1; player.playerAnim.Reload2Cb += Reload2; ads = GetComponent <AudioSource>(); paramter = player.GetComponent <Fps_PlayerParamter>(); shootWaitTime = 60 / shootSettings.shootRate; aimStartPosZ = transform.localPosition.z; currentMess = shootSettings.maxMess; currentAmmo = shootSettings.maxAmmo; if (player.playerCtrl.ctrlType == PlayerController.CtrlType.Player) { string ammoStr = GetAmmoStr(); // 显示子弹 EventCenter.Broadcast(EventID.UpdateBattleText, ammoStr, ((int)player.hp).ToString()); } }