_xiaofang/xiaofang/Assets/Script/XFS.cs

81 lines
2.3 KiB
C#
Raw Normal View History

2024-12-16 20:29:28 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class XFS : MonoBehaviour
{
2024-12-17 17:06:14 +08:00
public static XFS instance;
2024-12-16 20:29:28 +08:00
// Start is called before the first frame update
public Button ConnectGun;
public Button ConnectFa;
public Button OpenFa;
public GameObject Gun;
public Transform Hand;
2024-12-17 10:58:51 +08:00
public Transform XFsTransform;
public GameObject ShuiguanGameObject;
2024-12-17 12:00:17 +08:00
public GameObject firewater;
2024-12-17 17:06:14 +08:00
public GameObject water;
2024-12-17 17:27:46 +08:00
public bool IShavewater=false;
2024-12-25 17:38:45 +08:00
public PlayerMovement_Jpystick CharacterControl;
2024-12-20 14:38:57 +08:00
public UseSkill UseSkill;
2024-12-16 20:29:28 +08:00
void Start()
{
ShuiguanGameObject.SetActive(false);
instance =this;
2024-12-24 11:55:51 +08:00
ConnectGun.onClick.AddListener((() =>
{
PLayerLook();
2024-12-25 18:02:44 +08:00
CharacterControl.DragTheScreen.enabled = false; Invoke("connectGun",6f);}));
2024-12-24 11:55:51 +08:00
ConnectFa.onClick.AddListener(() =>
{
PLayerLook();
ShuiguanGameObject.SetActive(true);
2024-12-25 18:02:44 +08:00
CharacterControl.DragTheScreen.enabled = false; Invoke("connectFa", 6f);
2024-12-24 11:55:51 +08:00
});
OpenFa.onClick.AddListener(() =>
{
PLayerLook();
2024-12-25 18:02:44 +08:00
CharacterControl.DragTheScreen.enabled = false; Invoke("openFa", 6f);
2024-12-24 11:55:51 +08:00
});
2024-12-16 20:29:28 +08:00
}
public void PLayerLook()
{
GameObject.FindGameObjectWithTag("Player").transform.LookAt(new Vector3(this.transform.position.x, GameObject.FindGameObjectWithTag("Player").transform.position.y, this.transform.position.z));
}
2024-12-17 12:00:17 +08:00
public void connectGun()
2024-12-16 20:29:28 +08:00
{
2024-12-24 17:55:44 +08:00
//UseSkill.Initgun(Gun);
2024-12-25 18:02:44 +08:00
CharacterControl.DragTheScreen.enabled = true;
2024-12-16 20:29:28 +08:00
}
2024-12-17 12:00:17 +08:00
public void connectFa()
2024-12-16 20:29:28 +08:00
{
2024-12-18 03:03:46 +08:00
Solver solver = ShuiguanGameObject.GetComponent<Solver>();
2024-12-20 14:38:57 +08:00
solver.INit(Gun.transform);
2024-12-25 18:02:44 +08:00
CharacterControl.DragTheScreen.enabled = true;
2024-12-16 20:29:28 +08:00
}
2024-12-17 12:00:17 +08:00
public void openFa()
2024-12-16 20:29:28 +08:00
{
2024-12-17 17:06:14 +08:00
water = Instantiate(firewater);
2024-12-20 14:38:57 +08:00
water.transform.SetParent(Gun.transform);
2024-12-17 17:06:14 +08:00
water.transform.localPosition = new Vector3(0, 0, 0);
water.transform.localRotation = new Quaternion(0, 180, 0, 0);
2024-12-24 11:55:51 +08:00
CharacterControl.enabled = true;
2024-12-17 17:27:46 +08:00
water.SetActive(false);
IShavewater = true;
2024-12-24 17:55:44 +08:00
UseSkill.Initgun();
2024-12-25 18:02:44 +08:00
CharacterControl.DragTheScreen.enabled = true;
2024-12-16 20:29:28 +08:00
}
// Update is called once per frame
void Update()
{
}
}