扩充游戏内容,保持敌人基本行为不变,使用缩放和颜色区分不同敌人
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace SepCore.DataTable
|
||||
@@ -30,6 +31,10 @@ namespace SepCore.DataTable
|
||||
|
||||
public float DropPercent { get; private set; }
|
||||
|
||||
public float Scale { get; private set; } = 1f;
|
||||
|
||||
public Color Color { get; private set; } = Color.white;
|
||||
|
||||
public Dictionary<string, string> Params { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
@@ -50,17 +55,23 @@ namespace SepCore.DataTable
|
||||
DropCoin = int.Parse(columnStrings[index++]);
|
||||
DropExp = int.Parse(columnStrings[index++]);
|
||||
DropPercent = float.Parse(columnStrings[index++]);
|
||||
Scale = float.Parse(columnStrings[index++]);
|
||||
Color = ParseColor(columnStrings[index++]);
|
||||
Params = DeserializeParams(columnStrings[index++]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解参数
|
||||
/// </summary>
|
||||
/// <param name="rawParams"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
private static Color ParseColor(string raw)
|
||||
{
|
||||
if (ColorUtility.TryParseHtmlString(raw.Trim(), out Color color))
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
return Color.white;
|
||||
}
|
||||
|
||||
private Dictionary<string, string> DeserializeParams(string rawParams)
|
||||
{
|
||||
if (!rawParams.StartsWith('[') || !rawParams.EndsWith(']'))
|
||||
|
||||
@@ -5,5 +5,10 @@ namespace SepCore.Definition
|
||||
None = 0,
|
||||
MeleeEnemy = 1,
|
||||
RemoteEnemy = 2,
|
||||
BatEnemy = 3,
|
||||
SkeletonEnemy = 4,
|
||||
SkeletonGiantEnemy = 5,
|
||||
GhostEnemy = 6,
|
||||
FireMageEnemy = 7,
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,10 @@ namespace SepCore.Entity
|
||||
|
||||
public float DropPercent => _drEnemy.DropPercent;
|
||||
|
||||
public float Scale => _drEnemy.Scale;
|
||||
|
||||
public Color Color => _drEnemy.Color;
|
||||
|
||||
public IReadOnlyDictionary<string, string> Params => _drEnemy.Params;
|
||||
|
||||
public bool TryGetParam(string key, out string value)
|
||||
|
||||
Reference in New Issue
Block a user