Esempio n. 1
0
        private void Load(IFileStore store)
        {
            var kvp = new KeyValuePairs();

            using (var reader = store.OpenTextFile(Path))
            {
                kvp.Load(reader);
            }

            BackgroundColour = kvp.GetColour("background_colour", Vector3.Zero);
            BackgroundImage  = kvp.GetString("background_image", null);
            AmbientColour    = kvp.GetColour("ambient_colour", Vector3.One);
            LightColour      = kvp.GetColour("light_colour", Vector3.Zero);
            LightDirection   = kvp.GetUnitVector("light_direction", -Vector3.UnitY);
            Light2Colour     = kvp.GetColour("light2_colour", Vector3.Zero);
            Light2Direction  = kvp.GetUnitVector("light2_direction", -Vector3.UnitY);

            ModelPath           = kvp.GetString("model", null);
            ForegroundModelPath = kvp.GetString("foreground_model", null);
            AnimPath            = kvp.GetString("animation", null);

            RenderPass           = kvp.GetEnum("render_pass", RenderPass.Opaque);
            ForegroundRenderPass = kvp.GetEnum("foreground_render_pass", RenderPass.Opaque);
            CastShadows          = kvp.GetBool("cast_shadows", false);
        }
 public ElevatorTileBehaviour(Tile tile, KeyValuePairs kvp) : base(tile, kvp)
 {
     Distance      = kvp.GetInteger("distance", 1);
     Speed         = 1.0f / Robot.Robot.STEP_TIME;
     Direction     = kvp.GetEnum("direction", ElevatorDirection.Up);
     Trigger       = kvp.GetEnum("trigger", ElevatorTrigger.Powered);
     RiseSoundPath = kvp.GetString("rise_sound", null);
     FallSoundPath = kvp.GetString("fall_sound", null);
 }
Esempio n. 3
0
 public SpawnTileBehaviour(Tile tile, KeyValuePairs kvp) : base(tile, kvp)
 {
     m_colour         = kvp.GetString("colour", "grey");
     m_immobile       = kvp.GetBool("immobile", false);
     m_required       = kvp.GetBool("required", m_colour != "grey" && !m_immobile);
     m_turnPreference = kvp.GetEnum("turn_preference", TurnDirection.Left);
     if (kvp.ContainsKey("robot_model"))
     {
         m_robotModel = kvp.GetString("robot_model");
     }
     else
     {
         throw new IOException("robot_model not specified");
     }
     m_robotLightColour = kvp.GetColour("light_colour", Vector3.Zero);
     if (m_robotLightColour.Value.Length <= 0.0f)
     {
         m_robotLightColour = null;
     }
     m_robotLightRadius = kvp.GetFloat("light_radius", 15.0f);
     if (m_robotLightRadius.Value <= 0.0f)
     {
         m_robotLightRadius = null;
     }
     m_robotAnimSet  = kvp.GetString("robot_animset", "animation/entities/new_robot/new_robot.animset");
     m_robotSoundSet = kvp.GetString("robot_soundset", "sound/new_robot/new_robot.soundset");
     m_guiColour     = kvp.GetColour("gui_colour", Vector3.One);
 }
Esempio n. 4
0
        private void Load(IFileStore store)
        {
            var kvp = new KeyValuePairs();

            using (var stream = store.OpenTextFile(m_path))
            {
                kvp.Load(stream);
            }

            m_vertexShaderPath = kvp.GetString("vertex_shader");
            string[] vertexShaderDefines = kvp.ContainsKey("vertex_shader_defines") ? kvp.GetString("vertex_shader_defines").Split(',') : null;
            string   vertexShaderCode    = Preprocess(store, m_vertexShaderPath, vertexShaderDefines);

            m_fragmentShaderPath = kvp.GetString("fragment_shader");
            string[] fragmentShaderDefines = kvp.ContainsKey("fragment_shader_defines") ? kvp.GetString("fragment_shader_defines").Split(',') : null;
            string   fragmentShaderCode    = Preprocess(store, m_fragmentShaderPath, fragmentShaderDefines);

            m_vertexShader = GL.CreateShader(ShaderType.VertexShader);
            GL.ShaderSource(m_vertexShader, vertexShaderCode);
            GL.CompileShader(m_vertexShader);
            CheckCompileResult(m_vertexShader);

            m_fragmentShader = GL.CreateShader(ShaderType.FragmentShader);
            GL.ShaderSource(m_fragmentShader, fragmentShaderCode);
            GL.CompileShader(m_fragmentShader);
            CheckCompileResult(m_fragmentShader);

            m_program = GL.CreateProgram();
            GL.AttachShader(m_program, m_vertexShader);
            GL.AttachShader(m_program, m_fragmentShader);
            GL.LinkProgram(m_program);
            TestLink(m_program);

            m_blendMode = kvp.GetEnum("blend_mode", BlendMode.Overwrite);
        }
Esempio n. 5
0
        public void Load(IFileStore store)
        {
            var kvp = new KeyValuePairs();

            using (var stream = store.OpenTextFile(m_path))
            {
                kvp.Load(stream);
            }

            m_modelPath       = kvp.GetString("model", null);
            m_altModelPath    = kvp.GetString("alt_model", m_modelPath);
            m_editorModelPath = kvp.GetString("editor_model", null);

            m_height      = kvp.GetInteger("height", 1);
            m_placeable   = kvp.GetBool("placeable", false);
            m_replaceable = kvp.GetBool("replaceable", false);

            m_solidity = new bool[6];
            bool solid = kvp.GetBool("solid", false);

            m_solidity[0] = kvp.GetBool("solid_front", solid);
            m_solidity[1] = kvp.GetBool("solid_right", solid);
            m_solidity[2] = kvp.GetBool("solid_back", solid);
            m_solidity[3] = kvp.GetBool("solid_left", solid);
            m_solidity[4] = kvp.GetBool("solid_top", solid);
            m_solidity[5] = kvp.GetBool("solid_bottom", solid);

            m_opacity = new bool[6];
            bool opaque = kvp.GetBool("opaque", false);

            m_opacity[0] = kvp.GetBool("opaque_front", opaque);
            m_opacity[1] = kvp.GetBool("opaque_right", opaque);
            m_opacity[2] = kvp.GetBool("opaque_back", opaque);
            m_opacity[3] = kvp.GetBool("opaque_left", opaque);
            m_opacity[4] = kvp.GetBool("opaque_top", opaque);
            m_opacity[5] = kvp.GetBool("opaque_bottom", opaque);

            m_forwardIncline = kvp.GetInteger("incline_forward", 0);
            m_rightIncline   = kvp.GetInteger("incline_right", 0);
            m_allowPlacement = kvp.GetBool("allow_placement", true);

            var behaviour = kvp.GetString("behaviour", "generic");

            m_behaviour = TileBehaviour.CreateFromName(behaviour, this, kvp);

            m_renderPass  = kvp.GetEnum("render_pass", RenderPass.Opaque);
            m_castShadows = kvp.GetBool("cast_shadows", true);
        }
Esempio n. 6
0
        public ButtonTileBehaviour(Tile tile, KeyValuePairs kvp) : base(tile, kvp)
        {
            m_poweredModelPath    = kvp.GetString("powered_model", tile.ModelPath);
            m_altPoweredModelPath = kvp.GetString("alt_powered_model", m_poweredModelPath);

            m_soundPath = kvp.GetString("sound", null);

            bool connected = kvp.GetBool("connected", false);

            m_connectivity    = new bool[6];
            m_connectivity[0] = kvp.GetBool("connected_front", connected);
            m_connectivity[1] = kvp.GetBool("connected_right", connected);
            m_connectivity[2] = kvp.GetBool("connected_back", connected);
            m_connectivity[3] = kvp.GetBool("connected_left", connected);
            m_connectivity[4] = kvp.GetBool("connected_top", connected);
            m_connectivity[5] = kvp.GetBool("connected_bottom", connected);

            m_type     = kvp.GetEnum("type", ButtonType.Momentary);
            m_inverted = kvp.GetBool("inverted", false);
            m_colour   = kvp.GetString("colour");
        }
 public ConveyorTileBehaviour(Tile tile, KeyValuePairs kvp) : base(tile, kvp)
 {
     PoweredMode   = kvp.GetEnum("powered_mode", ConveyorMode.Stopped);
     UnpoweredMode = kvp.GetEnum("unpowered_mode", ConveyorMode.Forwards);
     Animation     = kvp.GetString("animation", null);
 }
 public FallingTileBehaviour(Tile tile, KeyValuePairs kvp) : base(tile, kvp)
 {
     m_trigger = kvp.GetEnum("trigger", FallingTrigger.Automatic);
     m_sound   = kvp.GetString("sound", null);
 }
 public TurntableTileBehaviour(Tile tile, KeyValuePairs kvp) : base(tile, kvp)
 {
     TurnDirection = kvp.GetEnum("turn_direction", TurnDirection.Left);
     Animation     = kvp.GetString("animation", null);
     Sound         = kvp.GetString("sound", null);
 }