feat():大改前的提交,这个版本保存了所有冗余的代码
This commit is contained in:
27
Assets/Script/Gameplay/Facility/FacilityModifier.cs
Normal file
27
Assets/Script/Gameplay/Facility/FacilityModifier.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Script.Gameplay.Facility
|
||||
{
|
||||
public class FacilityModifier : MonoBehaviour
|
||||
{
|
||||
private Transform _transform;
|
||||
private Collider _collider;
|
||||
private Rigidbody _rigidbody;
|
||||
|
||||
public void ModifyComponent<T>(bool isOpen, T component) where T : Component
|
||||
{
|
||||
var targetComponent = this.GetComponent<T>();
|
||||
if (targetComponent != null)
|
||||
{
|
||||
if (isOpen)
|
||||
{
|
||||
targetComponent.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetComponent.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user