Ejemplo n.º 1
0
    void ReadIniFile(string filePath)
    {
        IniFileReader iniFR = new IniFileReader();

        if (iniFR.ReadFile(Path.Combine(Application.dataPath, filePath)))
        {
            string value = null;
            iniFR.GetParameter("Background", "speed", out value);
            float.TryParse(value, out startingParams.background.speed);

            value = null;
            iniFR.GetParameter("Ballon", "moveTime", out value);
            float.TryParse(value, out startingParams.ballon.moveTime);

            value = null;
            iniFR.GetParameter("Ballon", "canRoll", out value);
            bool.TryParse(value, out startingParams.ballon.canRoll);

            value = null;
            iniFR.GetParameter("Ballon", "rotationSpeed", out value);
            float.TryParse(value, out startingParams.ballon.rotationSpeed);

            value = null;
            iniFR.GetParameter("Ballon", "canKill", out value);
            bool.TryParse(value, out startingParams.ballon.canKill);

            value = null;
            iniFR.GetParameter("Bomb", "moveTime", out value);
            float.TryParse(value, out startingParams.bomb.moveTime);

            value = null;
            iniFR.GetParameter("Bomb", "canRoll", out value);
            bool.TryParse(value, out startingParams.bomb.canRoll);

            value = null;
            iniFR.GetParameter("Bomb", "rotationSpeed", out value);
            float.TryParse(value, out startingParams.bomb.rotationSpeed);

            value = null;
            iniFR.GetParameter("Bomb", "explosionLenghtTime", out value);
            float.TryParse(value, out startingParams.bomb.explosionLenghtTime);

            value = null;
            iniFR.GetParameter("Bomb", "destroyDelayTime", out value);
            float.TryParse(value, out startingParams.bomb.destroyDelayTime);

            value = null;
            iniFR.GetParameter("Bomb", "canKill", out value);
            bool.TryParse(value, out startingParams.bomb.canKill);

            value = null;
            iniFR.GetParameter("Crystal", "moveTime", out value);
            float.TryParse(value, out startingParams.crystal.moveTime);

            value = null;
            iniFR.GetParameter("Crystal", "canRoll", out value);
            bool.TryParse(value, out startingParams.crystal.canRoll);

            value = null;
            iniFR.GetParameter("Crystal", "rotationSpeed", out value);
            float.TryParse(value, out startingParams.crystal.rotationSpeed);

            value = null;
            iniFR.GetParameter("Crystal", "canKill", out value);
            bool.TryParse(value, out startingParams.crystal.canKill);

            //value = null;
            //iniFR.GetParameter("Mineral", "moveTime", out value);
            //float.TryParse(value, out startingParams.mineral.moveTime);

            //value = null;
            //iniFR.GetParameter("Mineral", "canRoll", out value);
            //bool.TryParse(value, out startingParams.mineral.canRoll);

            //value = null;
            //iniFR.GetParameter("Mineral", "rotationSpeed", out value);
            //float.TryParse(value, out startingParams.mineral.rotationSpeed);

            //value = null;
            //iniFR.GetParameter("Mineral", "canKill", out value);
            //bool.TryParse(value, out startingParams.mineral.canKill);

            value = null;
            iniFR.GetParameter("Player", "moveTime", out value);
            float.TryParse(value, out startingParams.player.moveTime);

            value = null;
            iniFR.GetParameter("Player", "secondsForBallon", out value);
            int.TryParse(value, out startingParams.player.secondsForBallon);

            value = null;
            iniFR.GetParameter("Player", "startingSecondsOfOxygen", out value);
            int.TryParse(value, out startingParams.player.startingSecondsOfOxygen);

            value = null;
            iniFR.GetParameter("Player", "deathDelaySeconds", out value);
            int.TryParse(value, out startingParams.player.deathDelay);

            value = null;
            iniFR.GetParameter("Stone", "moveTime", out value);
            float.TryParse(value, out startingParams.stone.moveTime);

            value = null;
            iniFR.GetParameter("Stone", "canRoll", out value);
            bool.TryParse(value, out startingParams.stone.canRoll);

            value = null;
            iniFR.GetParameter("Stone", "rotationSpeed", out value);
            float.TryParse(value, out startingParams.stone.rotationSpeed);

            value = null;
            iniFR.GetParameter("Stone", "canKill", out value);
            bool.TryParse(value, out startingParams.stone.canKill);
        }
    }