Exemplo n.º 1
0
            public void ParseProps()
            {
                var sections      = m_Props.Split(';');
                int finalStacking = 0;
                var staticProps   = new List <StaticPropsEntry>();
                var generateProps = new List <GeneratePropsEntry>();

                foreach (var section in sections)
                {
                    var equalsSplit = section.Split('=');
                    // Need both sides of the equals
                    if (equalsSplit.Length < 2)
                    {
                        continue;
                    }

                    if (equalsSplit[0] == "stacking")
                    {
                        finalStacking = int.Parse(equalsSplit[1]);
                    }
                    else // random prop
                    {
                        if (equalsSplit[1].Contains("-"))
                        {
                            var dashSplit = equalsSplit[1].Split('-');
                            if (finalStacking == 0)
                            {
                                finalStacking = 1;                     //props are generated so we can't stack this item
                            }
                            generateProps.Add(new GeneratePropsEntry()
                            {
                                m_Name = equalsSplit[0], m_Low = float.Parse(dashSplit[0]), m_High = float.Parse(dashSplit[1])
                            });
                        }
                        else
                        {
                            staticProps.Add(new StaticPropsEntry()
                            {
                                m_Name = equalsSplit[0], m_Value = equalsSplit[1]
                            });
                        }
                    }
                }
                m_Stacking      = finalStacking;
                m_GenerateProps = new GenerateProps()
                {
                    m_Entries = generateProps.ToArray()
                };
                m_StaticProps = new StaticProps()
                {
                    m_Entries = staticProps.ToArray()
                };
            }
Exemplo n.º 2
0
        public ValveBspFile(string filePath)
        {
            Name      = Path.GetFileNameWithoutExtension(filePath);
            _filePath = filePath;

            using (var reader = new BinaryReader(File.OpenRead(filePath)))
            {
                _header = Header.Read(reader);
            }

            InitializeLumps();

            DisplacementManager = new DisplacementManager(this);
            LightmapLayout      = new LightmapLayout(this);
            StaticProps         = new StaticProps(this);
        }
Exemplo n.º 3
0
 void Awake()
 {
     Instance = this;
 }