52 lines
1.6 KiB
C#
52 lines
1.6 KiB
C#
using RebootKit.Engine.Main;
|
|
using RebootKit.Engine.Simulation;
|
|
using RebootReality.jelycho.Player;
|
|
using UnityEngine;
|
|
using Logger = RebootKit.Engine.Foundation.Logger;
|
|
|
|
namespace RebootReality.jelycho.Items {
|
|
public class SpawnBeaconChargeAction : IItemChargeAction {
|
|
static readonly Logger s_Logger = new Logger(nameof(SpawnBeaconChargeAction));
|
|
|
|
public bool OnChargeStart(Actor user, ItemActor itemActor) {
|
|
PlayerActor player = user as PlayerActor;
|
|
if (player == null) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public bool OnChargeUpdate(Actor user, ItemActor itemActor, float chargeProgress) {
|
|
PlayerActor player = user as PlayerActor;
|
|
if (player == null) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public bool OnChargeEnd(Actor user, ItemActor itemActor, float chargeProgress) {
|
|
PlayerActor player = user as PlayerActor;
|
|
if (player == null) {
|
|
return false;
|
|
}
|
|
|
|
if (RR.World.Context is WorldContext worldContext) {
|
|
if (player.TryGetBeaconPosition(out Vector3 beaconPosition)) {
|
|
worldContext.BaseManager.TrySpawnBeacon(beaconPosition);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public void OnChargeCancel(Actor user, ItemActor itemActor) {
|
|
PlayerActor player = user as PlayerActor;
|
|
if (player == null) {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
} |