using System.Collections; using System.Collections.Generic; using UnityEngine; using FSRole; using FSEvent; using UnityEngine.UI; namespace FSCard { /* * 防守牌 */ public class DefCard : 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; } } // Update is called once per frame void Update() { } /* * 卡片执行 */ public void OnExecute() { Dictionary info = new Dictionary(); info.Add("card", this); EventListener.Instance.PostEvent(EventEnum.EVENT_DEFENSE_CARD_EXECUTE, info); } } }