blob: 67a499f21c32782c4422cabcfe0e4e09b960de5c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
using UnityEngine;
namespace Photon.Pun.Simple;
public class InventoryContactReactors : InventoryContactReactors<Vector3Int>
{
[SerializeField]
protected Vector3Int size = new Vector3Int(1, 1, 1);
public override Vector3Int Size => size;
public override void OnAwakeInitialize(bool isNetObject)
{
base.OnAwakeInitialize(isNetObject);
volume = size.x * size.y * size.z;
}
}
public abstract class InventoryContactReactors<T> : ContactReactorBase<IInventorySystem<T>>, IInventoryable<T>, IContactable
{
protected int volume;
public abstract T Size { get; }
public int Volume => volume;
public override bool IsPickup => true;
protected override Consumption ProcessContactEvent(ContactEvent contactEvent)
{
if (!(contactEvent.contactSystem is IInventorySystem<T> inventorySystem))
{
return Consumption.None;
}
if (IsPickup)
{
Mount mount = inventorySystem.TryPickup(this, contactEvent);
if ((bool)mount)
{
syncState.HardMount(mount);
}
}
return Consumption.All;
}
}
|