| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Trans_Float : MonoBehaviour
- {
- public PlayerController controller;
- public Vector3 UIoffset; //UI调整值
- public float floatProbability; //漂浮概率
- public float gainAbilityProbability; //获得漂浮特性的概率
- public int abilityTimes; //攻击使漂浮的次数
- private void Start()
- {
- controller = GetComponentInParent<PlayerController>();
- controller.canArrowHitFloat = true;
- controller.probability = floatProbability;
- controller.gainAbilityProbability = gainAbilityProbability;
- controller.abilityTimes = abilityTimes;
- controller.canMove = true;
- }
- private void OnDisable()
- {
- controller.canArrowHitFloat = false;
- }
- private void DeMp(int deMP)
- {
- controller.mp -= deMP;
- controller.uiMp.Show(controller.mp, controller.totalMp);
- }
- /*
- private void Update()
- {
- //硬直
- if (!canAttack)
- {
- pastAttackTime += Time.deltaTime;
- if (pastAttackTime >= intervalTime)
- {
- canAttack = true;
- pastAttackTime = 0;
- controller.canMove = true;
- }
- }
- if (isCDJ)
- {
- pastCDJ += Time.deltaTime;
- if (pastCDJ >= CDJ)
- {
- isCDJ = false;
- pastCDJ = 0;
- }
- }
- if (isCDK)
- {
- pastCDK += Time.deltaTime;
- if (pastCDK >= CDK)
- {
- isCDK = false;
- pastCDK = 0;
- }
- }
- if (isCDL)
- {
- pastCDL += Time.deltaTime;
- if (pastCDL >= CDL)
- {
- isCDL = false;
- pastCDL = 0;
- }
- }
- //J
- if (!isCDJ && controller.isinputJ && canAttack)
- {
- if (controller.mp >= mpJ)
- {
- isCDJ = true;
- intervalTime = intervalTimeJ;
- ToInterval(mpJ);
- controller.isinputJ = false;
- //首次攻击触发漂浮
- if (isFirst)
- {
- if (!dem.attackToFloat)
- {
- isFirst = false;
- dem.attackToFloat = true;
- }
- }
- //攻击保底min~max次触发漂浮
- else
- {
- if (!dem.attackToFloat)
- {
- times += 1;
- if (times >= minTime || times == maxTime)
- {
- times = 0;
- dem.attackToFloat = true;
- }
- }
- }
- dem.Attack2();
- }
- else
- {
- Debug.Log("mp不足");
- }
- }
- //K
- if (!isCDK && controller.isinputK)
- {
- if (controller.mp >= mpK)
- {
- if (!once)
- {
- controller.canMove = false;
- controller.ChangeState(CharacterState.Idle);
- KContinueValue();
- once = true;
- isK = true;
- once = true;
- curlock.transform.position = transform.position;
- Vector3 orig = curlock.transform.localScale;
- curlock.transform.localScale = new Vector3(minRange, orig.y, orig.z);
- curlock.SetActive(true);
- }
- if (pastTime <= keepFloatTime)
- {
- pastTime += Time.deltaTime;
- isLosingMp += continueMp * Time.deltaTime;
- if (isLosingMp >= mpK)
- {
- DeMp(mpK);
- isLosingMp -= mpK;
- }
- if (curlock.transform.localScale.x < maxRange)
- {
- curlock.transform.localScale += new Vector3(continueRange * Time.deltaTime, 0, 0);
- }
- }
- }
- else
- {
- Debug.Log("mp不足");
- }
- }
- if(isK && !controller.isinputK)
- {
- isCDK = true;
- pastTime = 0;
- isK = false;
- intervalTime = intervalTimeK;
- ToInterval(0);
- once = false;
- curFe.transform.position = curlock.transform.position;
- Vector3 v = curFe.transform.localScale;
- curFe.transform.localScale = new Vector3(curlock.transform.localScale.x, v.y, v.z);
- curlock.SetActive(false);
- curFe.SetActive(true);
- }
- //L
- if (!isCDL && controller.isinputL)
- {
- if (controller.mp >= mpL)
- {
- isCDL = true;
- intervalTime = intervalTimeL;
- ToInterval(mpL);
- controller.isinputL = false;
- foreach (MoveCharacter f in FloatData.eneIsFloating)
- {
- if (f.isFloat)
- {
- f.dropDamage = LAttackDamage;
- f.FloatDrop();
- FloatData.Clear(1);
- }
- }
- }
- else
- {
- Debug.Log("mp不足");
- }
- }
- }
- */
- }
|