Esempio n. 1
0
    /// <summary>
    /// Updates the image of the army and the number of units in it
    /// Usually called after the underlying model is updated
    /// </summary>
    private void Update()
    {
        UnitType armyRepresentative = GameUtils.GetRepresentative(_model.GetUnits());

        _armyImage.material.mainTexture = SpriteCollectionManager.GetTextureByName(armyRepresentative.GetName());
        _quantityField.text             = _model.GetUnitsCount().ToString();
    }
Esempio n. 2
0
    public void UpdateView()
    {
        if (_armyImage == null)
        {
            Debug.Log("Army view image renderer destroyed in " + _province.GetName());
            return;
        }

        UnitType representative = GameUtils.GetRepresentative(_province.GetUnits());

        if (representative != null)
        {
            _armyImage.material.mainTexture = SpriteCollectionManager.GetTextureByName(representative.GetName());
        }
        else
        {
            _armyImage.material.mainTexture = SpriteCollectionManager.GetTextureByName("empty");
        }
        _quantity = CountUnits();
        if (_quantity > 0)
        {
            _quantityField.text = _quantity.ToString();
        }
        else
        {
            _quantityField.text = "";
        }
    }
 public void SetModel(WoundCheckEvent eventData, UnitType unitType)
 {
     _model = eventData;
     _unitImage.material.mainTexture = SpriteCollectionManager.GetTextureByName(unitType.GetName());
     _target.text            = "Need to Roll:";
     _roll.text              = "Rolling 1d" + unitType.GetHitPoints() + ":";
     _result.text            = "";
     _unitQuantityField.text = "";
     _unitHealthField.text   = "";
 }
Esempio n. 4
0
 public void SetModel(UnitStack unitStack)
 {
     _model = unitStack;
     _model.WoundCheckMade                += OnWoundCheckMade;
     _unitImage.material.mainTexture       = SpriteCollectionManager.GetTextureByName(_model.GetUnitType().GetName());
     _mouseListener.MouseClickDetected    += OnStackSelected;
     _mouseOverListener.MouseOverDetected += OnStackInspected;
     _mouseOverListener.MouseExitDetected += OnStackInspectionEnd;
     _explosion.gameObject.SetActive(false);
     _healing.gameObject.SetActive(false);
     UpdateView();
 }
 public void SetModel(AttackResolutionEvent eventData)
 {
     _model = eventData;
     _defenderImage.material.mainTexture = SpriteCollectionManager.GetTextureByName(_model.GetTarget().GetUnitType().GetName());
     _attackerImage.material.mainTexture = SpriteCollectionManager.GetTextureByName(_model.GetAttack().GetUnitType().GetName());
     _attackerRoll.text          = "";
     _defenderRoll.text          = "";
     _hitOrMissMessage.text      = "";
     _damageRoll.text            = "";
     _defenderArmor.text         = "";
     _finalDamage.text           = "";
     _defenderQuantityField.text = "";
     _defenderHealthField.text   = "";
     StartCoroutine("UpdateView");
 }