using System.Collections; using System.Collections.Generic; using UnityEngine; using FSRole; using FSEvent; using FSBuff; using UnityEngine.UI; namespace FSCard { /* * 攻击卡片组件 */ public class AckCard : MonoBehaviour, Card { // 种类 public CardType Type { get; set; } // 卡片的唯一标示 public string ID { set; get; } // 花费的能量 public int Cost { get; set; } // 韧性 public int Tenacity { get; set; } // 数值 public int Value { set; get; } // 目标 public Role Target { set; get; } // 挂载的BUFF id public string BuffID { set; get; } // 发起者 public Role Source { set; get; } // 卡面 public Image Face { set; get; } // Use this for initialization void Start() { Face = transform.Find("Face").GetComponent(); if (Face != null) { // 加载图片 Image image = gameObject.GetComponent(); if (Source.CurrentAttr.Camp == RoleCamp.ARMY) { if (Type == CardType.CARD_TYPE_ATTACK) { image.sprite = Resources.Load("Textures/Cards/BG/Army_Ack", typeof(Sprite)) as Sprite; } else if (Type == CardType.CARD_TYPE_DEFANCE) { image.sprite = Resources.Load("Textures/Cards/BG/Army_Def", typeof(Sprite)) as Sprite; } else { image.sprite = Resources.Load("Textures/Cards/BG/Army_Spec", typeof(Sprite)) as Sprite; } } else { if (Type == CardType.CARD_TYPE_ATTACK) { image.sprite = Resources.Load("Textures/Cards/BG/Enemy_Ack", typeof(Sprite)) as Sprite; } else if (Type == CardType.CARD_TYPE_DEFANCE) { image.sprite = Resources.Load("Textures/Cards/BG/Enemy_Def", typeof(Sprite)) as Sprite; } else { image.sprite = Resources.Load("Textures/Cards/BG/Enemy_Spec", typeof(Sprite)) as Sprite; } } Face.sprite = Resources.Load("Textures/Cards/Face/" + ID, typeof(Sprite)) as Sprite; } } /* * 卡片执行 */ public void OnExecute() { print("卡片 " + ID + " 启动," + Target.CurrentAttr.ID + " 受到攻击..."); Target.GetDamage(-Value); // 判断BUFF是否存在,如果存在,则运行BUFF if (BuffID != null) { if (Target != null) { print("攻击附带BUFF " + BuffID); BuffManager.Instance.LoadBuff(Target.gameObject, BuffID); } } } } }