mirror of
https://github.com/0x7c13/Pal3.Unity.git
synced 2026-11-26 17:38:10 +08:00
54 lines
1.7 KiB
C#
54 lines
1.7 KiB
C#
// ---------------------------------------------------------------------------------------------
|
|
// Copyright (c) 2021-2024, Jiaqi (0x7c13) Liu. All rights reserved.
|
|
// See LICENSE file in the project root for license information.
|
|
// ---------------------------------------------------------------------------------------------
|
|
|
|
#if PAL3A
|
|
|
|
namespace Pal3.Game.Scene.SceneObjects
|
|
{
|
|
using System;
|
|
using System.Collections;
|
|
using Common;
|
|
using Core.Contract.Enums;
|
|
using Core.DataReader.Scn;
|
|
using Engine.Animation;
|
|
using Engine.Core.Abstraction;
|
|
|
|
using Vector3 = UnityEngine.Vector3;
|
|
|
|
[ScnSceneObject(SceneObjectType.WaterSurface)]
|
|
public sealed class WaterSurfaceObject : SceneObject
|
|
{
|
|
private const float WATER_ANIMATION_DURATION = 3f;
|
|
private const float WATER_DESCEND_HEIGHT = 4f;
|
|
|
|
public WaterSurfaceObject(ScnObjectInfo objectInfo, ScnSceneInfo sceneInfo)
|
|
: base(objectInfo, sceneInfo)
|
|
{
|
|
}
|
|
|
|
public override bool IsDirectlyInteractable(float distance) => false;
|
|
|
|
public override bool ShouldGoToCutsceneWhenInteractionStarted() => true;
|
|
|
|
public override IEnumerator InteractAsync(InteractionContext ctx)
|
|
{
|
|
if (!IsInteractableBasedOnTimesCount()) yield break;
|
|
|
|
PlaySfxIfAny();
|
|
|
|
ITransform transform = GetGameEntity().Transform;
|
|
Vector3 finalPosition = transform.Position;
|
|
finalPosition += new Vector3(0f, -WATER_DESCEND_HEIGHT, 0f);
|
|
|
|
yield return transform.MoveAsync(finalPosition,
|
|
WATER_ANIMATION_DURATION,
|
|
AnimationCurveType.Sine);
|
|
|
|
ChangeAndSaveActivationState(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif |