_xiaofang/xiaofang/Assets/yhj/scripts/PicXFS.cs

39 lines
876 B
C#
Raw Normal View History

2024-12-18 11:38:13 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PicXFS : MonoBehaviour
{
public GameObject Hand;
// Start is called before the first frame update
void Start()
{
}
public void picXFS()
{
if(XFS.instance.gun==null) return;
XFS.instance.gun.transform.SetParent(this.transform.parent);
XFS.instance.gun.transform.position=this.transform.position;
}
public void pickXFS()
{
XFS.instance.gun.transform.SetParent(Hand.transform);
XFS.instance.gun.transform.localPosition = new Vector3(0, 0, 0);
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Q))
{
picXFS();
}
if (Input.GetKeyDown(KeyCode.F))
{
pickXFS();
}
}
}