
(*.具有状态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并触发
95 lines
2.3 KiB
C#
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
|
|
);
|
|
}
|
|
);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|