uh you can switch players now
This commit is contained in:
parent
a0bfc600ef
commit
cb4470f2d6
11 changed files with 582 additions and 235 deletions
|
|
@ -5,16 +5,20 @@ public class Enemy : AutoControlledEntity
|
|||
{
|
||||
private void FixedUpdate()
|
||||
{
|
||||
Vector2 direction = new Vector2(0, stats.rb.linearVelocityY);
|
||||
if (closestEntity && Vector3.Distance(closestEntity.transform.position, transform.position) < maxTargettingRange)
|
||||
if (!stats.isStalled)
|
||||
{
|
||||
direction.x = (closestEntity.transform.position - transform.position).normalized.x * stats.speed;
|
||||
if ((closestEntity.transform.position.y - transform.position.y > maxHeightDifference || (DetectWalls() && Vector3.Distance(closestEntity.transform.position, transform.position) > minTargetJumpDistance)) && stats.OnGround())
|
||||
Vector2 direction = new Vector2(0, stats.rb.linearVelocityY);
|
||||
if (closestEntity && Vector3.Distance(closestEntity.transform.position, transform.position) < maxTargettingRange)
|
||||
{
|
||||
direction.y = stats.jumpPower;
|
||||
direction.x = (closestEntity.transform.position - transform.position).normalized.x * stats.speed;
|
||||
if ((closestEntity.transform.position.y - transform.position.y > maxHeightDifference || (DetectWalls() && Vector3.Distance(closestEntity.transform.position, transform.position) > minTargetJumpDistance)) && stats.OnGround())
|
||||
{
|
||||
direction.y = stats.jumpPower;
|
||||
}
|
||||
}
|
||||
FlipSprite(direction);
|
||||
stats.rb.linearVelocity = direction;
|
||||
}
|
||||
stats.rb.linearVelocity = direction;
|
||||
}
|
||||
|
||||
public override void OnDeath()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue