Esempio n. 1
0
    public Actor(int maxHp, int armor, int defence, string image, string element)
    {
        this._maxHp        = new ListenableProperty <int>(maxHp);
        this._armor        = new ListenableProperty <int>(armor);
        this._defence      = new ListenableProperty <int>(defence);
        this._healthPoint  = new ListenableRangeProperty <int>(maxHp, maxHp, 0);
        this._frozen       = new ListenableProperty <bool>(false);
        this._alive        = new ListenableProperty <bool>(true);
        this._attackEnable = new ListenableProperty <bool>(true);
        this._focusAble    = new ListenableProperty <bool>(true);

        this._buffList = new FilteredListenableList <IBuff>();
        this._image    = new ListenableProperty <string>(image);
        this._element  = new ListenableProperty <string>(element);

        this._turnStartListeners = new ListenableList <IActorTurnStartListener>();

        this._attackDecoratorList      = new ListenableList <IStrategyDecorator <AttackInfo> >();
        this._underAttackDecoratorList = new ListenableList <IStrategyDecorator <AttackInfo> >();

        this._buffList.SetSorting(new IBuffComparator());
        this._attackDecoratorList.SetSorting(new IDecoratorComparator());
        this._underAttackDecoratorList.SetSorting(new IDecoratorComparator());
        this._turnStartListeners.SetSorting(new ITurnStartListenerComparator());
    }
Esempio n. 2
0
 public void OnPropertyChanged(ListenableProperty <int> property, int fromValue, int toValue)
 {
     if (property == this._elementCard.Cost)
     {
         SetStar(toValue);
     }
 }
Esempio n. 3
0
 protected Card(string element, JClassInfo[] targetEffectList, JClassInfo[] sourceEffectList, bool isAOE, bool isAgainEnemy)
 {
     this._element          = element;
     this._isAgainstEnemy   = new ListenableProperty <bool>(isAgainEnemy);
     this._isAOE            = new ListenableProperty <bool>(isAOE);
     this._targetEffectList = targetEffectList;
     this._sourceEffectList = sourceEffectList;
 }
Esempio n. 4
0
 public void OnPropertyChanged(ListenableProperty <bool> property, bool fromProperty, bool toProperty)
 {
     if (null == _focusRender)
     {
         _focusRender = transform.GetChild(1).GetComponent <SpriteRenderer>();
     }
     _focusRender.enabled = toProperty;
 }
Esempio n. 5
0
    // 綁定Power
    public void Bind(ListenableProperty <int> powerProperty)
    {
        this._power = powerProperty;
        Init();

        // 監聽 cardset改變事件
        this._power.AddListener(this);
        this.SetPower(powerProperty.Property);
    }
Esempio n. 6
0
 public void OnPropertyChanged(ListenableProperty <string> property, string fromValue, string toValue)
 {
     if (property == this._ultimateCard.Title)
     {
         SetTitle(toValue);
     }
     else if (property == this._ultimateCard.Description)
     {
         SetDescription(toValue);
     }
 }
Esempio n. 7
0
 public void OnPropertyChanged(ListenableProperty <int> property, int fromProperty, int toProperty)
 {
     if (property == _enemyInstance.HealthPoint)
     {
         SetHP(property.Property);
     }
     else if (property == _enemyInstance.Armor)
     {
         SetArmor(property.Property);
     }
     else if (property == _enemyInstance.Defence)
     {
         SetDefence(property.Property);
     }
 }
Esempio n. 8
0
 public void OnPropertyChanged(ListenableProperty <int> property, int fromProperty, int toProperty)
 {
     if (property == _player.HealthPoint)
     {
         SetHP(toProperty);
     }
     else if (property == _player.Armor)
     {
         SetArmor(toProperty);
     }
     else if (property == _player.Defence)
     {
         SetDefence(toProperty);
     }
 }
Esempio n. 9
0
    public UltimateCardInstance(string language, JUltimateCardProperties properties) : base(properties.Element, properties.TargetEffects, properties.PlayerEffects, properties.IsAOE, properties.IsAgainstEnemy)
    {
        this._jUltimateCardProperties = properties;
        this._title       = new ListenableProperty <string>(null);
        this._description = new ListenableProperty <string>(null);

        //處理語言
        foreach (JCardLocale local in _jUltimateCardProperties.locales)
        {
            if (language.Equals(local.language))
            {
                this._title.Property       = local.data.Title;
                this._description.Property = local.data.Description;
                break;
            }
        }
    }
Esempio n. 10
0
    private ListenableList <ElementCardInstance> _handheldSet;    //墓地

    public PlayerInstance(string language, JCharacterProperties properties) : base(properties.MaxHp, properties.Armor, properties.Defence, properties.Image, properties.Element)
    {
        this._jCharacterProperties = properties;

        this._power     = new ListenableProperty <int>(properties.Power);
        this._drawCount = new ListenableProperty <int>(properties.DrawCount);
        this._name      = new ListenableProperty <string>(null);

        this._ultimateCards = new ListenableList <UltimateCardInstance>();
        this._cardDeck      = new ListenableList <ElementCardInstance>();
        this._graveyard     = new ListenableList <ElementCardInstance>();
        this._handheldSet   = new ListenableList <ElementCardInstance>();

        foreach (JCharacterLocale local in properties.locales)
        {
            if (language.Equals(local.language))
            {
                this._name.Property = local.data.Name;
                break;
            }
        }
    }
Esempio n. 11
0
 public void OnPropertyChanged(ListenableProperty <int> property, int fromValue, int toValue)
 {
     this.SetPower(toValue);
 }
Esempio n. 12
0
 public void Reset()
 {
     this._cost = new ListenableProperty <int>(this._jElementCardProperties.Cost);
 }
Esempio n. 13
0
 // On Currrent Actor changed
 public void OnPropertyChanged(ListenableProperty <Actor> property, Actor fromValue, Actor toValue)
 {
     SetClickable(property.Property is PlayerInstance);
 }
Esempio n. 14
0
 // Binding
 public void Bind(ListenableProperty <Actor> currentActor)
 {
     this._currentActor = currentActor;
     this._currentActor.AddListener(this);
     SetClickable(currentActor.Property is PlayerInstance);
 }