Roman f936d7f799 *.编写黑块逻辑
(*.具有状态in、all、out
(1.当被呼出,执行呼出事件
((1.分type执行“入”的Tween动画
((2.入动画结束后,修改自身状态至all
((3.等待一定的加载时间后,修改自身状态为out,并开始出动画
((4.出动画结束后,找到“开幕演出”游戏物体,找到它的Stage并触发
((5.完成善后工作,将块移回原来的位置

1.制作转场
(1.触发转移
(2.关闭操作地图
(4.令玩家一直向右移动
(3.呼出黑块
(4.等待、直到黑块进入全覆盖状态
(5.根据字典经行场景转移
(6.黑块内部协程级时结束后,揭开黑幕
(7.揭开动画结束后
(8.找到“开幕演出”游戏物体,找到它的Stage并触发
2021-12-22 11:17:21 +08:00

95 lines
2.3 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using Sirenix.OdinInspector;
using UnityEngine.InputSystem;
/// <summary>
/// 控制转场黑块
/// </summary>
public class Blcak : MonoBehaviour
{
public enum State{, , , }
/// <summary>
/// 黑块的目前运行状态
/// </summary>
[Header("状态")][ReadOnly]
public State state;
public enum Type{, }
[Header("类型")]
public Type tyepe;
private RectTransform rectTransform;
void Start(){
Init();
}
private void Init(){
rectTransform = GetComponent<RectTransform>();
state = State.;
}
public void OnCall(Type type){
StartCoroutine(Perform(type));
}
private IEnumerator Perform(Type type){
//修改状态
state = State.;
//执行“入”的Tween动画
if(type == Type.){
Tweener tweener = rectTransform.DOLocalMoveX(
0,
1f
).OnStepComplete(
() => {
state = State.;
}
);
}
if(type == Type.){
Tweener tweener = rectTransform.DOLocalMoveY(
0,
1f
).OnStepComplete(
() => {
state = State.;
}
);
}
yield return new WaitForSeconds(2f);
//执行“出”的Tween动画
state = State.;
if(type == Type.){
Tweener tweener = rectTransform.DOLocalMoveX(
-3358,
1f
).OnStepComplete(
() =>{
//恢复黑块位置
rectTransform.localPosition = new Vector3(
3320,-6,0
);
}
);
}
if(type == Type.){
Tweener tweener = rectTransform.DOLocalMoveY(
2723,
1f
).OnStepComplete(
() =>{
//恢复黑块位置
rectTransform.localPosition = new Vector3(
0,-2722,0
);
}
);
}
}
}