moved stuff to a different entity script
This commit is contained in:
parent
f4344c4700
commit
a0bfc600ef
14 changed files with 497 additions and 189 deletions
|
|
@ -7,16 +7,20 @@ public class Player : Entity
|
|||
[SerializeField] private Camera cam;
|
||||
private void Update()
|
||||
{
|
||||
attackOriginCenter.Lookat2D(cam.ScreenToWorldPoint(Input.mousePosition));
|
||||
stats.attackOriginCenter.Lookat2D(cam.ScreenToWorldPoint(Input.mousePosition));
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
stats.abilities[0].TryAbility();
|
||||
}
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
Vector2 movement = new Vector2(Input.GetAxis("Horizontal") * speed, rb.linearVelocityY);
|
||||
if (Input.GetKeyDown(KeyCode.Space) && OnGround())
|
||||
Vector2 movement = new Vector2(Input.GetAxis("Horizontal") * stats.speed, stats.rb.linearVelocityY);
|
||||
if (Input.GetKeyDown(KeyCode.Space) && stats.OnGround())
|
||||
{
|
||||
movement.y = jumpPower;
|
||||
movement.y = stats.jumpPower;
|
||||
}
|
||||
rb.linearVelocity = movement;
|
||||
stats.rb.linearVelocity = movement;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue