private void Start() { this.UpdateAsObservable() .Subscribe(_ => { _playerInput.InputKeys(); }); this.UpdateAsObservable() .Subscribe(_ => { _playerMover.Move(_playerInput.MoveDirection() * moveSpeed); }); this.UpdateAsObservable() .Select(rayHitPosition => _playerRayCaster.GetPositionByRay(_playerInput.LookDirection())) .Subscribe(rayHitPosition => { _playerRotater.LookRotation(rayHitPosition); }); //攻撃切り替え this.UpdateAsObservable() .Select(flag => _playerInput.IsAttack()) .Subscribe(flag => { playerAttacker.OnActiveAttackCollider(flag); }); }
public void UpdatePlayerAction() { var okeList = UnitManager.Instance.unitOkeList; //軌跡の表示 drawArc.DrawLine(okeList[(int)_currentUnitType].position, transform.position); var mousePosition = _playerRayCaster.GetPositionByRay(_playerInput.MouseDirection); transform.position = mousePosition; //Unitの選択 if (_playerInput.IsSelectSlot()) { _currentUnitType = (UnitType)_playerInput.GetSelectSlot(); } //Unitへ命令 if (_playerInput.IsAllAttack) { var targetPosition = _playerRayCaster.GetRayHitObject(_playerInput.MouseDirection); UnitManager.Instance.SetTargetToAllUnit(targetPosition); } if (_isSummonable == false) { return; } //召喚 if (_playerInput.IsSummonSetting) { _playerSummoner.SummonSetting(mousePosition, _currentUnitType); } else if (_playerInput.IsSummon) { _playerSummoner.SummonUnit(); } }