Beispiel #1
0
 //初期化
 void Start()
 {
     m_physicalData = new List <AttackData>();
     m_magicData    = new List <AttackData>();
     for (PhysicalName i = 0; i < PhysicalName.number; i++)
     {
         m_physicalData.Add(new AttackData());
         ReadPhysicalDataCsv(i);
     }
     for (MagicName i = 0; i < MagicName.number; i++)
     {
         m_magicData.Add(new AttackData());
         ReadMagicDataCsv(i);
     }
 }
Beispiel #2
0
    //魔法攻撃データを入力する
    void ReadMagicDataCsv(MagicName magic)
    {
        List <List <bool> > attackArea;     //攻撃範囲
        TextAsset           csv;            //テキストアセット
        StringReader        reader;         //文字列読み込みクラス
        string line;                        //読み込み文字列

        string[] values;                    //読み込み文字列の単語
        int      count;                     //凡庸カウンター

        csv    = Resources.Load("CSV/" + MagicNameString(magic)) as TextAsset;
        reader = new StringReader(csv.text);
        if (reader.Peek() == -1)
        {
            return;
        }
        //余分な文字列を排除する
        line = reader.ReadLine();
        //魔法の基礎データを入力
        line   = reader.ReadLine();
        values = line.Split(',');
        m_magicData[(int)magic].m_attackType     = AttackType.Magic;
        m_magicData[(int)magic].m_attackProperty = (AttackProperty)int.Parse(values[0]);
        //余分な文字列を排除する
        line = reader.ReadLine();
        //魔法の攻撃範囲の情報を取得
        attackArea = new List <List <bool> >();
        count      = 0;
        while (reader.Peek() > -1)
        {
            line   = reader.ReadLine();
            values = line.Split(',');
            attackArea.Add(new List <bool>());
            for (int i = 0; i < values.Length; i++)
            {
                if (int.Parse(values[i]) == 0)
                {
                    attackArea[count].Add(false);
                }
                else
                {
                    attackArea[count].Add(true);
                }
            }
Beispiel #3
0
    //魔法攻撃の名前を返す
    private static string MagicNameString(MagicName magic)
    {
        switch (magic)
        {
        case MagicName.fire:
            return("Fire");

        case MagicName.water:
            return("Water");

        case MagicName.wind:
            return("Wind");

        case MagicName.soil:
            return("Soil");

        default:
            return("");
        }
    }
Beispiel #4
0
 public Magic(MagicName Name, string Description)
 {
     _name = Name;
     _description = Description;
 }