using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class XFS : MonoBehaviour { // Start is called before the first frame update public Button ConnectGun; public Button ConnectFa; public Button OpenFa; public GameObject Gun; public Transform Hand; public Transform XFsTransform; public GameObject ShuiguanGameObject; public GameObject firewater; public GameObject water; public bool IShavewater=false; public PlayerMovement_Jpystick CharacterControl; public UseSkill UseSkill; void Start() { ShuiguanGameObject.SetActive(false); UseSkill.Xfs = this; ConnectGun.onClick.AddListener((() => { PLayerLook(); CharacterControl.DragTheScreen.enabled = false; Invoke("connectGun",6f);})); ConnectFa.onClick.AddListener(() => { PLayerLook(); ShuiguanGameObject.SetActive(true); CharacterControl.DragTheScreen.enabled = false; Invoke("connectFa", 6f); }); OpenFa.onClick.AddListener(() => { PLayerLook(); CharacterControl.DragTheScreen.enabled = false; Invoke("openFa", 6f); }); } public void PLayerLook() { GameObject.FindGameObjectWithTag("Player").transform.LookAt(new Vector3(this.transform.position.x, GameObject.FindGameObjectWithTag("Player").transform.position.y, this.transform.position.z)); } public void connectGun() { //UseSkill.Initgun(Gun); CharacterControl.DragTheScreen.enabled = true; } public void connectFa() { Solver solver = ShuiguanGameObject.GetComponent(); solver.INit(Gun.transform.GetChild(0).transform); CharacterControl.DragTheScreen.enabled = true; } public void openFa() { UseSkill.Initgun(); water = Instantiate(firewater); water.transform.SetParent(Gun.transform); water.transform.localPosition = new Vector3(0, 0, 0); water.transform.localRotation = new Quaternion(0, 180, 0, 0); CharacterControl.enabled = true; water.SetActive(false); IShavewater = true; Gun.GetComponent().water=water; CharacterControl.DragTheScreen.enabled = true; } // Update is called once per frame void Update() { } }