removed old stuff
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using R3;
|
||||
using RebootKit.Engine.Extensions;
|
||||
using RebootKit.Engine.Main;
|
||||
using RebootKit.Engine.Network;
|
||||
@@ -77,7 +76,20 @@ namespace RebootReality.jelycho.Player {
|
||||
[SerializeField] int m_InventorySize = 10;
|
||||
|
||||
public Inventory Inventory { get; private set; }
|
||||
public ReactiveProperty<int> SelectedInventorySlot { get; private set; } = new ReactiveProperty<int>(0);
|
||||
|
||||
int m_SelectedInventorySlotIndex = 0;
|
||||
public int SelectedInventorySlot {
|
||||
get {
|
||||
return m_SelectedInventorySlotIndex;
|
||||
}
|
||||
|
||||
set {
|
||||
m_SelectedInventorySlotIndex = value;
|
||||
OnSelectedInventorySlotChanged?.Invoke(value);
|
||||
}
|
||||
}
|
||||
|
||||
public Action<int> OnSelectedInventorySlotChanged = delegate {};
|
||||
|
||||
ItemActor m_EquippedItem;
|
||||
|
||||
@@ -109,13 +121,21 @@ namespace RebootReality.jelycho.Player {
|
||||
}
|
||||
}
|
||||
|
||||
readonly ReactiveProperty<IInteractable> m_TargetInteractable = new ReactiveProperty<IInteractable>(null);
|
||||
public ReadOnlyReactiveProperty<IInteractable> TargetInteractable {
|
||||
IInteractable m_TargetInteractable = null;
|
||||
public IInteractable TargetInteractable {
|
||||
get {
|
||||
return m_TargetInteractable;
|
||||
}
|
||||
|
||||
private set {
|
||||
s_Logger.Info("NEW");
|
||||
m_TargetInteractable = value;
|
||||
OnTargetInteractableChanged(value);
|
||||
}
|
||||
}
|
||||
|
||||
public Action<IInteractable> OnTargetInteractableChanged = delegate {};
|
||||
|
||||
readonly List<Actor> m_AdditionalMountedActor = new List<Actor>();
|
||||
|
||||
protected override IActorData CreateActorData() {
|
||||
@@ -195,7 +215,7 @@ namespace RebootReality.jelycho.Player {
|
||||
|
||||
if (m_EquippedItem != null) {
|
||||
var command = new PlayerActorDropItemCommand {
|
||||
InventorySlotIndex = (byte) SelectedInventorySlot.Value
|
||||
InventorySlotIndex = (byte) SelectedInventorySlot
|
||||
};
|
||||
SendActorCommand((byte) PlayerActorCommands.DropItem, ref command);
|
||||
}
|
||||
@@ -362,10 +382,10 @@ namespace RebootReality.jelycho.Player {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_TargetInteractable.Value is ItemActor itemActor) {
|
||||
if (TargetInteractable is ItemActor itemActor) {
|
||||
Pickup(itemActor);
|
||||
} else if (m_TargetInteractable.Value is not null) {
|
||||
m_TargetInteractable.Value.Interact();
|
||||
} else if (TargetInteractable is not null) {
|
||||
TargetInteractable.Interact();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -479,7 +499,7 @@ namespace RebootReality.jelycho.Player {
|
||||
return;
|
||||
}
|
||||
|
||||
SelectedInventorySlot.Value = command.SlotIndex;
|
||||
SelectedInventorySlot = command.SlotIndex;
|
||||
UpdateEquippedItem();
|
||||
break;
|
||||
}
|
||||
@@ -650,8 +670,13 @@ namespace RebootReality.jelycho.Player {
|
||||
|
||||
void SenseInteractable() {
|
||||
IInteractable interactable = m_InteractablesSensor.Sense();
|
||||
if (interactable != m_TargetInteractable.Value) {
|
||||
m_TargetInteractable.Value = interactable;
|
||||
if (interactable != null) {
|
||||
s_Logger.Info("NOT NULL");
|
||||
}
|
||||
|
||||
if (interactable != TargetInteractable) {
|
||||
s_Logger.Info("sensed different interactable");
|
||||
TargetInteractable = interactable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -751,7 +776,7 @@ namespace RebootReality.jelycho.Player {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemActor itemActor = Inventory.GetItem(SelectedInventorySlot.Value);
|
||||
ItemActor itemActor = Inventory.GetItem(SelectedInventorySlot);
|
||||
if (itemActor == m_EquippedItem) {
|
||||
return;
|
||||
}
|
||||
@@ -910,14 +935,14 @@ namespace RebootReality.jelycho.Player {
|
||||
return;
|
||||
}
|
||||
|
||||
if (SelectedInventorySlot.Value > 0) {
|
||||
SelectedInventorySlot.Value--;
|
||||
if (SelectedInventorySlot > 0) {
|
||||
SelectedInventorySlot--;
|
||||
} else {
|
||||
SelectedInventorySlot.Value = Inventory.SlotsCount - 1;
|
||||
SelectedInventorySlot = Inventory.SlotsCount - 1;
|
||||
}
|
||||
|
||||
var command = new PlayerActorSelectItemSlotCommand {
|
||||
SlotIndex = SelectedInventorySlot.Value
|
||||
SlotIndex = SelectedInventorySlot
|
||||
};
|
||||
SendActorCommand((byte) PlayerActorCommands.SelectItemSlot, ref command);
|
||||
}
|
||||
@@ -928,14 +953,14 @@ namespace RebootReality.jelycho.Player {
|
||||
return;
|
||||
}
|
||||
|
||||
if (SelectedInventorySlot.Value < Inventory.SlotsCount - 1) {
|
||||
SelectedInventorySlot.Value++;
|
||||
if (SelectedInventorySlot < Inventory.SlotsCount - 1) {
|
||||
SelectedInventorySlot++;
|
||||
} else {
|
||||
SelectedInventorySlot.Value = 0;
|
||||
SelectedInventorySlot = 0;
|
||||
}
|
||||
|
||||
var command = new PlayerActorSelectItemSlotCommand {
|
||||
SlotIndex = SelectedInventorySlot.Value
|
||||
SlotIndex = SelectedInventorySlot
|
||||
};
|
||||
SendActorCommand((byte) PlayerActorCommands.SelectItemSlot, ref command);
|
||||
}
|
||||
@@ -951,10 +976,10 @@ namespace RebootReality.jelycho.Player {
|
||||
return;
|
||||
}
|
||||
|
||||
SelectedInventorySlot.Value = slotIndex;
|
||||
SelectedInventorySlot = slotIndex;
|
||||
|
||||
var command = new PlayerActorSelectItemSlotCommand {
|
||||
SlotIndex = SelectedInventorySlot.Value
|
||||
SlotIndex = SelectedInventorySlot
|
||||
};
|
||||
SendActorCommand((byte) PlayerActorCommands.SelectItemSlot, ref command);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user