public bool Set(BanBattleRole.Attribute attackAttribute, BanBattleRole.Attribute defenseAttribute) { int state = BanTools.GetAttributeState(attackAttribute, defenseAttribute); StartCoroutine(ShowKezhi(state, attackAttribute, defenseAttribute)); return(state != 0); }
public static string GetAttributeBorderName(BanBattleRole.Attribute aAttribute) { switch (aAttribute) { case BanBattleRole.Attribute.Jin: case BanBattleRole.Attribute.SJin: return("Attribute_Border_1"); case BanBattleRole.Attribute.Mu: case BanBattleRole.Attribute.SMu: return("Attribute_Border_2"); case BanBattleRole.Attribute.Shui: case BanBattleRole.Attribute.SShui: return("Attribute_Border_3"); case BanBattleRole.Attribute.Huo: case BanBattleRole.Attribute.SHuo: return("Attribute_Border_4"); case BanBattleRole.Attribute.Tu: case BanBattleRole.Attribute.STu: return("Attribute_Border_5"); case BanBattleRole.Attribute.Quan: return("star0"); default: return(""); } }
/// <summary> /// 返回值表示是否有属性克制, True代表确定有属性克制 /// </summary> public bool Set(BanBattleRole.Attribute attackAttribute, BanBattleRole.Attribute defenseAttribute) { Core.Data.soundManager.SoundFxPlay(SoundFx.FX_Explosion); sprite_Attack.spriteName = BanTools.GetAttributeName(attackAttribute); sprite_Defense.spriteName = BanTools.GetAttributeName(defenseAttribute); sprite_Attack.MakePixelPerfect(); sprite_Defense.MakePixelPerfect(); transform.localScale = new Vector3(15f, 15f, 15f); state = BanTools.GetAttributeState(attackAttribute, defenseAttribute); if (state == 1) { sprite_Attack.transform.localPosition = new Vector3(sprite_Attack.transform.localPosition.x - 10f, sprite_Attack.transform.localPosition.y, sprite_Attack.transform.localPosition.z); sprite_Attack.transform.localScale = new Vector3(EnlargeFactor, EnlargeFactor, EnlargeFactor); sprite_Defense.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); } else if (state == -1) { sprite_Defense.transform.localPosition = new Vector3(sprite_Defense.transform.localPosition.x + 10f, sprite_Defense.transform.localPosition.y, sprite_Defense.transform.localPosition.z); sprite_Attack.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); sprite_Defense.transform.localScale = new Vector3(EnlargeFactor, EnlargeFactor, EnlargeFactor); } MiniItween itween = MiniItween.ScaleTo(gameObject, new Vector3(1.0f, 1.0f, 1.0f), ScaleTime, ScaleType); itween.myDelegateFunc += shake; return(state != 0); }
/// <summary> /// /生成一个属性克制效果 /// </summary> /// <param name="attackAttribute">攻击方的属性.</param> /// <param name="defenseAttribute">防御方的属性.</param> public bool GenerateAttributeConflict(BanBattleRole.Attribute attackAttribute, BanBattleRole.Attribute defenseAttribute) { #if VS AttributeConflictEx temp = BanTools.CreateNGUIOject(BanBattleManager.Instance.prefab_AttributeConflict, go_AttributeConflictPos.transform.position, Quaternion.identity, go_AttributeConflictPos.transform).GetComponent <AttributeConflictEx>(); return(temp.Set(attackAttribute, defenseAttribute)); #else BanAttributeConflict temp = BanTools.CreateNGUIOject(BanBattleManager.Instance.prefab_AttributeConflict, go_AttributeConflictPos.transform.position, Quaternion.identity, go_AttributeConflictPos.transform).GetComponent <BanAttributeConflict>(); return(temp.Set(attackAttribute, defenseAttribute)); #endif }
public static string GetAttributeName(BanBattleRole.Attribute aAttribute) { switch (aAttribute) { case BanBattleRole.Attribute.Jin: return("Attribute_1"); case BanBattleRole.Attribute.Mu: return("Attribute_2"); case BanBattleRole.Attribute.Shui: return("Attribute_3"); case BanBattleRole.Attribute.Huo: return("Attribute_4"); case BanBattleRole.Attribute.Tu: return("Attribute_5"); case BanBattleRole.Attribute.Quan: return("Attribute_10"); case BanBattleRole.Attribute.SJin: return("Attribute_11"); case BanBattleRole.Attribute.SMu: return("Attribute_12"); case BanBattleRole.Attribute.SShui: return("Attribute_13"); case BanBattleRole.Attribute.SHuo: return("Attribute_14"); case BanBattleRole.Attribute.STu: return("Attribute_15"); default: return("Attribute_Die"); } }
//Left = true,代表左边克制右边。否则,右边克制左边 IEnumerator ShowKezhi(int state, BanBattleRole.Attribute attackAttribute, BanBattleRole.Attribute defenseAttribute) { LeftAttri.spriteName = BanTools.GetAttributeName(attackAttribute); RightAttri.spriteName = BanTools.GetAttributeName(defenseAttribute); Core.Data.soundManager.SoundFxPlay(SoundFx.FX_Explosion); bool Left = state == 1; init(); LeftAttri.transform.localScale = Left ? 1.5f * Vector3.one : Vector3.one; RightAttri.transform.localScale = Left ? Vector3.one : 1.5f * Vector3.one; Vector3 leftPos = Vector3.zero; Vector3 rightPos = Vector3.zero; if (Left) { leftPos = new Vector3(-BigPoint, 0f, 0f); rightPos = new Vector3(SmallPoint, 0f, 0f); } else { leftPos = new Vector3(-SmallPoint, 0f, 0f); rightPos = new Vector3(BigPoint, 0f, 0f); } //start move MiniItween.MoveTo(LeftAttri.gameObject, leftPos, Closed); MiniItween.MoveTo(RightAttri.gameObject, rightPos, Closed); MiniItween.ColorTo(LeftAttri.gameObject, new V4(Color.white), Closed, MiniItween.Type.ColorWidget); MiniItween.ColorTo(RightAttri.gameObject, new V4(Color.white), Closed, MiniItween.Type.ColorWidget); yield return(new WaitForSeconds(Closed)); //分离 MiniItween.MoveTo(LeftAttri.gameObject, new Vector3(leftPos.x - ApartDis, 0f, 0f), Apart); MiniItween.MoveTo(RightAttri.gameObject, new Vector3(rightPos.x + ApartDis, 0f, 0f), Apart); MiniItween.ScaleTo(KeZhi.gameObject, 1.1f * Vector3.one, Apart); MiniItween.ColorTo(KeZhi.gameObject, new V4(Color.white), Apart, MiniItween.Type.ColorWidget); yield return(new WaitForSeconds(Apart)); yield return(new WaitForEndOfFrame()); KeZhi.transform.localScale = Vector3.one; //闪电出现 GameObject go = Instantiate(Ray) as GameObject; if (Left) { RED.AddChild(go, LeftAttri.gameObject); } else { RED.AddChild(go, RightAttri.gameObject); } yield return(new WaitForSeconds(Thunder)); Destroy(go); //消失 MiniItween.MoveTo(LeftAttri.gameObject, new Vector3(-700f, 0f, 0f), Disappear); MiniItween.MoveTo(RightAttri.gameObject, new Vector3(700f, 0f, 0f), Disappear); MiniItween.ScaleTo(KeZhi.gameObject, Vector3.zero, Disappear); MiniItween.ColorTo(LeftAttri.gameObject, new V4(new Color(1f, 1f, 1f, 0f)), Disappear, MiniItween.Type.ColorWidget); MiniItween.ColorTo(RightAttri.gameObject, new V4(new Color(1f, 1f, 1f, 0f)), Disappear, MiniItween.Type.ColorWidget); MiniItween.ColorTo(KeZhi.gameObject, new V4(new Color(1f, 1f, 1f, 0f)), Disappear, MiniItween.Type.ColorWidget); yield return(new WaitForSeconds(Disappear)); }
public static int GetAttributeState(BanBattleRole.Attribute attackAttribute, BanBattleRole.Attribute defenseAttribute) { if (attackAttribute == BanBattleRole.Attribute.Jin && (defenseAttribute == BanBattleRole.Attribute.Mu || defenseAttribute == BanBattleRole.Attribute.SMu)) { return(1); } if (attackAttribute == BanBattleRole.Attribute.Mu && (defenseAttribute == BanBattleRole.Attribute.Tu || defenseAttribute == BanBattleRole.Attribute.STu)) { return(1); } if (attackAttribute == BanBattleRole.Attribute.Tu && (defenseAttribute == BanBattleRole.Attribute.Shui || defenseAttribute == BanBattleRole.Attribute.SShui)) { return(1); } if (attackAttribute == BanBattleRole.Attribute.Shui && (defenseAttribute == BanBattleRole.Attribute.Huo || defenseAttribute == BanBattleRole.Attribute.SHuo)) { return(1); } if (attackAttribute == BanBattleRole.Attribute.Huo && (defenseAttribute == BanBattleRole.Attribute.Jin || defenseAttribute == BanBattleRole.Attribute.SJin)) { return(1); } if (attackAttribute == BanBattleRole.Attribute.Quan && defenseAttribute != BanBattleRole.Attribute.Quan) { return(1); } if (attackAttribute == BanBattleRole.Attribute.SJin && (defenseAttribute == BanBattleRole.Attribute.Mu || defenseAttribute == BanBattleRole.Attribute.SMu)) { return(1); } if (attackAttribute == BanBattleRole.Attribute.SMu && (defenseAttribute == BanBattleRole.Attribute.Tu || defenseAttribute == BanBattleRole.Attribute.STu)) { return(1); } if (attackAttribute == BanBattleRole.Attribute.STu && (defenseAttribute == BanBattleRole.Attribute.Shui || defenseAttribute == BanBattleRole.Attribute.SShui)) { return(1); } if (attackAttribute == BanBattleRole.Attribute.SShui && (defenseAttribute == BanBattleRole.Attribute.Huo || defenseAttribute == BanBattleRole.Attribute.SHuo)) { return(1); } if (attackAttribute == BanBattleRole.Attribute.SHuo && (defenseAttribute == BanBattleRole.Attribute.Jin || defenseAttribute == BanBattleRole.Attribute.SJin)) { return(1); } if (defenseAttribute == BanBattleRole.Attribute.Jin && (attackAttribute == BanBattleRole.Attribute.Mu || attackAttribute == BanBattleRole.Attribute.SMu)) { return(-1); } if (defenseAttribute == BanBattleRole.Attribute.Mu && (attackAttribute == BanBattleRole.Attribute.Tu || attackAttribute == BanBattleRole.Attribute.STu)) { return(-1); } if (defenseAttribute == BanBattleRole.Attribute.Tu && (attackAttribute == BanBattleRole.Attribute.Shui || attackAttribute == BanBattleRole.Attribute.SShui)) { return(-1); } if (defenseAttribute == BanBattleRole.Attribute.Shui && (attackAttribute == BanBattleRole.Attribute.Huo || attackAttribute == BanBattleRole.Attribute.SHuo)) { return(-1); } if (defenseAttribute == BanBattleRole.Attribute.Huo && (attackAttribute == BanBattleRole.Attribute.Jin || attackAttribute == BanBattleRole.Attribute.SJin)) { return(-1); } if (defenseAttribute == BanBattleRole.Attribute.Quan && attackAttribute != BanBattleRole.Attribute.Quan) { return(-1); } if (defenseAttribute == BanBattleRole.Attribute.SJin && (attackAttribute == BanBattleRole.Attribute.Mu || attackAttribute == BanBattleRole.Attribute.SMu)) { return(-1); } if (defenseAttribute == BanBattleRole.Attribute.SMu && (attackAttribute == BanBattleRole.Attribute.Tu || attackAttribute == BanBattleRole.Attribute.STu)) { return(-1); } if (defenseAttribute == BanBattleRole.Attribute.STu && (attackAttribute == BanBattleRole.Attribute.Shui || attackAttribute == BanBattleRole.Attribute.SShui)) { return(-1); } if (defenseAttribute == BanBattleRole.Attribute.SShui && (attackAttribute == BanBattleRole.Attribute.Huo || attackAttribute == BanBattleRole.Attribute.SHuo)) { return(-1); } if (defenseAttribute == BanBattleRole.Attribute.SHuo && (attackAttribute == BanBattleRole.Attribute.Jin || attackAttribute == BanBattleRole.Attribute.SJin)) { return(-1); } return(0); }