This commit is contained in:
CortexCore
2023-11-15 23:54:54 +08:00
parent ee3ecec6cb
commit 3c837a4a33
356 changed files with 73756 additions and 26493 deletions

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections;
using System.Collections.Generic;
using BITKit;
using Unity.Mathematics;
using UnityEngine;
namespace BITFALL.Placement
{
[Serializable]
public class IsPlaceable:IProperty
{
[SerializeField] private UnityPlacementObject placementObject;
public IPlacementObject PlacementObject => placementObject;
}
public class AssetablePlacement : AssetableItem,IPlacementObject
{
[SerializeField] private UnityPlacementObject placementObject;
public IPlacementObject Object => placementObject;
public float PositionIncrement => Object.PositionIncrement;
public int RotationIncrement => Object.RotationIncrement;
public int3 Size=>placementObject.Size;
public IPlacementObject CreateInstance() => Instantiate(placementObject);
}
}

View File

@@ -0,0 +1,23 @@
{
"name": "BITFALL.Placement.Runtime",
"rootNamespace": "",
"references": [
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
"GUID:87bea3a21c744b1478660b70494160ba",
"GUID:a83bfc00a1ad8e74981b456e6c50ed4e",
"GUID:d525ad6bd40672747bde77962f1c401e",
"GUID:49b49c76ee64f6b41bf28ef951cb0e50",
"GUID:677cd05ca06c46b4395470200b1acdad",
"GUID:30cdc242b1ac6a944a460f4ab0b77b88",
"GUID:d8b63aba1907145bea998dd612889d6b"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;
namespace BITFALL.Placement
{
public class UnityPlacementObject : MonoBehaviour,IPlacementObject
{
[SerializeField] private int3 size;
[SerializeField] private float positionIncrement = 1;
[SerializeField] private int rotationIncrement = 15;
public float PositionIncrement => positionIncrement;
public int RotationIncrement => rotationIncrement;
public int3 Size => size;
public IPlacementObject CreateInstance()=>
Instantiate(this);
}
}

View File

@@ -0,0 +1,28 @@
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();
}
}