Add StickGame Assets
This commit is contained in:
17
phr/StickGame/Assets/Prefabs/Player/pickup.cs
Normal file
17
phr/StickGame/Assets/Prefabs/Player/pickup.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class pickup : MonoBehaviour
|
||||
{
|
||||
void Start(){
|
||||
Debug.Log("test");
|
||||
}
|
||||
void OnTriggerStay2D(Collider2D col){
|
||||
if(Input.GetKeyDown(KeyCode.E)&&col.gameObject.layer == LayerMask.NameToLayer("Pickable")&&col.transform.parent==null){
|
||||
transform.parent.parent.parent.GetComponent<balance>().pickup(col.gameObject);
|
||||
transform.parent.parent.parent.GetComponent<balance>().turncollisionsoff(col.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user