BITFALL/Assets/Artists/Scripts/Placement/UnityPlacementService.cs

29 lines
903 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace BITFALL.Placement
{
[Serializable]
public sealed class UnityPlacementServiceSingleton:PlacementServiceImplementation
{
protected override IPlacementService _placementServiceImplementation => UnityPlacementService.Singleton;
}
public class UnityPlacementService : MonoBehaviour,IPlacementService
{
public static IPlacementService Singleton { get; private set; }
[SerializeField] private UnityPlacementObject[] placementObjects;
public IPlacementObject CurrentPlacementObject { get; private set; }
public bool TryGetCurrentObject(out IPlacementObject placementObject)
{
placementObject = CurrentPlacementObject;
return placementObject != null;
}
public IPlacementObject[] PlacementObjects => placementObjects.Cast<IPlacementObject>().ToArray();
}
}