Beispiel #1
0
    /*
     * Read in a CSV Attack file generated from our Google Spreadsheet of attacks. Each
     * line will be an Attack, stored as a comma delimited value for each field in our Attack class.
     * Once complete, write the name of each attack in a lookup file of strings.
     */
    void ImportAttacks()
    {
        attackManager = (AttackManager)GameObject.Find(ObjectNames.MAANAGERS).GetComponent <AttackManager> ();
        if (attackManager == null)
        {
            Debug.LogError("Attack Manager could not be found");
            return;
        }
        TextAsset attackCsv = (TextAsset)Resources.Load(ATTACK_CSV, typeof(TextAsset));

        if (attackCsv == null)
        {
            Debug.LogError(string.Format("Attack file {0} failed to load correctly.", ATTACK_CSV));
            return;
        }
        attackManager.ClearAttacks();
        string[] lineArray = attackCsv.text.Split("\n" [0]);
        VerifyHeaderLine(lineArray [0]);
        for (int i = 1; i < lineArray.Length; i++)
        {
            Attack newAttack = SerializeAttackLine(lineArray [i]);
            attackManager.AddAttack(newAttack);
        }
        WriteAttacksToStringFile();
    }
 /*
  * Read in a CSV Attack file generated from our Google Spreadsheet of attacks. Each
  * line will be an Attack, stored as a comma delimited value for each field in our Attack class.
  * Once complete, write the name of each attack in a lookup file of strings.
  */
 void ImportAttacks()
 {
     attackManager = (AttackManager)GameObject.Find (ObjectNames.MAANAGERS).GetComponent <AttackManager> ();
     if (attackManager == null) {
         Debug.LogError ("Attack Manager could not be found");
         return;
     }
     TextAsset attackCsv = (TextAsset)Resources.Load (ATTACK_CSV, typeof(TextAsset));
     if (attackCsv == null) {
         Debug.LogError (string.Format ("Attack file {0} failed to load correctly.", ATTACK_CSV));
         return;
     }
     attackManager.ClearAttacks ();
     string[] lineArray = attackCsv.text.Split ("\n" [0]);
     VerifyHeaderLine (lineArray [0]);
     for (int i = 1; i < lineArray.Length; i++) {
         Attack newAttack = SerializeAttackLine (lineArray [i]);
         attackManager.AddAttack (newAttack);
     }
     WriteAttacksToStringFile ();
 }
    // Use this for initialization
    void Start()
    {
        if (!debug)
        {
            Debug.Log("Parsing Dataset...");
            string[,] grid = CSVReader.SplitCsvGrid(dataset.text);
            int rows = grid.GetLength(1);
            Debug.Log(rows);

            rows = 1000;
            for (int i = 0; i < rows - 2; i++)
            {
                attackManager.AddAttack(
                    //Debug.Log(grid[
                    float.Parse(grid [1, i]),
                    float.Parse(grid [2, i]),
                    int.Parse(grid [0, i]),
                    grid [3, i],
                    float.Parse(grid [4, i]));
            }
            Debug.Log("Finished parsing");
        }
    }
Beispiel #4
0
 // Use this for initialization
 void Start()
 {
     am.AddAttack(-85, -15, 2000, "Assassination", 1);
     am.DrawAttackLines(2000, 2000);
 }