Compare commits
No commits in common. "a6e3b947522af2d8ac33c7f4c489b95697ceba2f" and "b8745c59bbab64c6023aa22ebfb2ab76cca8a041" have entirely different histories.
a6e3b94752
...
b8745c59bb
File diff suppressed because it is too large
Load Diff
@ -11,7 +11,7 @@ public class Skill_Pick : MonoBehaviour
|
||||
public Animator CharacterAnimator;
|
||||
|
||||
public Transform player;
|
||||
public XFS xfs;
|
||||
|
||||
private Transform rightHand, leftHand;
|
||||
|
||||
|
||||
@ -59,17 +59,14 @@ public class Skill_Pick : MonoBehaviour
|
||||
|
||||
// 禁用物品的碰撞体,防止它与玩家或其他物体碰撞
|
||||
itemCollider.enabled = false;
|
||||
if (item.transform.name == "gun")
|
||||
{
|
||||
xfs = item.GetComponent<watergun>().Xfs;
|
||||
}
|
||||
|
||||
// 将物品设置为玩家手部的子对象,并调整其位置和旋转
|
||||
item.transform.SetParent(rightHand, true); // false表示保持物品的世界旋转和位置
|
||||
item.transform.localPosition = relativePosition; // 假设玩家手中有一个默认的持物位置
|
||||
item.transform.localRotation = Quaternion.Euler(relativeRotation); // 重置旋转
|
||||
|
||||
Destroy(item.GetComponent<Rigidbody>());
|
||||
|
||||
|
||||
Debug.Log("^^^^^^^^^^^^^^^^^^^^^^^^^");
|
||||
// 更新当前持有的物品
|
||||
return item;
|
||||
@ -101,10 +98,7 @@ public class Skill_Pick : MonoBehaviour
|
||||
{
|
||||
itemCollider.enabled = true;
|
||||
}
|
||||
if (currentItem.transform.name == "gun")
|
||||
{
|
||||
xfs = null;
|
||||
}
|
||||
|
||||
currentItem.AddComponent<Rigidbody>();
|
||||
|
||||
// 将物品放置在玩家当前位置的地面上
|
||||
|
@ -37,10 +37,6 @@ public class Skill_watering : MonoBehaviour
|
||||
{
|
||||
currentItem.GetComponent<NoFire>().StopFire();
|
||||
}
|
||||
if (currentItem.GetComponent<watergun>() != null)
|
||||
{
|
||||
currentItem.GetComponent<watergun>().water.SetActive(false);
|
||||
}
|
||||
}
|
||||
public void StopWateringAnim( )
|
||||
{
|
||||
@ -76,9 +72,9 @@ public class Skill_watering : MonoBehaviour
|
||||
currentItem.GetComponent<NoFire>().StartFire();
|
||||
}
|
||||
|
||||
if (currentItem.GetComponent<watergun>() != null)
|
||||
if (currentItem.gameObject.name == "gun")
|
||||
{
|
||||
currentItem.GetComponent<watergun>().water.SetActive(true);
|
||||
XFS.instance.water.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public class UseSkill : MonoBehaviour
|
||||
// 玩家手中当前持有的物品
|
||||
//[HideInInspector]
|
||||
public GameObject currentItem = null;
|
||||
public XFS Xfs;
|
||||
|
||||
public Skill_Pick _skill_Pick;
|
||||
public Skill_Jump _skill_Jump;
|
||||
public Skill_watering _skill_Watering;
|
||||
@ -44,8 +44,8 @@ public class UseSkill : MonoBehaviour
|
||||
{
|
||||
if(currentItem.gameObject.name=="gun")
|
||||
{
|
||||
float dis= Vector3.Distance(GameObject.Find("player").transform.position, Xfs.gameObject.transform.position);
|
||||
if (dis >= 20f)
|
||||
float dis= Vector3.Distance(GameObject.Find("player").transform.position, XFS.instance.transform.position);
|
||||
if (dis >= 30f)
|
||||
{
|
||||
|
||||
Drop();
|
||||
@ -63,7 +63,7 @@ public class UseSkill : MonoBehaviour
|
||||
currentItem = null;
|
||||
}
|
||||
currentItem = _skill_Pick.Pick();
|
||||
Xfs= _skill_Pick.xfs;
|
||||
|
||||
if (currentItem.transform.name == "NoFire")
|
||||
{
|
||||
currentItem.transform.Rotate(180f, -80f, -30f);
|
||||
@ -89,7 +89,6 @@ public class UseSkill : MonoBehaviour
|
||||
}
|
||||
if (currentItem.transform.name == "gun")
|
||||
{
|
||||
|
||||
currentItem.transform.rotation = new Quaternion(61.7036781f, 186.325302f, 348.049622f, 0);
|
||||
}
|
||||
}
|
||||
@ -97,7 +96,7 @@ public class UseSkill : MonoBehaviour
|
||||
public void Drop()
|
||||
{
|
||||
currentItem = _skill_Pick.Drop(currentItem);
|
||||
Xfs = null;
|
||||
|
||||
}
|
||||
//拾取
|
||||
void Skill_Pick()
|
||||
@ -110,11 +109,13 @@ public class UseSkill : MonoBehaviour
|
||||
|
||||
if(currentItem.transform.name == "NoFire") { currentItem.transform.Rotate(180f, -80f, -30f);
|
||||
}
|
||||
if (currentItem.transform.name == "gun") {
|
||||
currentItem.transform.rotation = new Quaternion(61.7036781f, 186.325302f, 348.049622f, 0);
|
||||
Xfs = null;
|
||||
if (currentItem.transform.name == "gun") { currentItem.transform.rotation = new Quaternion(61.7036781f, 186.325302f, 348.049622f, 0);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Q))
|
||||
{
|
||||
currentItem = _skill_Pick.Drop(currentItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,7 +12,7 @@ public enum Firestate
|
||||
public class Fire : MonoBehaviour
|
||||
{
|
||||
|
||||
public bool isPlayerInRange = false; // 检查玩家是否在范围内
|
||||
private bool isPlayerInRange = false; // 检查玩家是否在范围内
|
||||
private bool isExtinguishing = false; // 是否正在灭火
|
||||
public float extinguishTime = 3f; // 灭火所需的时间
|
||||
private float holdTime = 0f; // 按住按钮的计时
|
||||
@ -45,7 +45,10 @@ public class Fire : MonoBehaviour
|
||||
|
||||
HurtPeople();
|
||||
|
||||
|
||||
if (XFS.instance.IShavewater)
|
||||
{
|
||||
MieFire();
|
||||
}
|
||||
|
||||
if (UseSkill == null)
|
||||
{
|
||||
@ -55,8 +58,8 @@ public class Fire : MonoBehaviour
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if(UseSkill.currentItem.transform.name != "NoFire" && UseSkill.currentItem.transform.name!="gun")
|
||||
{
|
||||
else if(UseSkill.currentItem.transform.name != "NoFire")
|
||||
{
|
||||
return;
|
||||
}
|
||||
MieFire();
|
||||
@ -111,7 +114,6 @@ public class Fire : MonoBehaviour
|
||||
// // 恢复玩家控制器
|
||||
// if (!Input.GetMouseButton(0)) EnablePlayerControl();
|
||||
//}
|
||||
Debug.Log(11111111);
|
||||
if (isPlayerInRange&& UseSkill.IsWater)
|
||||
{
|
||||
// 计算玩家与火源的距离
|
||||
@ -133,6 +135,10 @@ public class Fire : MonoBehaviour
|
||||
// 如果玩家按住键达到指定时间,停止火焰
|
||||
StopFire();
|
||||
isExtinguishing = true; // 防止重复触发灭火
|
||||
if (XFS.instance.IShavewater)
|
||||
{
|
||||
XFS.instance.water.SetActive(false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,6 @@ public class NoFire : MonoBehaviour
|
||||
{
|
||||
//ÅçÉäµã
|
||||
private GameObject MuzzlePos;
|
||||
|
||||
public bool isuse = false;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
@ -28,12 +26,10 @@ public class NoFire : MonoBehaviour
|
||||
public void StartFire()
|
||||
{
|
||||
MuzzlePos.SetActive(true);
|
||||
isuse=true;
|
||||
}
|
||||
|
||||
public void StopFire()
|
||||
{
|
||||
MuzzlePos.SetActive(false);
|
||||
isuse=false;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ using UnityEngine.UI;
|
||||
|
||||
public class XFS : MonoBehaviour
|
||||
{
|
||||
|
||||
public static XFS instance;
|
||||
// Start is called before the first frame update
|
||||
public Button ConnectGun;
|
||||
public Button ConnectFa;
|
||||
@ -22,7 +22,7 @@ public class XFS : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
ShuiguanGameObject.SetActive(false);
|
||||
UseSkill.Xfs = this;
|
||||
instance =this;
|
||||
ConnectGun.onClick.AddListener((() =>
|
||||
{
|
||||
PLayerLook();
|
||||
@ -62,15 +62,14 @@ public class XFS : MonoBehaviour
|
||||
|
||||
public void openFa()
|
||||
{
|
||||
UseSkill.Initgun();
|
||||
water = Instantiate(firewater);
|
||||
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<watergun>().water=water;
|
||||
UseSkill.Initgun();
|
||||
CharacterControl.DragTheScreen.enabled = true;
|
||||
}
|
||||
// Update is called once per frame
|
||||
|
@ -1,20 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class watergun : MonoBehaviour
|
||||
{
|
||||
public XFS Xfs;
|
||||
public GameObject water;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
Xfs=this.transform.parent.GetComponent<XFS>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ee3f53d86720f249a148ad9823e0198
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user