Пример #1
0
        private void DrawEditor(int _timeInMS)
        {
            DepthStencilState dss = new DepthStencilState();

            dss.DepthBufferEnable            = false;
            GraphicsDevice.DepthStencilState = dss;

            SamplerState sampleState = new SamplerState();

            sampleState.Filter              = TextureFilter.Anisotropic;
            sampleState.AddressU            = TextureAddressMode.Clamp;
            sampleState.AddressV            = TextureAddressMode.Clamp;
            GraphicsDevice.SamplerStates[0] = sampleState;
            GraphicsDevice.BlendState       = BlendState.AlphaBlend;

            GameObject selected = _editor.GetSelectedGameObject();

            if (selected != null)
            {
                selected.DrawSelection();
                CatComponent quadRender = selected.
                                          GetComponent("Catsland.Plugin.BasicPlugin.QuadRender");
                if (quadRender != null)
                {
                    ((ISelectable)quadRender).DrawSelection();
                }
            }
            if (Mgr <Scene> .Singleton._debugDrawableList != null)
            {
                Mgr <Scene> .Singleton._debugDrawableList.Draw(_timeInMS);
            }
        }
Пример #2
0
        public bool RemoveComponent(Type _componentType)
        {
            if (m_components == null)
            {
                return(false);
            }
            string component_name = _componentType.ToString();

            if (m_components.ContainsKey(component_name))
            {
                CatComponent catComponent = m_components[component_name];
                m_components.Remove(component_name);
                catComponent.UnbindFromScene(m_scene);
                return(true);
            }
            return(false);
        }
Пример #3
0
 /**
  * @brief add components
  *
  * @param component the component
  * */
 public void AddComponent(CatComponent _component)
 {
     if (_component != null)
     {
         string key = _component.GetType().ToString();
         if (m_components == null)
         {
             m_components = new Dictionary <string, CatComponent>();
         }
         m_components.Add(key, _component);
         _component.GameObject = this;
         // if the gameObject has been added to the scene, the component
         //  should initialize itself
         if (m_scene != null)
         {
             _component.BindToScene(m_scene);
             _component.Initialize(m_scene);
         }
     }
 }