2022-03-21 19:49:15 +08:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class ThunderAtk : MonoBehaviour
|
|
|
|
{
|
|
|
|
public Player player;
|
|
|
|
public ThunderController controller;
|
2022-03-22 22:15:12 +08:00
|
|
|
bool ifHit = false;
|
|
|
|
HittenStone stone;
|
2022-03-21 19:49:15 +08:00
|
|
|
void Start()
|
|
|
|
{
|
2022-03-22 22:15:12 +08:00
|
|
|
player = (Player)GameObject.FindObjectOfType(typeof(Player));
|
|
|
|
controller = (ThunderController)GameObject.FindObjectOfType(typeof(ThunderController));
|
|
|
|
stone = (HittenStone)GameObject.FindObjectOfType(typeof(HittenStone));
|
|
|
|
Debug.Log(stone.name);
|
2022-03-21 19:49:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void LightAtk() {
|
2022-03-22 22:15:12 +08:00
|
|
|
//Debug.Log("打雷咯");
|
2022-03-21 19:49:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public void DesTroyThunder() {
|
|
|
|
Destroy(gameObject);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Next() {
|
|
|
|
controller.NextLightAtk();
|
|
|
|
}
|
2022-03-22 22:15:12 +08:00
|
|
|
|
|
|
|
private void OnTriggerEnter2D(Collider2D collision)
|
|
|
|
{
|
|
|
|
if (collision.TryGetComponent<HittenStone>(out stone)) {
|
|
|
|
Debug.Log("打到石头了");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (collision.TryGetComponent<Player>(out player)&&ifHit == false) {
|
|
|
|
ifHit = true;
|
|
|
|
|
|
|
|
player.GetHurt(1,0.5f,transform.position.x);
|
|
|
|
Debug.Log("被雷打");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-03-21 19:49:15 +08:00
|
|
|
}
|