public void Execute(MoveComponent moveComponent) { _move = moveComponent; Observable.Timer(TimeSpan.FromSeconds(0.1)).Repeat().Subscribe(_ => { var direction = (_player.transform.position - _self.transform.position).normalized; _move.MoveInDirection(direction); }).AddTo(_disposable); }
public void Execute(MoveComponent moveComponent) { _move = moveComponent; Observable.Timer(TimeSpan.FromSeconds(1)).Repeat().Subscribe(_ => { var direction = Random.onUnitSphere; direction.y = 0f; _move.MoveInDirection(direction); }).AddTo(_disposable); }