we used to KILL people WITH HAMMERS for saying things like that
This commit is contained in:
parent
17b1a1e367
commit
daf3218043
8 changed files with 235 additions and 54 deletions
|
|
@ -146,7 +146,8 @@ public class ActionUIHandler : MonoBehaviour
|
|||
public void SelectWeapon(Weapon weaponSelected)
|
||||
{
|
||||
MoveAction();
|
||||
selectedEntity.currentWeapon = weaponSelected;
|
||||
selectedEntity.SwitchWeapon(weaponSelected);
|
||||
HideWeaponList();
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,48 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Core.Extensions;
|
||||
using UnityEngine;
|
||||
|
||||
public class MeleeWeapon : Weapon
|
||||
{
|
||||
|
||||
public LayerMask entityLayer;
|
||||
[SerializeField] private GameObject debugColliderHitbox;
|
||||
[SerializeField] private Vector2 colliderSize;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (isAiming)
|
||||
{
|
||||
Vector2 mouseWorldPos = PlayerEntityMovement.instance.mouseWorldPos; //using this so i don't have to paste in and recalculate the variable on something i already have lol
|
||||
debugColliderHitbox.gameObject.SetActive(true);
|
||||
transform.Lookat2D(mouseWorldPos);
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
RaycastHit2D[] enemyList = Physics2D.BoxCastAll(transform.position, colliderSize, Vector3.Angle(transform.position, mouseWorldPos),
|
||||
PlayerEntityMovement.instance.mouseWorldPos, 100f, entityLayer);
|
||||
foreach (RaycastHit2D enemy in enemyList)
|
||||
{
|
||||
if (!enemy.transform.CompareTag(tag) && enemy.transform.TryGetComponent(out Entity isEntity))
|
||||
{
|
||||
isEntity.TakeDamage(damage);
|
||||
}
|
||||
}
|
||||
isAiming = false;
|
||||
thisEntity.hasAttacked = true;
|
||||
TurnHandler.instance.UpdateTurns();
|
||||
ActionUIHandler.instance.UpdateUI();
|
||||
debugColliderHitbox.gameObject.SetActive(false);
|
||||
}
|
||||
else if (Input.GetMouseButtonDown(1))
|
||||
{
|
||||
isAiming = false;
|
||||
debugColliderHitbox.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void AttackEffects()
|
||||
{
|
||||
|
||||
isAiming = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public class PlayerEntityMovement : MonoBehaviour
|
|||
public GameObject templateObject;
|
||||
public bool isMoving;
|
||||
|
||||
private Vector3 mouseWorldPos;
|
||||
[HideInInspector] public Vector3 mouseWorldPos;
|
||||
private Vector3 mouseGridPos;
|
||||
private Camera cam;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue