Muchas cosas
This commit is contained in:
parent
b4e11ac33f
commit
9c92dc678e
76 changed files with 15307 additions and 2021 deletions
21
Assets/Scripts/Ghost/GhostController.cs
Normal file
21
Assets/Scripts/Ghost/GhostController.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class GhostController : MonoBehaviour {
|
||||
|
||||
[SerializeField] float speed;
|
||||
[SerializeField] Transform player;
|
||||
|
||||
Rigidbody2D _rb2d;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Awake() {
|
||||
_rb2d = GetComponent<Rigidbody2D>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void FixedUpdate() {
|
||||
_rb2d.position = Vector2.MoveTowards(_rb2d.position, player.position, Time.deltaTime * speed);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue