Exemple #1
0
        public static void InitRoleNumberic(DUnit role)
        {
            NumericComponent numeric = role.AddComponent <NumericComponent>();
            URoleConfig      config  = role.GetComponent <URoleConfigComponent>().RoleConfig;

            // 最大血量
            numeric.Set(NumericType.MaxHpBase, config.HP);
            // 血量
            numeric.Set(NumericType.HpBase, config.HP);
            // 速度
            numeric.Set(NumericType.SpeedBase, config.MoveSpeed);
            // 攻速
            numeric.Set(NumericType.AttackSpeedBase, config.AttackSpeed);
            // 攻击力
            numeric.Set(NumericType.HPDamageBase, config.HPDamage);
            // 警戒范围
            numeric.Set(NumericType.AlertRadiusBase, config.AlertRadius);
        }
Exemple #2
0
        public static int GetBattleRoleCount(DUnit tower)
        {
            NumericComponent numeric = tower.GetComponent <NumericComponent>();
            int halfHpAdd            = (numeric.GetAsInt(NumericType.Hp) - numeric.GetAsInt(NumericType.HpBase)) / 2;

            if (halfHpAdd <= 0)
            {
                return(0);
            }

            int         RoleId     = tower.GetComponent <UTowerConfigComponent>().TowerConfig.RoleId;
            URoleConfig RoleConfig = URoleConfigCategory.Instance.Get(RoleId);

            if (RoleConfig == null)
            {
                return(0);
            }

            return(halfHpAdd / RoleConfig.HP);
        }