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; // Start is called before the first frame update void Start() { skill_Pick = transform.GetComponent(); skill_Jump = transform.GetComponent(); skill_Watering = transform.GetComponent(); } // Update is called once per frame void Update() { Skill_Watering(); Skill_Pick(); } //拾取 void Skill_Pick() { if (Input.GetKeyDown(KeyCode.F)) { currentItem = skill_Pick.Pick(); } if (Input.GetKeyDown(KeyCode.Q)) { 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); } } }