82 lines
1.5 KiB
C#
82 lines
1.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
/*
|
|
* 使用技能,需要人物身上有动画控制脚本
|
|
*
|
|
*/
|
|
|
|
|
|
public class UseSkill : MonoBehaviour
|
|
{
|
|
//private CharacterAin CharacterAin;
|
|
|
|
// 玩家手中当前持有的物品
|
|
public GameObject currentItem = null;
|
|
|
|
private Skill_Pick skill_Pick;
|
|
private Skill_Jump skill_Jump;
|
|
private Skill_watering skill_Watering;
|
|
//Fire fire = new Fire();
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
skill_Pick = transform.GetComponent<Skill_Pick>();
|
|
skill_Jump = transform.GetComponent<Skill_Jump>();
|
|
skill_Watering = transform.GetComponent<Skill_watering>();
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
Skill_Watering();
|
|
Skill_Pick();
|
|
|
|
}
|
|
|
|
//拾取
|
|
void Skill_Pick()
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.F))
|
|
{
|
|
Debug.LogError("F");
|
|
currentItem = skill_Pick.Pick();
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Q))
|
|
{
|
|
currentItem = skill_Pick.Drop(currentItem);
|
|
}
|
|
}
|
|
|
|
//翻越(跳)
|
|
void Jump()
|
|
{
|
|
|
|
}
|
|
|
|
//洒水
|
|
void Skill_Watering()
|
|
{
|
|
if (currentItem == null)
|
|
{
|
|
return;
|
|
}
|
|
if (Input.GetMouseButtonDown(0))
|
|
{
|
|
|
|
skill_Watering.StartWatering(currentItem);
|
|
|
|
|
|
}
|
|
if (Input.GetMouseButtonUp(0))
|
|
{
|
|
skill_Watering.StopWatering(currentItem);
|
|
}
|
|
}
|
|
|
|
|
|
}
|