Cositas (~ ̄▽ ̄)~
This commit is contained in:
parent
db7b5af053
commit
55b18c6def
28 changed files with 4095 additions and 123 deletions
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
@ -7,6 +8,9 @@ public class GhostController : MonoBehaviour {
|
|||
[SerializeField] float speed;
|
||||
[SerializeField] Transform player;
|
||||
|
||||
[SerializeField, Range(0f, 20f)] float accelerationPower = 10;
|
||||
float _currentSpeed;
|
||||
|
||||
Animator _anim;
|
||||
Rigidbody2D _rb2d;
|
||||
|
||||
|
@ -16,11 +20,15 @@ public class GhostController : MonoBehaviour {
|
|||
_rb2d = GetComponent<Rigidbody2D>();
|
||||
}
|
||||
|
||||
void Update() {
|
||||
_currentSpeed = speed * Mathf.Log(GameManager.instance.CurrentTime + accelerationPower, accelerationPower);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void FixedUpdate() {
|
||||
if (_hasKilled) return;
|
||||
|
||||
_rb2d.position = Vector2.MoveTowards(_rb2d.position, player.position, Time.deltaTime * speed);
|
||||
_rb2d.position = Vector2.MoveTowards(_rb2d.position, player.position, Time.deltaTime * _currentSpeed);
|
||||
}
|
||||
|
||||
bool _hasKilled;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue