// Update is called once per frame void Update( ) { /* * * * * * * * * ---press E, set cursor---click a enemy, CD-------------------- */ if (enabled && (Input.GetKeyDown(KeyCode.E) || launched) && curCd <= 0 && manaCost <= m_property.curMana) { m_heroCtrl.SetCursor(GameCode.CursorCode.SingleSkill); hasPrepared = true; launched = false; } if (Input.GetMouseButtonDown(1)) { hasPrepared = false; } if (hasPrepared && Input.GetMouseButtonDown(0)) { if (m_heroCtrl.leftMouseClkGo != null && range > Vector3.Distance(m_heroCtrl.leftMouseClkGo.transform.position, transform.position)) { string _group = m_heroCtrl.leftMouseClkGo.tag; if (m_heroCtrl.AtDifferentGroup(_group, gameObject.tag)) { m_target = m_heroCtrl.leftMouseClkGo; m_property.UseMana(manaCost); hasPrepared = false; curCd = cd; //print("zhaoxin use E!!!!!!!!!" + m_heroCtrl.leftMouseClkGo.name); AdnormalState _teleport = new AdnormalState(GameCode.AdnormalStateCode.Teleport, 0.2f, 0.0f); m_property.SetAdnormalState(_teleport); m_heroCtrl.rightMouseClkGo = m_target; m_heroCtrl.target = m_target; m_animator.SetBool("atk1", true); m_heroCtrl.SetCursor(GameCode.CursorCode.Normal); // slow the target BaseProperty _p = m_target.GetComponent <BaseProperty>(); _p.Damaged(damage); AdnormalState _slow = new AdnormalState(GameCode.AdnormalStateCode.Slow, duration, slowDown); _p.SetAdnormalState(_slow); _p.moveSpeed *= (1 - slowDown); } } hasPrepared = false; } if (curCd > 0) { curCd -= Time.deltaTime; // dash to enemy if (m_property.adnormalStates[(int)GameCode.AdnormalStateCode.Teleport].duration >= 0) { transform.position = Vector3.Lerp( transform.position, m_target.transform.position, Time.deltaTime * 5); } } }
// Update is called once per frame void Update( ) { /* * * * * * * * * * * * * * * * ---------------- duration - cd --------------- * 3 atk here 3th atk completed or duration=0 */ // we can use this skill only we haven't press it and it is not in CD if (enabled && (Input.GetKeyDown(KeyCode.Q) || launched) && curCd <= 0 && m_curDuration <= 0 && manaCost <= m_property.curMana) { m_curDuration = duration; m_property.UseMana(manaCost); m_hasAttack = false; launched = false; atkCount = 3; //print("zhaoxin use q"); } AnimatorStateInfo _anmStt = m_animator.GetCurrentAnimatorStateInfo(0); if (m_curDuration > 0) { m_curDuration -= Time.deltaTime; curCd = 0; if (_anmStt.IsTag("a")) { if (_anmStt.normalizedTime > 0.25f && _anmStt.normalizedTime < 0.45f && !m_hasAttack) { atkCount--; m_hasAttack = true; //print(atkCount); } if (_anmStt.normalizedTime > 0.5f) { m_hasAttack = false; } } else if (_anmStt.IsName("Base.batk")) { if (atkCount == 1) { m_animator.SetBool("q", true); m_hasAttack = false; } } } else if (m_curDuration < 0) { curCd = cd; m_curDuration = 0; } if (_anmStt.IsName("Base.q")) { if (m_animator.GetBool("q")) { m_curDuration = 0; m_animator.speed = m_property.atkSpeed / m_property.baseAtkSpeed; m_animator.SetBool("q", false); curCd = cd; m_target = m_heroCtrl.rightMouseClkGo; BaseProperty _property = m_target.GetComponent <BaseProperty>(); if (_property != null) { // knock up enemy for 0.5 second AdnormalState _adnmStt = new AdnormalState(GameCode.AdnormalStateCode.KnockUp, 0.5f, 0.0f); _property.SetAdnormalState(_adnmStt); _property.Damaged((int)((float)m_property.atk * (1 + (float)level / 10))); // effect of this skill PoolManager.GetInstance(). GetPool(targetEffectPrefab.name, targetEffectPrefab). GetObject(m_target.transform.position + new Vector3(0, m_target.GetComponent <Collider>().bounds.size.y / 2, 0)); } //print("zhaoxin Q !!!!!!!!!!"); } } if (curCd > 0) { curCd -= Time.deltaTime; } }