mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-17 01:13:05 +00:00
update dream world spawn animator
This commit is contained in:
parent
ab95b419aa
commit
b1093b162f
@ -35,7 +35,7 @@ internal class EnterDreamWorldMessage : QSBWorldObjectMessage<QSBDreamLanternIte
|
|||||||
player.AssignedSimulationLantern = WorldObject;
|
player.AssignedSimulationLantern = WorldObject;
|
||||||
|
|
||||||
// do the spawn shader
|
// do the spawn shader
|
||||||
player.SetVisible(false, 0);
|
player.SetVisible(false);
|
||||||
player.SetVisible(true, DreamWorldSpawnAnimator.DREAMWORLD_SPAWN_TIME);
|
player.SetVisible(true, DreamWorldSpawnAnimator.DREAMWORLD_SPAWN_TIME);
|
||||||
player.DreamWorldSpawnAnimator.StartSpawnEffect();
|
player.DreamWorldSpawnAnimator.StartSpawnEffect();
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using QSB.Utility;
|
using UnityEngine;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace QSB.PlayerBodySetup.Remote;
|
namespace QSB.PlayerBodySetup.Remote;
|
||||||
|
|
||||||
@ -14,37 +8,22 @@ public class DreamWorldSpawnAnimator : MonoBehaviour
|
|||||||
private Transform _bodyRoot;
|
private Transform _bodyRoot;
|
||||||
|
|
||||||
private float _progression;
|
private float _progression;
|
||||||
private OWRenderer[] _renderers;
|
private Renderer[] _renderers;
|
||||||
private Material _spawnEffectMaterial;
|
private Material _spawnEffectMaterial;
|
||||||
|
|
||||||
public const float DREAMWORLD_SPAWN_TIME = 2f;
|
public const float DREAMWORLD_SPAWN_TIME = 2f;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
_renderers = GetComponentsInChildren<Renderer>(true)
|
_renderers = GetComponentsInChildren<Renderer>(true);
|
||||||
.Select(x => x.gameObject.GetAddComponent<OWRenderer>())
|
|
||||||
.ToArray();
|
|
||||||
enabled = false;
|
enabled = false;
|
||||||
|
|
||||||
foreach (var renderer in _renderers)
|
foreach (var renderer in _renderers)
|
||||||
{
|
{
|
||||||
if (renderer is null)
|
|
||||||
{
|
|
||||||
DebugLog.ToConsole($"Error - A renderer found on {gameObject.name} is null!", OWML.Common.MessageType.Error);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var material in renderer.sharedMaterials)
|
foreach (var material in renderer.sharedMaterials)
|
||||||
{
|
{
|
||||||
if (material is null)
|
if (material == null)
|
||||||
{
|
{
|
||||||
DebugLog.ToConsole($"Error - A material on renderer {renderer.name} is null!", OWML.Common.MessageType.Error);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (material.shader is null)
|
|
||||||
{
|
|
||||||
DebugLog.ToConsole($"Error - The shader on material {material.name}, attached to renderer {renderer.name}, is null!", OWML.Common.MessageType.Error);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +50,7 @@ public class DreamWorldSpawnAnimator : MonoBehaviour
|
|||||||
{
|
{
|
||||||
_spawnEffectMaterial.SetVector("_BodyPosition", _bodyRoot.position);
|
_spawnEffectMaterial.SetVector("_BodyPosition", _bodyRoot.position);
|
||||||
|
|
||||||
_progression = Mathf.MoveTowards(_progression, 4, (4 * Time.deltaTime) / DREAMWORLD_SPAWN_TIME);
|
_progression = Mathf.MoveTowards(_progression, 4, 4 * Time.deltaTime / DREAMWORLD_SPAWN_TIME);
|
||||||
|
|
||||||
if (OWMath.ApproxEquals(_progression, 4))
|
if (OWMath.ApproxEquals(_progression, 4))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user