Пример #1
0
    void LoadFromDataBase()
    {
        listSquadInfo.Clear();
        dbconn.Open();
        dbcmd = dbconn.CreateCommand();
        string sqlQuery = "SELECT * FROM CurrentMissionSquadSetup";

        dbcmd.CommandText = sqlQuery;
        reader            = dbcmd.ExecuteReader();
        while (reader.Read())
        {
            SquadStruct temp = new SquadStruct();
            temp.squadID     = reader.GetInt32(0);
            temp.unit1ID     = reader.GetInt32(1);
            temp.unit2ID     = reader.GetInt32(2);
            temp.unit3ID     = reader.GetInt32(3);
            temp.unit4ID     = reader.GetInt32(4);
            temp.position.x  = reader.GetFloat(5);
            temp.position.y  = reader.GetFloat(6);
            temp.position.z  = reader.GetFloat(7);
            temp.squadHealth = reader.GetFloat(8);
            listSquadInfo.Add(temp);
        }
        dbconn.Close();
    }
 //Method: Start
 //Purpose -- This method is mainly used for initialization
 //of a class' private data fields. Use this method when
 //initializing stuff, do it here and only here.
 void Start()
 {
     squadInfo = SquadManager.instance.CurrentSquad;
     //=======Testing righ now. Need to call with parameter to create multiple Golem with golem ID========
     SpawnManager.instance.SpawnUnit(1, leftEnd);
     SetupGolem();
     //CameraManager.instance.CameraManager_MainEnemy = listOfGolem[0];
     GetAllUnitOnMap();
 }