2021-12-21 00:45:50 +08:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using DG.Tweening;
|
|
|
|
using Sirenix.OdinInspector;
|
|
|
|
using UnityEngine.SceneManagement;
|
2021-12-22 11:17:21 +08:00
|
|
|
using UnityEngine.InputSystem;
|
2021-12-21 00:45:50 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 直译转移,控制玩家在关卡间的切换
|
|
|
|
/// </summary>
|
|
|
|
public class Transfer : EntryTrigger
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// 对应进度和场景名称
|
|
|
|
/// </summary>
|
2021-12-22 11:17:21 +08:00
|
|
|
[DictionaryDrawerSettings][ShowInInspector][ReadOnly]
|
2021-12-21 00:45:50 +08:00
|
|
|
public static Dictionary<MyPlayer.Progress, string> proToScene;
|
|
|
|
|
2021-12-22 11:17:21 +08:00
|
|
|
private MyPlayer player;
|
|
|
|
[Header("水平黑块")]
|
|
|
|
public Blcak blcakHori;
|
|
|
|
[Header("竖直黑块")]
|
|
|
|
public Blcak blcakVert;
|
|
|
|
public Blcak.Type transType;
|
|
|
|
|
2021-12-21 00:45:50 +08:00
|
|
|
void Start(){
|
|
|
|
proToScene = new Dictionary<MyPlayer.Progress, string>();
|
|
|
|
//将场景连成线
|
2021-12-22 11:17:21 +08:00
|
|
|
proToScene.Add(MyPlayer.Progress.刚开,"Fo");
|
2021-12-21 00:45:50 +08:00
|
|
|
proToScene.Add(MyPlayer.Progress.通Fo,"DiZangStageTest");
|
|
|
|
proToScene.Add(MyPlayer.Progress.通佛,"cun");
|
|
|
|
proToScene.Add(MyPlayer.Progress.过佛,"Yi");
|
|
|
|
proToScene.Add(MyPlayer.Progress.通Yi,"TeLuoYiStageTest");
|
|
|
|
proToScene.Add(MyPlayer.Progress.通伊,"cun");
|
|
|
|
proToScene.Add(MyPlayer.Progress.过伊,"Ji");
|
|
|
|
proToScene.Add(MyPlayer.Progress.通Ji,"YiSaStageTest");
|
|
|
|
proToScene.Add(MyPlayer.Progress.通基,"cun");
|
|
|
|
proToScene.Add(MyPlayer.Progress.过基,"cun");
|
2021-12-22 11:17:21 +08:00
|
|
|
//找到必要的游戏物体和组件
|
|
|
|
player = FindObjectOfType<MyPlayer>();
|
2021-12-21 00:45:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void OnCall(){
|
2021-12-22 11:17:21 +08:00
|
|
|
//关闭操作地图
|
|
|
|
player.GetComponent<PlayerInput>().SwitchCurrentActionMap("NullMap");
|
|
|
|
//令玩家一直向右移动
|
|
|
|
player.inputDir = 1;
|
|
|
|
//呼出黑块
|
|
|
|
if(transType == Blcak.Type.水平) blcakHori.OnCall(transType);
|
|
|
|
if(transType == Blcak.Type.竖直) blcakVert.OnCall(transType);
|
|
|
|
//
|
|
|
|
//SceneManager.LoadScene(proToScene[MyPlayer.progress]);
|
2021-12-21 00:45:50 +08:00
|
|
|
}
|
|
|
|
}
|