ThreeKingdomsSlingshot/Assets/Scripts/OutGame/Domestic/DevTree.cs

76 lines
2.1 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using UnityEngine;
namespace TKS.OutGame
{
/// <summary>내정 개발 트리(dev_tree.csv · 기획서 §7 · S11) — 갈래(상업·농업·공업) × 노드(소 n/10 · 큰 노드 n/3) · 효과 키 · 비용(골드 · 도면) · 선행 조건.</summary>
public class DevTree : ScriptableObject
{
[Serializable]
public class Req
{
public string node;
public int lv;
}
[Serializable]
public class Node
{
public string branch;
public string id;
public string nameKo;
[Tooltip("small | big")]
public string kind;
[Tooltip("효과 키(「;」 여럿 = 같은 레벨 값)")]
public string effectKey;
public float pctPerLv;
public int lvMax;
public int goldBase;
public float goldGrowth;
public int blueprintFromLv;
public int blueprintPerLv;
public List<Req> requires = new List<Req>();
public bool Big
{
get { return kind == "big"; }
}
public string[] EffectKeys
{
get { return effectKey.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); }
}
}
public List<Node> nodes = new List<Node>();
public Node Get(string id)
{
foreach (var n in nodes)
if (n.id == id) return n;
return null;
}
/// <summary>갈래 순서(표에 처음 나온 순서).</summary>
public List<string> Branches
{
get
{
var l = new List<string>();
foreach (var n in nodes)
if (!l.Contains(n.branch)) l.Add(n.branch);
return l;
}
}
public List<Node> InBranch(string branch)
{
var l = new List<Node>();
foreach (var n in nodes)
if (n.branch == branch) l.Add(n);
return l;
}
}
}