split into multiple assemblies
This commit is contained in:
30
Assets/Engine/Runtime/Requirements/FaceSpaceCenter.cs
Normal file
30
Assets/Engine/Runtime/Requirements/FaceSpaceCenter.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Collections.Generic;
|
||||
using EscapeRoomEngine.Engine.Runtime.Modules;
|
||||
using UnityEngine;
|
||||
|
||||
namespace EscapeRoomEngine.Engine.Runtime.Requirements
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Requirements/Face Space Center")]
|
||||
public class FaceSpaceCenter : OrientationRequirement
|
||||
{
|
||||
protected override IEnumerable<Orientation> GenerateCandidates(Module module, Space space)
|
||||
{
|
||||
var orientation = new HashSet<Orientation>(1);
|
||||
float width = space.rrDimensions.width;
|
||||
float length = space.rrDimensions.length;
|
||||
var xRel = module.SrPosition.x / (width - 1);
|
||||
var zRel = module.SrPosition.y / (length - 1);
|
||||
|
||||
if (zRel > xRel)
|
||||
{
|
||||
orientation.Add(zRel > 1 - xRel ? Orientation.South : Orientation.East);
|
||||
}
|
||||
else
|
||||
{
|
||||
orientation.Add(zRel > 1 - xRel ? Orientation.West : Orientation.North);
|
||||
}
|
||||
|
||||
return orientation;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user