50 lines
1.3 KiB
C#
50 lines
1.3 KiB
C#
using UnityEngine;
|
|
|
|
public class StojakInteractive : MonoBehaviour
|
|
{
|
|
private BoxCollider boxColider;
|
|
|
|
private void Start()
|
|
{
|
|
boxColider = GetComponent<BoxCollider>();
|
|
}
|
|
|
|
private void FixedUpdate()
|
|
{
|
|
if (!CheckSlot())
|
|
{
|
|
if (!boxColider.enabled)
|
|
{
|
|
boxColider.enabled = true;
|
|
}
|
|
}
|
|
else if (boxColider.enabled)
|
|
{
|
|
boxColider.enabled = false;
|
|
}
|
|
}
|
|
|
|
public void DropRodOnSlot()
|
|
{
|
|
if (!(FScriptsHandler.Instance.m_PlayerMain.currentRod == null))
|
|
{
|
|
FScriptsHandler.Instance.m_PlayerMain.currentRod.transform.SetParent(base.transform);
|
|
FScriptsHandler.Instance.m_PlayerMain.currentRod.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
|
|
FScriptsHandler.Instance.m_PlayerMain.currentRod.transform.localPosition = Vector3.zero;
|
|
FScriptsHandler.Instance.m_PlayerMain.currentRod.GetComponent<FixedJoint>().connectedBody = null;
|
|
FScriptsHandler.Instance.m_PlayerMain.currentRod.GetComponent<Rigidbody>().isKinematic = true;
|
|
int indexOfslot = FScriptsHandler.Instance.m_PlayerMain.currentRod.indexOfslot;
|
|
Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerSlotsEquip[indexOfslot].rod.status = GameManager.PlayerData.CRods.Status.InOut;
|
|
}
|
|
}
|
|
|
|
private bool CheckSlot()
|
|
{
|
|
if (base.transform.childCount > 0)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|