private void DefineMoveStream(Player player) { var rigidBody2D = player.GetComponent <Rigidbody2D> (); _MoveClamp = new MoveClamper(new Vector2(3.8f, 3), rigidBody2D, new Vector2(0.3f, 0.3f)); player.FixedUpdateAsObservable() .Where(_ => !player.Controller.StateController.IsAimMode.Value) .Subscribe(_ => { rigidBody2D.MovePosition(rigidBody2D.position + _Velocity * _Speed * TimeManager.PlayerFixedDeltaTime); }); player.FixedUpdateAsObservable() .Where(_ => player.Controller.StateController.IsAimMode.Value) .Subscribe(_ => rigidBody2D.MovePosition(rigidBody2D.position + _Velocity * _Speed * 0.2f * TimeManager.PlayerFixedDeltaTime)); player.StartCoroutine(_LateFixiedUpdate(() => { if (player.CanControl) { _MoveClamp.Clamp(); } })); //死んだ後 //player.Controller.LifeController // .DeadAsObservable // .Subscribe (_ => rigidBody2D.position = Camera.main.ViewportToWorldPoint (new Vector3 (-0.1f, 0.5f, 0.5f))); }
private void Start() { _Clamp = new MoveClamper(Vector2.zero, transform); DefineRightStickAiming(); DefineMouseAiming(); this.UpdateAsObservable() .Subscribe(_ => _Clamp.Clamp()); }
public void Start() { var player = GameManager.Player; _Clamp = new MoveClamper(Vector2.zero, _Rigidbody2D); DefineMouseAiming(player); DefineFixingTarget(player); this.FixedUpdateAsObservable() .Subscribe(_ => _Clamp.Clamp()); }