void Start() { isDogWin = false; isCatWin = false; catJewelCount = 0; initObtainedObjectCounts(); popupMessage = GameObject.FindObjectOfType <GamePopupMessage>(); if (PhotonManager.Instance.NowPlayerType == PlayerType.Cat) { dogMoveController.SetActive(false); catMoveCotroller.SetActive(true); jewelImages = catJewelImages; } else { dogMoveController.SetActive(true); catMoveCotroller.SetActive(false); jewelImages = dogJewelImages; } sweetController = GameObject.FindObjectOfType <SweetController>(); sensorController = GameObject.FindObjectOfType <SensorController>(); // 攻撃したオブジェクトを購読 attackedObserve(); // 獲得したオブジェクトを購読 obtainedObserve(); //とりあえず即座にゲーム始まる startBattle(); }
/// <summary> /// コントローラの初期化 /// </summary> private void initGorillaController() { gameManager = GameObject.FindObjectOfType <GameManager>(); playerMoveController = GameObject.Find(PathMaster.DOG_MOVE_CONTROLLER).GetComponent <PlayerMoveController>(); attackController = GameObject.Find(PathMaster.ATTACK_CONTROLLER).GetComponent <AttackController>(); sweetController = GameObject.Find(PathMaster.SWEET_CONTROLLER).GetComponent <SweetController>(); sensorController = GameObject.Find(PathMaster.SENSOR_CONTROLLER).GetComponent <SensorController>(); skillController = GameObject.Find(PathMaster.SKILL_CONTROLLER).GetComponent <SkillController>(); mainCamera = Camera.main; CameraController cameraController = mainCamera.GetComponent <CameraController>(); cameraController.Player = this.gameObject; cameraController.InitCameraController(); cameraAnimator = mainCamera.GetComponent <Animator>(); this.FixedUpdateAsObservable() .Where(_ => isInBattleState()) .Subscribe(x => playerBehavior()); this.FixedUpdateAsObservable() .Where(x => attackController.GetAttackable() && isInBattleState()) .Subscribe(_ => gorillaAttack()); this.FixedUpdateAsObservable() .Where(x => sweetController.GetUsable() && isInBattleState()) .Subscribe(_ => useSweet()); this.FixedUpdateAsObservable() .Where(x => sensorController.GetUsable() && isInBattleState()) .Subscribe(_ => useSensor()); this.FixedUpdateAsObservable() .Where(x => skillController.GetSkillUsable() && isInBattleState()) .Subscribe(_ => useSkill()); }