Files
Pal3.Unity/Assets/Scripts/Pal3.Game/Effect/PortalEffect.cs
Jiaqi (0x7c13) Liu e870cf487a Add core protocol regression tests and copyright checks
Cover SCE command contracts, binary readers, resource layouts and full local CPK decompression for PAL3 and PAL3A. Fix CVD time rebasing, binary read bounds and short reads, and CPK/NAV validation.

Standardize first-party copyright headers, preserve correct creation years, and update console source generation. Validate both variants in Unity and verify all live CPK entries.
2026-11-12 13:37:27 +08:00

61 lines
1.9 KiB
C#

// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
namespace Pal3.Game.Effect
{
using System;
using Data;
using Engine.Core.Implementation;
using Engine.Extensions;
using Vector3 = UnityEngine.Vector3;
public sealed class PortalEffect : GameEntityScript, IEffect
{
#if PAL3
private const string PORTAL_BASE_TEXTURE_NAME = "trans.dds";
#elif PAL3A
private const string PORTAL_BASE_TEXTURE_NAME = "trans.tga";
#endif
private const float PORTAL_DEFAULT_SIZE = 1.3f;
private const float PORTAL_ANIMATION_ROTATION_SPEED = 5f;
private const int PORTAL_RAY_EFFECT_ID = 0;
private RotatingSpriteEffect _baseEffect;
private IDisposable _rayEffect;
protected override void OnDisableGameEntity()
{
Dispose();
}
public void Init(GameResourceProvider resourceProvider, uint _)
{
_baseEffect = GameEntity.AddComponent<RotatingSpriteEffect>();
_baseEffect.Init(resourceProvider,
PORTAL_BASE_TEXTURE_NAME,
new Vector3(PORTAL_DEFAULT_SIZE, PORTAL_DEFAULT_SIZE, PORTAL_DEFAULT_SIZE),
PORTAL_ANIMATION_ROTATION_SPEED);
_rayEffect = resourceProvider.OptionalVfx.Attach(PORTAL_RAY_EFFECT_ID, GameEntity);
}
private void OnDestroy() => Dispose();
public void Dispose()
{
if (_baseEffect != null)
{
_baseEffect.Dispose();
_baseEffect.Destroy();
_baseEffect = null;
}
_rayEffect?.Dispose();
_rayEffect = null;
}
}
}