Spaces:
Runtime error
Runtime error
File size: 1,754 Bytes
ce81a16 |
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
using System;
using Photon.Deterministic;
namespace Quantum
{
public abstract partial class HFSMLogicalDecision : HFSMDecision
{
public AssetRefHFSMDecision[] Decisions;
protected HFSMDecision[] _decisions;
public override void Loaded(IResourceManager resourceManager, Native.Allocator allocator)
{
base.Loaded(resourceManager, allocator);
_decisions = new HFSMDecision[Decisions == null ? 0 : Decisions.Length];
if (Decisions != null)
{
for (Int32 i = 0; i < Decisions.Length; i++)
{
_decisions[i] = (HFSMDecision)resourceManager.GetAsset(Decisions[i].Id);
}
}
}
}
[Serializable]
[AssetObjectConfig(GenerateLinkingScripts = true, GenerateAssetCreateMenu = false, GenerateAssetResetMethod = false)]
public partial class HFSMOrDecision : HFSMLogicalDecision
{
public override unsafe bool Decide(Frame frame, EntityRef entity)
{
foreach (var decision in _decisions)
{
if (decision.Decide(frame, entity))
return true;
}
return false;
}
}
[Serializable]
[AssetObjectConfig(GenerateLinkingScripts = true, GenerateAssetCreateMenu = false, GenerateAssetResetMethod = false)]
public partial class HFSMAndDecision : HFSMLogicalDecision
{
public override unsafe bool Decide(Frame frame, EntityRef entity)
{
foreach (var decision in _decisions)
{
if (!decision.Decide(frame, entity))
return false;
}
return true;
}
}
[Serializable]
[AssetObjectConfig(GenerateLinkingScripts = true, GenerateAssetCreateMenu = false, GenerateAssetResetMethod = false)]
public partial class HFSMNotDecision : HFSMLogicalDecision
{
public override unsafe bool Decide(Frame frame, EntityRef entity)
{
return !_decisions[0].Decide(frame, entity);
}
}
}
|