private Transform target; // ロックオン対象 #endregion Fields #region Constructors /// <summary> /// プレイヤーカメラの動作 /// </summary> /// <param name="controller">カメラを制御するためのクラス</param> /// <param name="horizontalRotationSpeed">プレイヤーがカメラを操作するときの水平方向移動速度</param> /// <param name="verticalRotationSpeed">プレイヤーがカメラを操作するときの垂直方向移動速度</param> public PlayerCamera(CameraController controller, float horizontalRotationSpeed, float verticalRotationSpeed) { this.controller = controller; cameraTransform = controller.cameraTransform; this.horizontalRotationSpeed = horizontalRotationSpeed; this.verticalRotationSpeed = verticalRotationSpeed; player = GameManager.instance.player; }
protected virtual void Start() { if (!baseEnemyAI) { Debug.LogError("BaseEnemyAIが存在しません"); } if (currentState != EnemyState.Idle) { currentState = EnemyState.Idle; } cameraController = GameObject.FindGameObjectWithTag(TagName.CameraController).GetComponent<CameraController>(); }
protected virtual void Start() { if (currentState != EnemyState.Bone) { currentState = EnemyState.Bone; } cameraController = GameObject.FindGameObjectWithTag(TagName.CameraController).GetComponent<CameraController>(); }
void Start() { // リソースロード autoLockOnIconSprite = Resources.Load<Sprite>("Sprites/AutoLockOnIcon"); manualLockOnIconSprite = Resources.Load<Sprite>("Sprites/ManualRockOnIcon"); barrierPrefab = Resources.Load<GameObject>("Prefabs/Effects/Barrier/Barrier"); cameraRigPrefab = Resources.Load<GameObject>("Prefabs/Player/CameraRig"); characterController = GetComponent<CharacterController>(); GameObject cameraRig = GameObject.FindGameObjectWithTag(TagName.CameraController); if (cameraRig == null) { cameraRig = Instantiate(cameraRigPrefab); } cameraController = cameraRig.GetComponent<CameraController>(); cameraController.target = transform; //playerTrampled = GetComponentInChildren<PlayerTrampled>(); playerCamera = new PlayerCamera(cameraController, horizontalRotationSpeed, verticalRotationSpeed); animator = GetComponentInChildren<Animator>(); // アニメーションをコントロールするためのAnimatorを子から取得 meshRoot = animator.transform; // Animatorがアタッチされているのがメッシュのはずだから // ジャンプできる高さから初速を計算(√2gh) jumpPower = Mathf.Sqrt(2.0f * -Physics.gravity.y * jumpHeight); highJumpPower = Mathf.Sqrt(2.0f * -Physics.gravity.y * highJumpHeight); if (autoLockOnArea == null) { Debug.Log(typeof(ContainedObjects) + " が見つかりません"); } speedID = Animator.StringToHash("Speed"); isJumpID = Animator.StringToHash("IsJump"); isGroundedID = Animator.StringToHash("IsGrounded"); isTrampledID = Animator.StringToHash("IsTrampled"); isFallID = Animator.StringToHash("IsFall"); isDamageID = Animator.StringToHash("IsDamage"); attackFlow = new PlayerAttackFlow(animator); // 初期状態へ currentState = new NormalState(this); // ロックオンアイコン用のCanvas UICanvasGenerator.FollowIconCanvasGenerate(); GameObject lockOnIconPrefab = Resources.Load<GameObject>("Prefabs/UI/LockOnIcon"); lockOnIcon = Instantiate(lockOnIconPrefab).GetSafeComponent<FollowIcon>(); lockOnIcon.Hide(); powerPointPrefab = Resources.Load<GameObject>("Prefabs/Effects/PowerPoint"); // 結界の点を生成するためのスクリプトをアタッチ powerPointCreator = gameObject.AddComponent<PowerPointCreator>(); }