Added Entity.beingPushed() state without actually using it
This commit is contained in:
parent
54c1a142e4
commit
fe334f8d15
@ -30,6 +30,14 @@ public class Entity : MonoBehaviour
|
||||
attackTimer = attackCooldown;
|
||||
}
|
||||
|
||||
protected virtual void FixedUpdate() {
|
||||
//TODO sqrMagnitude?
|
||||
if (beingPushed && rb.velocity.magnitude < stats.MinVelocityWhenPushed) {
|
||||
rb.velocity = Vector2.zero;
|
||||
beingPushed = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Attack(){
|
||||
// jason: TODO Either have target be Entity instead of transform, or skip Attack when GetComponent<Entity>() is null
|
||||
Entity targetEntity = target.GetComponent<Entity>();
|
||||
@ -40,11 +48,11 @@ public class Entity : MonoBehaviour
|
||||
|
||||
}
|
||||
|
||||
protected virtual void MoveToTarget(float deltaTime){
|
||||
protected virtual void MoveToTarget(){
|
||||
|
||||
direction = Vector3.RotateTowards(direction, (target.position - transform.position), rotSpeed*deltaTime, 0.0f);
|
||||
direction = Vector3.RotateTowards(direction, (target.position - transform.position), rotSpeed*Time.fixedDeltaTime, 0.0f);
|
||||
if(!IsInAttackRange()){
|
||||
rb.MovePosition(transform.position + direction * movementSpeed * deltaTime);
|
||||
rb.MovePosition(transform.position + direction * movementSpeed * Time.fixedDeltaTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -11,7 +11,11 @@ public class Monster : Entity
|
||||
base.SetName("Monster");
|
||||
}
|
||||
|
||||
void FixedUpdate() => MoveToTarget(Time.fixedDeltaTime);
|
||||
protected override void FixedUpdate() {
|
||||
base.FixedUpdate();
|
||||
|
||||
MoveToTarget();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user