Roman bdc5f829d3 任务:搭建第二关的框架
场景【测试】
1.完成了巡逻敌人的所有功能,把它保存为预制体。
2.编写修理台功能
(1.呼出功能:当玩家走到修理台旁边,按下交互键则弹出修理界面,同时玩家不能走动,只能用交互键操控修理机器或者按B键暂时退出
(2.判定功能:使得指针内记录一个变量,当处于判定区内时,判定为真,否则为假
(3.交互确认功能:当玩家按下交互键,执行一次判定,判定后指针停止转动若干秒,并确认判定结果。若成功,,检查一下是否所有区域都已修复,若还有区域未修复,重新布置一次成功区,使其角度为一随机数,若所有区域已经修复,退出修复界面,留下事件接口等待编写事件。若失败,若干秒后指针重新转动。
(完

至此,游戏系统基本已经开发完全,明天开始替换美术素材、完成关卡的流程化等。加油吧,加油了吗?
2021-08-25 02:21:59 +08:00

41 lines
1.6 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;
using UnityEngine.UI;
public class Interactive : MonoBehaviour
{
//这是所有可交互物体的基类
public GameObject m_interface;//可交互物体一般都和一个UI界面挂钩这就是那个UI界面
//这是一对碰撞检测代码。当玩家进入将自身传给玩家。当玩家退出把玩家的catch清空
void OnTriggerEnter2D(Collider2D other)
{
if(other.tag == "Player")
{
other.GetComponent<M_Player>().catched = this;
}
}
void OnTriggerExit2D(Collider2D other)
{
if(other.tag == "Player")
{
//如果目前退出当前交互区域的时候,玩家的捕捉物体是自己,才把玩家的捕捉清空。否则说明玩家在推出前就捕捉到了新的
//对象。这样是用来解决排布密集的可交互物体的问题
if(other.GetComponent<M_Player>().catched == this) other.GetComponent<M_Player>().catched = null;
}
}
//
//当这个可交互物体被玩家交互。一般需要重写这个函数。
public virtual void OnCall(){}
//
//以下为针对各具体可交互对象的虚拟函数,在具体物体中重写
public virtual void Coding(string temp){}//电报机的打码
public virtual void StopRepareTheTelephoneLine(){}//电话线的停止修复(松开按键检测
public virtual void Quit(){}//任务书的关闭
public virtual void Comfirm(){}//修复电报机界面按下交互键触发
//
}