feat(Connect): 完成连线基本玩法,
This commit is contained in:
25
Assets/Script/Gameplay/Connect/ConnectionLineManager.cs
Normal file
25
Assets/Script/Gameplay/Connect/ConnectionLineManager.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using Core;
|
||||
|
||||
namespace Script.Gameplay.Connect
|
||||
{
|
||||
public class ConnectionLineManager : MonoSingleton<ConnectionLineManager>
|
||||
{
|
||||
[SerializeField] private GameObject linePrefab;
|
||||
public List<ConnectionLine> connectionLines = new List<ConnectionLine>();
|
||||
|
||||
public ConnectionLine GenerateConnectionLine(IConnectable source, IConnectable target)
|
||||
{
|
||||
GameObject lineObject = Instantiate(linePrefab, this.transform);
|
||||
ConnectionLine connectionLine = lineObject.GetComponent<ConnectionLine>();
|
||||
if (connectionLine != null)
|
||||
{
|
||||
connectionLine.SetConnectable(source, target);
|
||||
connectionLines.Add(connectionLine);
|
||||
return connectionLine;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user