void TornadoBreak() { specialSkill_state = SpecialSkill_State.none; btnHolding = false; animator.SetTrigger("specialSkill_release"); special_g_tornado.Release(); }
//animation呼叫 void canonSpitStop() { if (waterCanonObj != null) { waterCanonObj.transform.SetParent(null); waterCanonObj = null; } SetSpitting(false); SetOKA_direction(0f); //停止反作用力 if (reactionF_routine != null) { StopCoroutine(reactionF_routine); } specialSkill_state = SpecialSkill_State.none; }
// Update is called once per frame void Update() { BaseUpdate(); if (Input.GetButtonDown("Attack")) { if (specialSkill_state == SpecialSkill_State.none) { specialSkill_state = SpecialSkill_State.charging; } } if (Input.GetButton("Attack") && PlayerStatus.canSkill && specialSkill_state != SpecialSkill_State.none && normalattack_input <= 1) { specialInput_holdTime += Time.deltaTime; if (specialInput_holdTime >= 0.3f) { SpecialAttacking(true); switch (specialSkill_state) { //開始charging case SpecialSkill_State.charging: animator.SetTrigger("specialSkill_charging"); specialSkill_state = SpecialSkill_State.holding; break; //charging中 case SpecialSkill_State.holding: if (specialInput_holdTime >= 0.5f) //餘留時間讓龍捲風長出,否則會太快生成 { if (tornadoObj == null) { tornadoObj = Instantiate(tornadoPrefab, tornadoInitPoint.position, Quaternion.identity); special_g_tornado = tornadoObj.GetComponent <Special_g_tornado>(); special_g_tornado.SetSpeed(PlayerControl.facingRight ? 3f : -3f); throwAngle = 90f; special_g_tornado.SetAngle(throwAngle); playerEnergy.ModifyWaterEnergy(-(int)(specialCost_max)); } else { AngleInput(); special_g_tornado.SetAngle(throwAngle); } } break; } } } //釋放 if (Input.GetButtonUp("Attack")) { specialInput_holdTime = 0f; if (specialSkill_state == SpecialSkill_State.holding) { this.TornadoBreak(); } } }
void Update() { BaseUpdate(); if (Input.GetButton("Attack") && PlayerStatus.canSkill && normalattack_input <= 1) { specialInput_holdTime += Time.deltaTime; if (specialInput_holdTime >= 0.3f) { SpecialAttacking(true); switch (specialSkill_state) { //開始charging case SpecialSkill_State.none: animator.SetTrigger("specialSkill_charging"); specialSkill_state = SpecialSkill_State.charging; break; //charging中 case SpecialSkill_State.charging: if (iceObj == null) { iceObj = Instantiate(icePrefab, iceInitPoint.position, Quaternion.identity); iceObj.transform.SetParent(iceInitPoint); iceObj.GetComponent <Rigidbody2D>().isKinematic = true; iceSize = 0.01f; iceObj.transform.localScale = new Vector3(iceSize, iceSize, 1f); iceThrowAngle = PlayerControl.facingRight? 0f: 180f; } else { iceSize += Time.deltaTime * 0.75f; if (iceSize > iceMaxSize) { iceSize = iceMaxSize; } iceObj.transform.localScale = new Vector3(iceSize, iceSize, 1f); playerControl.rb2d.velocity = Vector2.zero; ThrowIce_AngleInput(); SetThrowIce_arrow(iceThrowAngle); } break; } } } //釋放 else if (Input.GetButtonUp("Attack")) { specialInput_holdTime = 0f; if (specialSkill_state == SpecialSkill_State.charging) { float downThrowRange = 15f; //往下丟 if (iceThrowAngle > -90f - downThrowRange && iceThrowAngle < -90f + downThrowRange) { animator.SetTrigger("specialSkill_release"); //throwout由release動畫呼叫 iceThrowAngle = -90f; iceThrowForce = 500f; playerControl.rb2d.AddForce(Vector2.up * 600f); //StartCoroutine(IceThrow_colDis(0.35f)); iceObj.GetComponent <SpecialBigIce>().StartCoroutine(IceThrow_colDis(0.5f)); } //往側邊丟 else { animator.SetTrigger("specialSkill_release"); //throwout由release動畫呼叫 iceThrowForce = 500f; } playerEnergy.ModifyWaterEnergy(-(int)(specialCost_max * iceSize / iceMaxSize)); specialSkill_state = SpecialSkill_State.none; CloseThrowIce_arrow(); } } }
// Update is called once per frame void Update() { BaseUpdate(); //毛細滲透 if (waterdropPassing) { playerTrans.position = waterdropTrans.position; } //Special Skill if (Input.GetButton("Attack") && PlayerStatus.canSkill && normalattack_input <= 1) { specialInput_holdTime += Time.deltaTime; if (specialInput_holdTime >= 0.3f) { SpecialAttacking(true); switch (specialSkill_state) { //開始charging case SpecialSkill_State.none: { animator.SetTrigger("specialSkill_charging"); canonDirectionAngle = PlayerControl.facingRight ? 0f : 180f; if (waterCanonObj != null) { Destroy(waterCanonObj); waterCanonObj = null; } waterCanonObj = Instantiate(waterCanonPrefab, this.transform.position, Quaternion.identity, this.transform); waterCanonObj.transform.localScale = Vector3.one; specialSkill_state = SpecialSkill_State.charging; } break; //charging中 case SpecialSkill_State.charging: if (!isSpitting) { WaterCanon_AngleInput(); SetOKA_direction(canonDirectionAngle); } break; } } } //釋放 else if (Input.GetButtonUp("Attack")) { specialInput_holdTime = 0f; if (specialSkill_state == SpecialSkill_State.charging) { animator.SetTrigger("specialSkill_release"); waterCanonObj.transform.GetChild(0).GetComponent <Animator>().SetTrigger("release"); waterCanonObj.transform.GetChild(0).GetComponent <Special_l_waterCanon>().SetAngle(canonDirectionAngle); playerEnergy.ModifyWaterEnergy(-specialCost); SetSpitting(true); //反作用力 if (reactionF_routine != null) { StopCoroutine(reactionF_routine); } reactionF_routine = StartCoroutine(ReactionForce()); specialSkill_state = SpecialSkill_State.throwout; } } //噴發中 else if (specialSkill_state == SpecialSkill_State.throwout) { } }