2024-10-21 10:08:49 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* ʹ<EFBFBD>ü<EFBFBD><EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽű<EFBFBD>
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class UseSkill : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
//private CharacterAin CharacterAin;
|
2024-12-02 15:09:22 +08:00
|
|
|
|
|
2024-10-21 10:08:49 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>е<EFBFBD><D0B5><EFBFBD>Ʒ
|
2024-12-02 15:09:22 +08:00
|
|
|
|
[HideInInspector]
|
2024-10-21 10:08:49 +08:00
|
|
|
|
public GameObject currentItem = null;
|
|
|
|
|
|
2024-12-02 15:09:22 +08:00
|
|
|
|
public Skill_Pick _skill_Pick;
|
|
|
|
|
public Skill_Jump _skill_Jump;
|
|
|
|
|
public Skill_watering _skill_Watering;
|
2024-11-18 17:19:35 +08:00
|
|
|
|
//Fire fire = new Fire();
|
2024-10-21 10:08:49 +08:00
|
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
2024-12-02 15:09:22 +08:00
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
_skill_Pick = transform.GetComponent<Skill_Pick>();
|
|
|
|
|
_skill_Jump = transform.GetComponent<Skill_Jump>();
|
|
|
|
|
_skill_Watering = transform.GetComponent<Skill_watering>();
|
|
|
|
|
//Debug.LogError(_skill_Pick.Pick());
|
2024-10-21 10:08:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
|
|
|
|
Skill_Watering();
|
|
|
|
|
Skill_Pick();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//ʰȡ
|
|
|
|
|
void Skill_Pick()
|
|
|
|
|
{
|
2024-12-02 15:09:22 +08:00
|
|
|
|
if (Input.GetKeyDown(KeyCode.F))
|
2024-10-21 10:08:49 +08:00
|
|
|
|
{
|
2024-11-07 19:13:50 +08:00
|
|
|
|
Debug.LogError("F");
|
2024-12-02 15:09:22 +08:00
|
|
|
|
//Debug.LogError(skill_Pick.Pick());
|
|
|
|
|
currentItem = _skill_Pick.Pick();
|
2024-12-18 11:38:13 +08:00
|
|
|
|
if(currentItem==null) return;
|
2024-12-04 10:58:48 +08:00
|
|
|
|
if(currentItem.transform.name == "NoFire")
|
|
|
|
|
{
|
|
|
|
|
currentItem.transform.Rotate(180f, -80f, -30f);
|
|
|
|
|
}
|
2024-10-21 10:08:49 +08:00
|
|
|
|
}
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.Q))
|
|
|
|
|
{
|
2024-12-02 15:09:22 +08:00
|
|
|
|
currentItem = _skill_Pick.Drop(currentItem);
|
2024-10-21 10:08:49 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-04 10:58:48 +08:00
|
|
|
|
|
2024-10-21 10:08:49 +08:00
|
|
|
|
|
|
|
|
|
//<2F><>ˮ
|
|
|
|
|
void Skill_Watering()
|
|
|
|
|
{
|
|
|
|
|
if (currentItem == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (Input.GetMouseButtonDown(0))
|
|
|
|
|
{
|
2024-11-18 17:19:35 +08:00
|
|
|
|
|
2024-12-02 15:09:22 +08:00
|
|
|
|
_skill_Watering.StartWatering(currentItem);
|
2024-11-18 17:19:35 +08:00
|
|
|
|
|
|
|
|
|
|
2024-10-21 10:08:49 +08:00
|
|
|
|
}
|
|
|
|
|
if (Input.GetMouseButtonUp(0))
|
|
|
|
|
{
|
2024-12-02 15:09:22 +08:00
|
|
|
|
_skill_Watering.StopWatering(currentItem);
|
2024-10-21 10:08:49 +08:00
|
|
|
|
}
|
2024-10-23 20:48:23 +08:00
|
|
|
|
}
|
2024-10-21 10:08:49 +08:00
|
|
|
|
|
2024-10-23 20:48:23 +08:00
|
|
|
|
|
2024-10-21 10:08:49 +08:00
|
|
|
|
}
|