BloodAndGore/Assets/Scripts/Player/PunchingHand.cs
2019-08-14 20:05:16 +03:00

36 lines
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Saltosion.OneWeapon.Enemies;
using Saltosion.OneWeapon.Effects;
using Saltosion.OneWeapon.Environment;
namespace Saltosion.OneWeapon.Player {
public class PunchingHand : MonoBehaviour {
public bool Punching = false;
void Update() {
}
void OnTriggerEnter2D(Collider2D collider) {
if (Punching) {
Punching = false;
Explodable Explodable = collider.GetComponent<Explodable>();
Health Health = collider.GetComponent<Health>();
VendingMachine VendingMachine = collider.GetComponent<VendingMachine>();
Vector2 Direction = (collider.transform.position - transform.position).normalized;
if (Health != null) {
Health.Damage(8f, -Direction);
} else if (VendingMachine != null) {
VendingMachine.ExpelGun();
} else if (Explodable != null) {
Explodable.Explode(true);
}
}
}
}
}