/// <summary> /// Block attacking card using selected card(def) /// </summary> /// <param name="def"></param> public bool BlockCard(CreatureCard def) { Debug.LogFormat("Block Card With {0}", def); bool ret = true; CreatureCard atkCard = null; PhysicalAttribute attackInst = null; if (def.UseCard() == false) //If defend card can't be used, can't be blocked { return(false); } else { attackInst = Setting.RayCastCard(def.PhysicalCondition); } if (attackInst != null) { atkCard = (CreatureCard)attackInst.OriginCard; if (!error.CheckAttackingCard(def, atkCard)) { ret = false; } Debug.LogFormat("AttackingCard: {0}, DefendingCard: {1}", atkCard.GetCardData.Name, def.GetCardData.Name); } return(ret); }
/// <summary> /// Raycast card except 'currentSelecting' /// </summary> /// <param name="currentSelecting"></param> /// <returns></returns> public static PhysicalAttribute RayCastCard(PhysicalAttribute currentSelecting = null) { RaycastHit[] hits = GetUIObjs(); PhysicalAttribute detectedCard = null; for (int i = 0; i < hits.Length; i++) { detectedCard = hits[i].transform.gameObject.GetComponentInParent <PhysicalAttribute>(); if (currentSelecting != null) { if (detectedCard == currentSelecting) { detectedCard = null; } } //If dectected card isn't current card else { if (detectedCard != null) { //Debug.LogFormat("BlockCard: AttackingCard Found, {0}", detectedCard.OriginCard.Data.Name); return(detectedCard); //If there is card instance in 'currentCard', break } } } return(detectedCard); }
public void GetDto() { //moke ContainerBuilder builder = new ContainerBuilder(); builder.LoadAutoMapper(); builder.RegisterType <AutoMapperProfile>(); IContainer Container = builder.Build(); using (var scope = Container.BeginLifetimeScope()) { scope.Resolve <AutoMapperProfile>().Mapping(scope); PeopleDto result = new PeopleDto() { Eye = "双眼皮", Mouth = "红润", Age = 18, IsMarried = false }; PhysicalAttribute physical = new PhysicalAttribute() { Eye = "双眼皮", Mouth = "红润" }; SocialAttribute social = new SocialAttribute() { Name = "张三", IsMarried = false, Age = 18 }; PeopleDto output = new DtoHelper(scope.Resolve <IMapper>()).GetDto(physical, social); //Assert.Same(result, output); Assert.Equal(JsonConvert.SerializeObject(result), JsonConvert.SerializeObject(output)); outputHelper.WriteLine(JsonConvert.SerializeObject(output)); } }
private void HandleCardDetection() { RaycastHit[] hits = GetUIObjs(); PhysicalAttribute detectedCard = null; for (int i = 0; i < hits.Length; i++) { detectedCard = hits[i].transform.gameObject.GetComponentInParent <PhysicalAttribute>(); //If dectected card isn't current card if (detectedCard != null) { //If there is card instance in 'currentCard', break break; } } if (detectedCard != null) { if (currentCard != null) { currentCard.DeHighlight(); } currentCard = detectedCard; currentCard.Highlight(); } else { if (currentCard != null) { currentCard.DeHighlight(); currentCard = null; } } }
public void MouseDragging(PhysicalAttribute c) { Debug.Log("BeforeTracking: " + c.transform.position); c.transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 50)); c.transform.SetAsLastSibling(); Debug.Log("AFeterTracking: " + c.transform.position); }
public void UseSpell(SpellCard spell) { //Check if this card is available. If it can't be used, return if (!spell.CanUseCard()) { return; } CreatureCard targetCard = null; //Ray cast target Instance PhysicalAttribute targetInst = Setting.RayCastCard(spell.PhysicalCondition); if (targetInst) { if (targetInst.OriginCard is CreatureCard) { targetCard = (CreatureCard)targetInst.OriginCard; } } else { return; } //Based on Spell Card type, run it's spell to card. //How to build that logic? switch (spell.GetType) { //Modify Target Card stats case SpellType.Attack: targetCard.CreatureData.ModifyHealth = -(spell._HealthChange); break; case SpellType.Debuff: targetCard.CreatureData.ModifyAttack = -(spell._AttackChange); targetCard.CreatureData.ModifyHealth = -(spell._HealthChange); break; case SpellType.Buff: targetCard.CreatureData.ModifyAttack = spell._AttackChange; targetCard.CreatureData.ModifyHealth = spell._HealthChange; break; default: Debug.LogError("This Spell don't have any type"); break; } }
private void HandleMouseClick(PhysicalAttribute inst, Phase currentPhase) { Card c = inst.OriginCard; Debug.LogFormat("Current Card is {0}", selectedCard); if (c is CreatureCard) { CreatureCard converted = (CreatureCard)c; HandleCreatureClick(converted, currentPhase); } else if (c is SpellCard) { SpellCard converted = (SpellCard)c; HandleSpellClick(converted, currentPhase); } }
private void HandleCardDetection() { PhysicalAttribute detectedCard = Setting.RayCastCard(); if (detectedCard != null) { if (selectedCard != null) { selectedCard.DeHighlight(); } selectedCard = detectedCard; selectedCard.Highlight(); } else { if (selectedCard != null) { selectedCard.DeHighlight(); selectedCard = null; } } }
public float GetPhysicalAttr(PhysicalAttribute name) { return(physicalAttributes[name]); }