CangJie/Assets/Scripts//ThunderAtk.cs
Roman cb9a50f183 Squashed commit of the following:
commit c9c9ab412170ffd32a12b0660858625856aa3244
Author: lspdC <961907320@qq.com>
Date:   Thu Mar 24 22:11:29 2022 +0800

    3.24
    完成除boss战以外交互,逐步整合美术素材

commit 2a2a11e8514ab67008c85b25b6703888f1ed8824
Author: lspdC <961907320@qq.com>
Date:   Tue Mar 22 22:15:12 2022 +0800

    3.22
    完成了跟踪雷击与玩家的碰撞判定,玩家的受击反馈
    击碎石头那边还有bug,明天再改

commit db3134349aaabb0ba0aaa64e43851ee0d6812fa0
Author: lspdC <961907320@qq.com>
Date:   Mon Mar 21 19:51:46 2022 +0800

    3.21(和霄酱搅在一起了喵)

commit d5836fec13668bd6a00ab8e9377f3959d86ab037
Author: lspdC <961907320@qq.com>
Date:   Mon Mar 21 19:49:15 2022 +0800

    3.21(未合并)
    完成火焰,碎石交互,武器升级替换。
    设置好打雷演出框架,自动追击的雷击框架,尚未加入碰撞判定。

commit 698339a63c5ad608945a2e5702b7b216c97245c3
Author: lspdC <961907320@qq.com>
Date:   Sun Mar 20 23:28:11 2022 +0800

    3.20 和京力交融之后的版本

commit 44c4946a717cd915dae1c92cb536031abf2f9343
Author: lspdC <961907320@qq.com>
Date:   Sun Mar 20 23:24:29 2022 +0800

    3.20
    整理了树木交互,写了个具体互动物品的基类。
    创建了火类,实现火焰交互示意(拿上木棍才能成功交互)。

commit 1b5d15c2d2c98a71d12a79c9443d9cf4c89c7f40
Author: lspdC <961907320@qq.com>
Date:   Sun Mar 20 14:43:08 2022 +0800

    sb coding
2022-03-25 19:50:39 +08:00

59 lines
1.3 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ThunderAtk : MonoBehaviour
{
public Player player;
public ThunderController controller;
bool ifHit = false;
bool ifFinal = false;
void Start()
{
player = (Player)GameObject.FindObjectOfType(typeof(Player));
controller = (ThunderController)GameObject.FindObjectOfType(typeof(ThunderController));
}
// Update is called once per frame
void Update()
{
}
public void LightAtk() {
//Debug.Log("打雷咯");
}
public void DesTroyThunder() {
Destroy(gameObject);
}
public void Next() {
if(ifFinal==false)
controller.NextLightAtk();
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.TryGetComponent<HittenStone>(out HittenStone stone)) {
Debug.Log("播放石头爆炸特效,停止打雷");
Destroy(stone.gameObject);
controller.gameObject.SetActive(false);
ifFinal = true;
}
if (collision.TryGetComponent<Player>(out player)&&ifHit == false) {
ifHit = true;
player.GetHurt(1,0.5f,transform.position.x);
Debug.Log("被雷打");
}
}
}