CangJie/Assets/Scripts//Thunder.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

44 lines
947 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Thunder : MonoBehaviour
{
Player player;
float interactTime = 2f;
bool haveInteracted = false;
Animator anim;
void Start()
{
anim = GetComponent<Animator>();
}
void Update()
{
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.TryGetComponent<Player>(out player)&&haveInteracted == false) {
StopPlayerInput();
Debug.Log("播打雷动画");
anim.SetTrigger("Active");
Invoke(nameof(ResetPlayerInput),interactTime);
haveInteracted = true;
}
else
Debug.Log("未能监测到Player请检查脑子是否有问题");
}
public void StopPlayerInput() {
player.ToMap("Null");
}
public void ResetPlayerInput() {
player.ToMap("Normal");
}
}