技能脚本
using UnityEngine; using System.Collections; public class WaterSpoutMove : MonoBehaviour { public float moveSpeed; public Transform StartPoint; public Transform CenterPoint; private Vector3 EndPoint; private int num; //public Transform attackTarget; private PlayerData pData; private float Far_Hurt; private float P_Deceleration; private float Original_Speed; void Start () { pData=(PlayerData)CenterPoint.GetComponent("PlayerData"); Original_Speed = pData.Spd; transform.LookAt(EndPoint); if(ConstantData.DIFFICITY_LEVEL==ConstantData.NORMAL) { Far_Hurt = pData.p_hpz*0.05f; P_Deceleration = pData.Spd*0.03f; } if(ConstantData.DIFFICITY_LEVEL == ConstantData.HARD) { Far_Hurt = pData.p_hpz*0.08f; P_Deceleration = pData.Spd*0.05f; } EndPoint=new Vector3(CenterPoint.position.x*2-StartPoint.position.x,CenterPoint.position.y+1.2f,CenterPoint.position.z*2-StartPoint.position.z); } void Update () { transform.position+=transform.forward*moveSpeed; } void OnTriggerEnter(Collider others) { if(others.gameObject.CompareTag("Player")) { pData.AddBuff(1,3f,Far_Hurt); //Debug.Log("aaaaaaaaaaaaaaaa"); } } }