void OnCollisionEnter(Collision collision) //落地 { animator.SetBool("Land", true); //回到初始状态; land = true; jumpButton.Baketo1(); if (rushButton.Prepared() && null != rushButton.GetComponent <ButtonNormal>()) { rushButton.GetComponent <ButtonNormal>().EnableButton(); } }
public int DrawSkills(Vector2 dVector) //拖拽时滑出技能图标 { //print("Draged"); float dis = dVector.magnitude; //print("di: " + dis); //范围调整 if (dis > maxD) { dis = maxD; dVector = maxD * dVector.normalized; } float angle = VectorAngle(Vector2.left, dVector); float d = (dis - btnRadiu) / (maxD - btnRadiu); //print(d); //技能1 if (angle >= -30 && angle < 30) { if (skill3.skillIndex < 0) { return(0); } if (!skill3.Prepared()) { skill3.ShowSkill(); cd.color = new Color(0, 0, 0, 0); skill3Icon.color = new Color(skill3Icon.color.r, skill3Icon.color.g, skill3Icon.color.b, 0); //技能图标透明度 skill4Icon.color = new Color(skill4Icon.color.r, skill4Icon.color.g, skill4Icon.color.b, 0); //技能图标透明度 skill5Icon.color = new Color(skill5Icon.color.r, skill5Icon.color.g, skill5Icon.color.b, 0); //技能图标透明度 return(0); } //改变技能图标透明度 skill3Icon.color = new Color(skill3Icon.color.r, skill3Icon.color.g, skill3Icon.color.b, Mathf.Lerp(0, 1, d)); //技能图标透明度 skill4Icon.color = new Color(skill4Icon.color.r, skill4Icon.color.g, skill4Icon.color.b, 0); //技能图标透明度 skill5Icon.color = new Color(skill5Icon.color.r, skill5Icon.color.g, skill5Icon.color.b, 0); //技能图标透明度 //cd标志 cd.color = new Color(0, 0, 0, Mathf.Lerp(0.5f, 1, d)); cd.rectTransform.localPosition = Vector2.Lerp(Vector2.zero, pos1, dis / 200); cd.rectTransform.localScale = Vector2.Lerp(Vector2.one, 2.5f * Vector2.one, d); thisImg.color = Color.Lerp(pressedColor, normalColor, d);//按钮透透明度 return(1); } //技能2 else if (angle >= 30 && angle < 60) { if (skill4.skillIndex < 0) { return(0); } if (!skill4.Prepared()) { skill4.ShowSkill(); cd.color = new Color(0, 0, 0, 0); skill3Icon.color = new Color(skill3Icon.color.r, skill3Icon.color.g, skill3Icon.color.b, 0); //技能图标透明度 skill4Icon.color = new Color(skill4Icon.color.r, skill4Icon.color.g, skill4Icon.color.b, 0); //技能图标透明度 skill5Icon.color = new Color(skill5Icon.color.r, skill5Icon.color.g, skill5Icon.color.b, 0); //技能图标透明度 return(0); } //改变技能图标透明度 skill4Icon.color = new Color(skill4Icon.color.r, skill4Icon.color.g, skill4Icon.color.b, Mathf.Lerp(0, 1, d)); //技能图标透明度 skill3Icon.color = new Color(skill3Icon.color.r, skill3Icon.color.g, skill3Icon.color.b, 0); //技能图标透明度 skill5Icon.color = new Color(skill5Icon.color.r, skill5Icon.color.g, skill5Icon.color.b, 0); //技能图标透明度 //按钮cd cd.color = new Color(0, 0, 0, Mathf.Lerp(0.5f, 1, d)); cd.rectTransform.localPosition = Vector2.Lerp(Vector2.zero, pos2, dis / 200); cd.rectTransform.localScale = Vector2.Lerp(Vector2.one, 2.5f * Vector2.one, d); thisImg.color = Color.Lerp(pressedColor, normalColor, d);//按钮透透明度 return(2); } //技能3 else if (angle >= 60 && angle < 120) { if (skill5.skillIndex < 0) { return(0); } if (!skill5.Prepared()) { skill5.ShowSkill(); cd.color = new Color(0, 0, 0, 0); skill3Icon.color = new Color(skill3Icon.color.r, skill3Icon.color.g, skill3Icon.color.b, 0); //技能图标透明度 skill4Icon.color = new Color(skill4Icon.color.r, skill4Icon.color.g, skill4Icon.color.b, 0); //技能图标透明度 skill5Icon.color = new Color(skill5Icon.color.r, skill5Icon.color.g, skill5Icon.color.b, 0); //技能图标透明度 return(0); } //改变技能图标透明度 skill5Icon.color = new Color(skill5Icon.color.r, skill5Icon.color.g, skill5Icon.color.b, Mathf.Lerp(0, 1, d)); //技能图标透明度 skill3Icon.color = new Color(skill3Icon.color.r, skill3Icon.color.g, skill3Icon.color.b, 0); //技能图标透明度 skill4Icon.color = new Color(skill4Icon.color.r, skill4Icon.color.g, skill4Icon.color.b, 0); //技能图标透明度 //按钮cd cd.color = new Color(0, 0, 0, Mathf.Lerp(0.5f, 1, d)); cd.rectTransform.localPosition = Vector2.Lerp(Vector2.zero, pos3, dis / 200); cd.rectTransform.localScale = Vector2.Lerp(Vector2.one, 2.5f * Vector2.one, d); thisImg.color = Color.Lerp(pressedColor, normalColor, d);//按钮透透明度 return(3); } else { return(0); } }