Unity3D自学笔记——架构应用(十)角色属性

角色属性

效果图
这里写图片描述

类图
这里写图片描述

Attribute
提供公共的参数,每个参数都有两个值
Atk, 基础值,就是白属性
AtkMax, 计算后的值,就是附魔,升级,强化,镶嵌,充人民币后的值

public abstract class Attribute
{
    private Attribute m_Parent;
    public int Hp { get; set; }
    public int Mp { get; set; }
    public int Atk { get; set; }
    public int Def { get; set; }
    public int Spd { get; set; }
    public int Hit { get; set; }
    public double CriticalRate { get; set; }
    public double AtkSpd { get; set; }
    public double AtkRange { get; set; }
    public double MoveSpd { get; set; }

    public int HpMax { get; set; }
    public int MpMax { get; set; }
    public int AtkMax { get; set; }
    public int DefMax { get; set; }
    public int SpdMax { get; set; }
    public int HitMax { get; set; }
    public double CriticalRateMax { get; set; }
    public double AtkSpdMax { get; set; }
    public double AtkRangeMax { get; set; }
    public double MoveSpdMax { get; set; }

    public abstract void Calculate();

    protected void SetParent(AttributeNode child)
    {
        child.m_Parent = this.m_Parent;
    }
    public Attribute GetParent()
    {
        return this.m_Parent;
    }
}

AttributNode
继承Attribute,递归实现Caculate,然后实现添加节点和删除节点
就是给白属性不断的加各种效果

public class AttributeNode : Attribute
{
    private List<Attribute> m_NodeList = new List<Attribute>();
    public override void
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值