コード例 #1
0
    /// <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());
    }