コード例 #1
0
        private void CreateUnit(GameObject other, string[] info, string name, GameObject player)
        {
            UnitGroup type = null;

            switch (info[1])
            {
            case "generic_archer":
                type = other.AddComponent <ArcherGroup>();
                break;

            case "generic_swordsman":
                type = other.AddComponent <Swordsman>();
                break;

            case "generic_knight":
                type = other.AddComponent <KnightGroup>();
                break;
            }
            type.SetParams(int.Parse(info[0]));
            type.Init(name.Equals("Enemy") ? Color.red : Color.blue, name);
            type.SetSoldierStatus();
            type.SetPlayer(player);
        }