private void Update() { if (StatusCheck()) { transform.localScale = GameFunc.LookAtVector3(transform.position, gameDirector.player.transform.position); rigidBody2D.MovePosition(Vector2.MoveTowards(transform.position, gameDirector.player.transform.position, Speed)); } }
private void Update() { if (StatusCheck()) { var me = transform; var player = gameDirector.player.transform; transform.localScale = GameFunc.LookAtVector3(me.position, player.position); rigid2D.MovePosition(Vector2.MoveTowards(me.position, new Vector2(me.position.x, player.position.y), Speed)); } }
private void Update() { if (StatusCheck()) { transform.localScale = GameFunc.LookAtVector3(transform.position, gameDirector.player.transform.position, false); // Y座標を合わせるように移動 Vector3 target = transform.position; target.y = gameDirector.player.transform.position.y; rigidBody2D.MovePosition(Vector3.MoveTowards(transform.position, target, Speed)); } }