Roman ab6cfd79a0 任务:搭建场景
1.添加场景1查看绳结仓颉动画
(*:为玩家基类添加功能,public void StopInputUntil(float time);表示接下来多长时间内,无视输入事件。

2.适配了播片系统

3.编写演出:凤凰

好像不能摸鱼了,明天不知道写什么,下班了喵😿
2022-04-02 21:46:10 +08:00

43 lines
1.4 KiB
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;
/// <summary>
/// 进入式触发器的基类,继承自事件,每一个进入式触发器都必须继承这个类
/// </summary>
public class EntryTrigger : Event
{
private Collider2D m_collider;
public Event m_event;
public Stage m_stage;
void Start()
{
//如果没有挂载碰撞盒,则报错
if(!TryGetComponent<Collider2D>(out m_collider))
{
Debug.LogError(this.GetType() + gameObject.name + "没有挂载碰撞盒,请检查!");
}
//如果不是触发器,则报错
if(!m_collider.isTrigger)
{
Debug.LogError(this.GetType() + gameObject.name + "碰撞盒没有设置为触发器,请检查!");
}
}
virtual public void OnTriggerEnter2D(Collider2D other)
{
//如果玩家进入碰撞盒则触发事件
if(other.TryGetComponent<Player>(out Player player)) OnCall();
}
public override void OnCall()
{
//如果链接了事件或者演出,则执行
if(m_event != null) m_event.OnCall();
if(m_stage != null) m_stage.OnCall();
//如果二者都为null则报告
if(m_event == null && m_stage == null) Debug.Log(this.GetType() + gameObject.name + "没有链接事件或者演出,你确定吗?");
}
}