Initial commit
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Sockets;
|
||||
|
||||
public interface BlockContainerInit
|
||||
{
|
||||
List<SocketPoint> InitBlockContainer(List<SocketPoint> sockets);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b628454e932ec7e47be99c98c50c21d2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public class SimpleLinkContainerInit : MonoBehaviour, BlockContainerInit
|
||||
{
|
||||
public List<SocketPoint> InitBlockContainer(List<SocketPoint> sockets)
|
||||
{
|
||||
List<SocketPoint> iterativeSockets = new List<SocketPoint>();
|
||||
if (sockets.Count == 0)
|
||||
{
|
||||
Debug.Log("there is no socket in the container, you could delete this container");
|
||||
return iterativeSockets;
|
||||
}
|
||||
iterativeSockets.AddRange(sockets.Where(s => s.transform.localPosition.y < 0));
|
||||
foreach (SocketPoint socket in sockets)
|
||||
{
|
||||
socket.transform.localRotation = Quaternion.Euler(new Vector3((socket.transform.localPosition.y >= 0) ? 90 : -90, 0, 0));
|
||||
}
|
||||
iterativeSockets.Sort((a, b) => a.transform.localPosition.z.CompareTo(b.transform.localPosition.z));
|
||||
return iterativeSockets;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b42e4fcee301cd746900548e1629423e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user