No me acuerdo
This commit is contained in:
parent
aabe5457e2
commit
9ecec372ce
143 changed files with 21409 additions and 2042 deletions
|
@ -7,15 +7,27 @@ public class GhostController : MonoBehaviour {
|
|||
[SerializeField] float speed;
|
||||
[SerializeField] Transform player;
|
||||
|
||||
Animator _anim;
|
||||
Rigidbody2D _rb2d;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Awake() {
|
||||
_anim = GetComponent<Animator>();
|
||||
_rb2d = GetComponent<Rigidbody2D>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void FixedUpdate() {
|
||||
if (_hasKilled) return;
|
||||
|
||||
_rb2d.position = Vector2.MoveTowards(_rb2d.position, player.position, Time.deltaTime * speed);
|
||||
}
|
||||
|
||||
bool _hasKilled;
|
||||
static readonly int Kill1 = Animator.StringToHash("Kill");
|
||||
|
||||
public void Kill() {
|
||||
_hasKilled = true;
|
||||
_anim.SetTrigger(Kill1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue