30 lines
850 B
C#
30 lines
850 B
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
namespace Saltosion.OneWeapon {
|
|||
|
public class PunchingHand : MonoBehaviour {
|
|||
|
|
|||
|
public bool Punching = false;
|
|||
|
|
|||
|
void Update() {
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void OnTriggerEnter2D(Collider2D collider) {
|
|||
|
if (Punching) {
|
|||
|
Punching = false;
|
|||
|
|
|||
|
Explodable Explodable = collider.GetComponent<Explodable>();
|
|||
|
ExplodableHealth Health = collider.GetComponent<ExplodableHealth>();
|
|||
|
Vector2 Direction = (collider.transform.position - transform.position).normalized;
|
|||
|
if (Health != null) {
|
|||
|
Health.Damage(8f, -Direction);
|
|||
|
} else if (Explodable != null) {
|
|||
|
Explodable.Explode(true);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|