working on charging and quick attacks
This commit is contained in:
52
Assets/jelycho/Code/Items/SpawnBeaconChargeAction.cs
Normal file
52
Assets/jelycho/Code/Items/SpawnBeaconChargeAction.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user