CangJie/Assets/Scripts//Thunder.cs
lspdC d5836fec13 3.21(未合并)
完成火焰,碎石交互,武器升级替换。
设置好打雷演出框架,自动追击的雷击框架,尚未加入碰撞判定。
2022-03-21 19:49:15 +08:00

42 lines
853 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;
void Start()
{
}
void Update()
{
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.TryGetComponent<Player>(out player)&&haveInteracted == false) {
StopPlayerInput();
Debug.Log("播打雷动画");
Invoke(nameof(ResetPlayerInput),interactTime);
haveInteracted = true;
}
else
Debug.Log("未能监测到Player请检查脑子是否有问题");
}
public void StopPlayerInput() {
player.ToMap("Null");
}
public void ResetPlayerInput() {
player.ToMap("Normal");
}
}