상속: ConcreteAttribute
예제 #1
0
 public CharacterData(AttackAttribute attackAttribute, DefenseAttribute defenseAttribute, SpeedAttribute speedAttribute, HealthAttribute healthAttribute)
 {
     this.attackAttribute  = attackAttribute;
     this.defenseAttribute = defenseAttribute;
     this.speedAttribute   = speedAttribute;
     this.HealthAttribute  = healthAttribute;
 }
 public CharacterData(AttackAttribute attackAttribute, DefenseAttribute defenseAttribute, SpeedAttribute speedAttribute, HealthAttribute healthAttribute)
 {
     this.attackAttribute = attackAttribute;
     this.defenseAttribute = defenseAttribute;
     this.speedAttribute = speedAttribute;
     this.HealthAttribute = healthAttribute;
 }
    public void Perform(ControllableUnit sourceUnit, ControllableUnit targetUnit)
    {
        AttributeBonus damageOutcome = new AttributeBonus(-2, 1);

        HealthAttribute healthAttribute = targetUnit.GetCharacterData().GetHealthAttribute();

        healthAttribute.AddAttributeBonus(damageOutcome);

        Debug.Log("Normal attack skill to " + targetUnit + ". Unit new HP is: " + targetUnit.GetCharacterData().GetHealthAttribute().GetModifiedValue());


        this.PerformAnimation(sourceUnit, targetUnit);
    }
    private void CharacterTestDefault()
    {
        AttackAttribute  attackAttribute  = new AttackAttribute(1, 1.0f);
        DefenseAttribute defenseAttribute = new DefenseAttribute(1, 1.0f);
        HealthAttribute  healthAttribute  = new HealthAttribute(1, 1.0f);
        SpeedAttribute   speedAttribute   = new SpeedAttribute(1, 1.0f);

        this.character = new CharacterData(attackAttribute, defenseAttribute, speedAttribute, healthAttribute);

        Debug.Log("-----Default Stats------");
        Debug.Log("Health: " + this.character.GetHealthAttribute().GetModifiedValue() +
                  " Attack: " + this.character.GetAttackAttribute().GetModifiedValue() +
                  " Defense: " + this.character.GetDefenseAttribute().GetModifiedValue() +
                  " Speed: " + this.character.GetSpeedAttribute().GetModifiedValue());
        Debug.Log("----Default Stats End----");
    }
    private void CharacterTestDefault()
    {
        AttackAttribute attackAttribute = new AttackAttribute(1, 1.0f);
        DefenseAttribute defenseAttribute = new DefenseAttribute(1, 1.0f);
        HealthAttribute healthAttribute = new HealthAttribute(1,1.0f);
        SpeedAttribute speedAttribute = new SpeedAttribute(1,1.0f);

        this.character = new CharacterData(attackAttribute, defenseAttribute, speedAttribute, healthAttribute);

        Debug.Log ("-----Default Stats------");
        Debug.Log ("Health: " +this.character.GetHealthAttribute().GetModifiedValue() +
            " Attack: " +this.character.GetAttackAttribute().GetModifiedValue() +
            " Defense: " +this.character.GetDefenseAttribute().GetModifiedValue() +
            " Speed: " +this.character.GetSpeedAttribute().GetModifiedValue());
        Debug.Log ("----Default Stats End----");
    }