123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- 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<Image>();
- if (Face != null) {
- // 加载图片
- Image image = gameObject.GetComponent<Image>();
- 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<string, object> info = new Dictionary<string, object>();
- info.Add("card", this);
- EventListener.Instance.PostEvent(EventEnum.EVENT_DEFENSE_CARD_EXECUTE, info);
- }
- }
- }
|