Roman 74f926815e 任务:搭建前置关卡,编写演出逻辑
1.编写基督前置关卡
(1.放置平台、怪物和男童
(2.修改男童类,外加OnSaveEvent,OnSave时若有事件则触发该Event
(3.编写开幕演出,与yi前置类似
(4.编写男童解救演出
((1.触发Fungus对话
((2.对话结束后,开启通往上层的门

2.搭建村场景
(1.放置平台和元素
(2.为可动元素制作动画

3.为玩家添加static属性,进度。0:刚开,1进村,2通佛,3通伊,4.通基

4.制作死亡重开功能
(1.当玩家生命值降到0及以下,触发死亡事件
(2.死亡后reload当前场景,并设记录员,关闭某些事件和演出不再执行

*优化和修复
(1.尝试制作击中卡肉效果,目前打击感太弱。也可以尝试粒子效果

*至此,全部前置关卡搭建完毕,村场景搭建完毕。
*明天可以完成流程化,接下来就是填充剧情、UI、死亡标记和留言板等系统了

下班
2021-12-20 23:33:14 +08:00

200 lines
6.4 KiB
C#
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// This code is part of the Fungus library (https://github.com/snozbot/fungus)
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
namespace Fungus
{
/// <summary>
/// Supported modes for clicking through a Say Dialog.
/// </summary>
public enum ClickMode
{
/// <summary> Clicking disabled. </summary>
Disabled,
/// <summary> Click anywhere on screen to advance. </summary>
ClickAnywhere,
/// <summary> Click anywhere on Say Dialog to advance. </summary>
ClickOnDialog,
/// <summary> Click on continue button to advance. </summary>
ClickOnButton,
/// <summary> 自创方式,用就完了 </summary>
ClickAsMySelf
}
/// <summary>
/// Input handler for say dialogs.
/// </summary>
public class DialogInput : MonoBehaviour
{
[Tooltip("Click to advance story")]
[SerializeField] protected ClickMode clickMode;
[Tooltip("Delay between consecutive clicks. Useful to prevent accidentally clicking through story.")]
[SerializeField] protected float nextClickDelay = 0f;
[Tooltip("Allow holding Cancel to fast forward text")]
[SerializeField] protected bool cancelEnabled = true;
[Tooltip("Ignore input if a Menu dialog is currently active")]
[SerializeField] protected bool ignoreMenuClicks = true;
protected bool dialogClickedFlag;
protected bool nextLineInputFlag;
protected float ignoreClickTimer;
protected StandaloneInputModule currentStandaloneInputModule;
protected Writer writer;
protected virtual void Awake()
{
writer = GetComponent<Writer>();
CheckEventSystem();
}
// There must be an Event System in the scene for Say and Menu input to work.
// This method will automatically instantiate one if none exists.
protected virtual void CheckEventSystem()
{
EventSystem eventSystem = GameObject.FindObjectOfType<EventSystem>();
if (eventSystem == null)
{
// Auto spawn an Event System from the prefab
GameObject prefab = Resources.Load<GameObject>("Prefabs/EventSystem");
if (prefab != null)
{
GameObject go = Instantiate(prefab) as GameObject;
go.name = "EventSystem";
}
}
}
protected virtual void Update()
{
if (EventSystem.current == null)
{
return;
}
if (currentStandaloneInputModule == null)
{
currentStandaloneInputModule = EventSystem.current.GetComponent<StandaloneInputModule>();
}
if (writer != null && writer.IsWriting)
{
// if (Input.GetButtonDown(currentStandaloneInputModule.submitButton) ||
// (cancelEnabled && Input.GetButton(currentStandaloneInputModule.cancelButton)))
// {
// SetNextLineFlag();
// }
}
switch (clickMode)
{
case ClickMode.Disabled:
break;
case ClickMode.ClickAnywhere:
if (Input.GetMouseButtonDown(0))
{
SetNextLineFlag();
}
break;
case ClickMode.ClickOnDialog:
if (dialogClickedFlag)
{
SetNextLineFlag();
dialogClickedFlag = false;
}
break;
//私改插件,法力无边🥵🥵🥵🥵🥵🥵🥵🥵
case ClickMode.ClickAsMySelf:
if(Input.GetKeyDown(KeyCode.J) || (Gamepad.current != null) && Gamepad.current.aButton.wasPressedThisFrame)
{
SetNextLineFlag();
}
break;
//
}
if (ignoreClickTimer > 0f)
{
ignoreClickTimer = Mathf.Max (ignoreClickTimer - Time.deltaTime, 0f);
}
if (ignoreMenuClicks)
{
// Ignore input events if a Menu is being displayed
if (MenuDialog.ActiveMenuDialog != null &&
MenuDialog.ActiveMenuDialog.IsActive() &&
MenuDialog.ActiveMenuDialog.DisplayedOptionsCount > 0)
{
dialogClickedFlag = false;
nextLineInputFlag = false;
}
}
// Tell any listeners to move to the next line
if (nextLineInputFlag)
{
var inputListeners = gameObject.GetComponentsInChildren<IDialogInputListener>();
for (int i = 0; i < inputListeners.Length; i++)
{
var inputListener = inputListeners[i];
inputListener.OnNextLineEvent();
}
nextLineInputFlag = false;
}
}
#region Public members
/// <summary>
/// Trigger next line input event from script.
/// </summary>
public virtual void SetNextLineFlag()
{
nextLineInputFlag = true;
}
/// <summary>
/// Set the dialog clicked flag (usually from an Event Trigger component in the dialog UI).
/// </summary>
public virtual void SetDialogClickedFlag()
{
// Ignore repeat clicks for a short time to prevent accidentally clicking through the character dialogue
if (ignoreClickTimer > 0f)
{
return;
}
ignoreClickTimer = nextClickDelay;
// Only applies in Click On Dialog mode
if (clickMode == ClickMode.ClickOnDialog)
{
dialogClickedFlag = true;
}
}
/// <summary>
/// Sets the button clicked flag.
/// </summary>
public virtual void SetButtonClickedFlag()
{
// Only applies if clicking is not disabled
if (clickMode != ClickMode.Disabled)
{
SetNextLineFlag();
}
}
#endregion
}
}