mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-03-12 04:14:08 +00:00
Merge pull request #506 from misternebula/eote-dreamworld-entry-exit
EOTE Dreamworld entry shader
This commit is contained in:
commit
2776572ea6
Binary file not shown.
Binary file not shown.
@ -2,6 +2,7 @@
|
|||||||
using QSB.Messaging;
|
using QSB.Messaging;
|
||||||
using QSB.Player;
|
using QSB.Player;
|
||||||
using QSB.Player.TransformSync;
|
using QSB.Player.TransformSync;
|
||||||
|
using QSB.PlayerBodySetup.Remote;
|
||||||
using QSB.WorldSync;
|
using QSB.WorldSync;
|
||||||
|
|
||||||
namespace QSB.EchoesOfTheEye.DreamWorld.Messages;
|
namespace QSB.EchoesOfTheEye.DreamWorld.Messages;
|
||||||
@ -34,5 +35,10 @@ internal class EnterDreamWorldMessage : QSBWorldObjectMessage<QSBDreamLanternIte
|
|||||||
var player = QSBPlayerManager.GetPlayer(From);
|
var player = QSBPlayerManager.GetPlayer(From);
|
||||||
player.InDreamWorld = true;
|
player.InDreamWorld = true;
|
||||||
player.AssignedSimulationLantern = WorldObject;
|
player.AssignedSimulationLantern = WorldObject;
|
||||||
|
|
||||||
|
// do the spawn shader
|
||||||
|
player.SetVisible(false);
|
||||||
|
player.SetVisible(true, DreamWorldSpawnAnimator.DREAMWORLD_SPAWN_TIME);
|
||||||
|
player.DreamWorldSpawnAnimator.StartSpawnEffect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,4 +10,5 @@ public partial class PlayerInfo
|
|||||||
public AnimationSync AnimationSync { get; }
|
public AnimationSync AnimationSync { get; }
|
||||||
public JetpackAccelerationSync JetpackAcceleration { get; set; }
|
public JetpackAccelerationSync JetpackAcceleration { get; set; }
|
||||||
internal QSBDitheringAnimator _ditheringAnimator;
|
internal QSBDitheringAnimator _ditheringAnimator;
|
||||||
|
public DreamWorldSpawnAnimator DreamWorldSpawnAnimator { get; set; }
|
||||||
}
|
}
|
||||||
|
67
QSB/PlayerBodySetup/Remote/DreamWorldSpawnAnimator.cs
Normal file
67
QSB/PlayerBodySetup/Remote/DreamWorldSpawnAnimator.cs
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace QSB.PlayerBodySetup.Remote;
|
||||||
|
|
||||||
|
public class DreamWorldSpawnAnimator : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField]
|
||||||
|
private Transform _bodyRoot;
|
||||||
|
|
||||||
|
private float _progression;
|
||||||
|
private Material _spawnEffectMaterial;
|
||||||
|
|
||||||
|
public const float DREAMWORLD_SPAWN_TIME = 2f;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
enabled = false;
|
||||||
|
|
||||||
|
_spawnEffectMaterial = GetSpawnMaterial();
|
||||||
|
_spawnEffectMaterial.SetFloat("_Enabled", 0f);
|
||||||
|
_spawnEffectMaterial.SetFloat("_Progression", 0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Material GetSpawnMaterial()
|
||||||
|
{
|
||||||
|
foreach (var renderer in GetComponentsInChildren<Renderer>(true))
|
||||||
|
{
|
||||||
|
foreach (var material in renderer.sharedMaterials)
|
||||||
|
{
|
||||||
|
if (material == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (material.shader.name == "DreamWorldSpawnEffect")
|
||||||
|
{
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartSpawnEffect()
|
||||||
|
{
|
||||||
|
_progression = 0;
|
||||||
|
_spawnEffectMaterial.SetFloat("_Enabled", 1f);
|
||||||
|
enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
_spawnEffectMaterial.SetVector("_BodyPosition", _bodyRoot.position);
|
||||||
|
|
||||||
|
_progression = Mathf.MoveTowards(_progression, 4, 4 * Time.deltaTime / DREAMWORLD_SPAWN_TIME);
|
||||||
|
|
||||||
|
if (OWMath.ApproxEquals(_progression, 4))
|
||||||
|
{
|
||||||
|
_progression = 4;
|
||||||
|
_spawnEffectMaterial.SetFloat("_Enabled", 0f);
|
||||||
|
enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_spawnEffectMaterial.SetFloat("_Progression", _progression);
|
||||||
|
}
|
||||||
|
}
|
@ -61,6 +61,7 @@ public static class RemotePlayerCreation
|
|||||||
REMOTE_Player_Body.GetComponent<PlayerHUDMarker>().Init(player);
|
REMOTE_Player_Body.GetComponent<PlayerHUDMarker>().Init(player);
|
||||||
REMOTE_Player_Body.GetComponent<PlayerMapMarker>().PlayerName = player.Name;
|
REMOTE_Player_Body.GetComponent<PlayerMapMarker>().PlayerName = player.Name;
|
||||||
player._ditheringAnimator = REMOTE_Player_Body.GetComponent<QSBDitheringAnimator>();
|
player._ditheringAnimator = REMOTE_Player_Body.GetComponent<QSBDitheringAnimator>();
|
||||||
|
player.DreamWorldSpawnAnimator = REMOTE_Player_Body.GetComponent<DreamWorldSpawnAnimator>();
|
||||||
player.AudioController = REMOTE_Player_Body.transform.Find("REMOTE_Audio_Player").GetComponent<QSBPlayerAudioController>();
|
player.AudioController = REMOTE_Player_Body.transform.Find("REMOTE_Audio_Player").GetComponent<QSBPlayerAudioController>();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -21,8 +21,14 @@ public static class ShaderReplacer
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
material.shader = Shader.Find(material.shader.name);
|
var replacementShader = Shader.Find(material.shader.name);
|
||||||
|
if (replacementShader == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
material.shader = replacementShader;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user