SAIMA/Assets//脚本/ActionController.cs
Roman cab00851df 短学期Log
任务:替换和实装美术素材
1.在教程场景布置图标和文字提示内容
DONE
2.制作GamePlay中背景元素的动画并实装
DONE
3.替换拆迁障碍物美术素材
DONE

任务:实装音乐和音效
1.为两个场景添加音乐,并且在GamePlay场景不重开音乐。
DONE
2.实装人摔地音效
DONE
3.实装人跑动音效
DONE
4.实装人马分离音效
DONE
5.实装创烂障碍物音效
DOING
6.实装圣火点燃音效
7.实装马磕磕碰碰音效
8.实装马似音效
9.实装马着地音效
10.实装马起跳音效

任务:实装特效
……

任务:完善没写的零散逻辑
1.在教程场景,若人马分离障碍处没接到人,过一个转场然后复位人和马
**:仍然存在问题,当如此,人的动画失效。这个问题现在不好修,等待人的死亡动画实装后再修
WAIT
2.在教程场景,点燃圣火仅有进入触发器后加载转场然后转移场景的功能,没有点燃圣火的过程,现补充其逻辑
DONE
3.开发GamePlay距离记录和重开系统
……

修复Bug
1.在教程场景,可破坏障碍物的碎片的层级不对,创烂瞬间会有层级突变的问题。在GamePlay层级,也出现了这个问题。
2.现在的高障碍实在太高了,基本有80%以上的概率导致马翻,应该调低障碍物、或者调大马的跳跃力度。
2022-08-27 02:51:21 +08:00

68 lines
1.3 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Reflection;
public class ActionController : MonoBehaviour
{
public static ActionController Instance;
private void Awake()
{
Instance = this;
}
//延时事件流
public static Dictionary<Action, float> actionDic = new Dictionary<Action, float>();
public void RigisterAction(Action action, float time)
{
actionDic.Add(action, time);
}
public void ClearActions()
{
actionDic.Clear();
}
public void CallActions()
{
List<Action> theActionList = new List<Action>(actionDic.Keys);
List<float> theTimeList = new List<float>(actionDic.Values);
theActionList[0]();
for (int i = 1; i < theActionList.Count; i++)
{
StartCoroutine(DelayToCallIEnumerator(theActionList[i], Sum(theTimeList, i - 1)));
}
}
public void CallActions(bool IsClear)
{
CallActions();
if (IsClear)
{
ClearActions();
}
}
float Sum(List<float> list, int index)
{
float x = 0;
for (int i = 0; i < list.Count; i++)
{
if (i <= index)
{
x += list[i];
}
}
return x;
}
public void DelayToCall(Action action, float time)
{
StartCoroutine(DelayToCallIEnumerator(action, time));
}
private IEnumerator DelayToCallIEnumerator(Action action, float time)
{
yield return new WaitForSeconds(time);
action();
}
}