和朋友们肝了两天之后深感跑图太慢,于是决定折腾一个传送功能出来,其实本来只想搞传送回家,后来图方便把所有常去的点位都搞上了哈哈哈

一、用dnspy打开AzureValley.dll

"Luma Island\Luma Island_Data\Managed\AzureValley.dll"

和别的Unity游戏不太一样

二、找到PlayerController

img

三、编辑PlayerController

1. 定点传送

        private bool f4pressed;
        private bool f5pressed;

	public void DingdianTeleport()
	{
		if (Keyboard.current.f3Key.wasPressedThisFrame)
		{
			Level farm = GameState.Instance.GetLevel("FarmMap");
			base.GameUI.PlayerGameUI.Player.SetLevel(farm, null, true).Forget();
		}
		if (Keyboard.current.f4Key.wasPressedThisFrame)
		{
			Level town = GameState.Instance.GetLevel("Town");
			if (this.CurrentLevel != town)
			{
				base.GameUI.PlayerGameUI.Player.SetLevel(town, null, true).Forget();
			}
			this.f4pressed = true;
		}
		if (this.f4pressed)
		{
			Level town2 = GameState.Instance.GetLevel("Town");
			if (this.CurrentLevel != town2)
			{
				return;
			}
			this.f4pressed = false;
			base.GameUI.PlayerGameUI.Player.TeleportWithFade(new LevelPosition(new float3(72.83f, 8.26f, 111.7f)), null, 0f);
		}
		if (Keyboard.current.f5Key.wasPressedThisFrame)
		{
			Level forest = GameState.Instance.GetLevel("ForestMap");
			if (this.CurrentLevel != forest)
			{
				base.GameUI.PlayerGameUI.Player.SetLevel(forest, null, true).Forget();
			}
			this.f5pressed = true;
		}
		if (this.f5pressed)
		{
			Level forest2 = GameState.Instance.GetLevel("ForestMap");
			if (this.CurrentLevel != forest2)
			{
				return;
			}
			this.f5pressed = false;
			base.GameUI.PlayerGameUI.Player.TeleportWithFade(new LevelPosition(new float3(55.77f, 13.74f, 104.07f)), null, 0f);
		}
		if (Keyboard.current.f6Key.wasPressedThisFrame)
		{
			Level mountain = GameState.Instance.GetLevel("MountainMap");
			base.GameUI.PlayerGameUI.Player.SetLevel(mountain, null, true).Forget();
		}
		if (Keyboard.current.f7Key.wasPressedThisFrame)
		{
			Level jungle = GameState.Instance.GetLevel("JungleMap");
			if (this.CurrentLevel != jungle)
			{
				base.GameUI.PlayerGameUI.Player.SetLevel(jungle, null, true).Forget();
			}
			this.f7pressed = true;
		}
		if (this.f7pressed)
		{
			Level jungle2 = GameState.Instance.GetLevel("JungleMap");
			if (this.CurrentLevel != jungle2)
			{
				return;
			}
			this.f7pressed = false;
			base.GameUI.PlayerGameUI.Player.TeleportWithFade(new LevelPosition(new float3(135.07f, 1f, 94.87f)), null, 0f);
		}
	}

Note

F3 - 家
F4 - 小镇广场
F5 - 森林洞穴入口
F6 - 山地入口

2. 存点传送

	private float3 cundian9;
	private Level levelf9;
	private bool f9pressed;

	public void CundianTeleport9()
	{
		if (Keyboard.current.backspaceKey.wasPressedThisFrame)
		{
			this.levelf9 = null;
			return;
		}
		if (Keyboard.current.f9Key.wasPressedThisFrame)
		{
			if (this.levelf9 == null)
			{
				float3 postion = base.GameUI.PlayerGameUI.Player.LevelPosition.Position;
				this.cundian9 = postion;
				this.levelf9 = this.CurrentLevel;
				return;
			}
			if (this.CurrentLevel != this.levelf9)
			{
				base.GameUI.PlayerGameUI.Player.SetLevel(this.levelf9, null, true).Forget();
			}
			this.f9pressed = true;
		}
		if (this.f9pressed)
		{
			if (this.CurrentLevel != this.levelf9)
			{
				return;
			}
			this.f9pressed = false;
			base.GameUI.PlayerGameUI.Player.TeleportWithFade(new LevelPosition(this.cundian9), null, 0f);
		}
	}

Note

F9存点,再按F9传送,backspace键清除存点

四、把所有方法加入Update()方法

完成

#增加无敌功能(慎加,影响游戏平衡)

PlayerController类中找到CanBeKilled

改为return false;

img

img

❤️ 转载文章请注明出处,谢谢!❤️