more abilities and fixes
This commit is contained in:
parent
cb4470f2d6
commit
fc2329a873
31 changed files with 268 additions and 52 deletions
30
Assets/Scripts/Entities/Player.cs
Normal file
30
Assets/Scripts/Entities/Player.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using Core.Extensions;
|
||||
using UnityEngine;
|
||||
|
||||
public class Player : Entity
|
||||
{
|
||||
[SerializeField] private Camera cam;
|
||||
private void Update()
|
||||
{
|
||||
stats.attackOriginCenter.Lookat2D(cam.ScreenToWorldPoint(Input.mousePosition));
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
stats.abilities[0].TryAbility();
|
||||
}
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (!stats.isStalled)
|
||||
{
|
||||
Vector2 movement = new Vector2(Input.GetAxis("Horizontal") * stats.speed, stats.rb.linearVelocityY);
|
||||
if (Input.GetKeyDown(KeyCode.Space) && stats.OnGround())
|
||||
{
|
||||
movement.y = stats.jumpPower;
|
||||
}
|
||||
FlipSprite(movement);
|
||||
stats.rb.linearVelocity = movement;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue