public IEnergyPart Create(EnergyType type, double directionX, double directionY, double directionZ,
                                  IColor color, double value, string region)
        {
            IGraphicsObject graphic = _creator.CreateGraphic(type, value, directionX, directionY, directionZ, color);

            return(new EnergyPart(graphic, region, value));
        }
        /* Constructors */
        public CollisionObject(IGraphicsObject parent)
            : base(parent, 0.0f)
        {
            #if DEBUG
            /* Create the 1x1 white texture */
            if (mDebugTexture == null)
            {
                mDebugTexture = new Texture2D(parent.ComponentOwner.GraphicsDevice, 1, 1);
                mDebugTexture.SetData(new Color[] { Color.White });
            }
            #endif

            mCollideableTypes = new Type[0];

            /* Add the collision object to the collision manager */
            var manager = parent.ComponentOwner.GetCollisionManager();
            if (manager == null)
            {
                parent.ComponentOwner.Game.Log("No collision manager present!");
            }
            else
            {
                manager.AddChild(this);
            }
        }
示例#3
0
        public void RemoveObject(IGraphicsObject a_object)
        {
            while (m_handle == IntPtr.Zero)
            {
                Thread.Yield();
            }

            a_object.DisposeObject();
        }
示例#4
0
        public void AddObject(IGraphicsObject a_object)
        {
            while (m_handle == IntPtr.Zero)
            {
                Thread.Yield();
            }

            a_object.ModifyObject();
        }
 public void OnClick(object sender, MouseButtonEventArgs e)
 {
     if (e.Button == MouseButton.Left)
     {
         _selectedObject = GetNearestObject(GetOnRaycast(GetVisibleObjects()));
         if (_selectedObject != null)
         {
             OnSelectionChange?.Invoke(this, new SelectObjectEventArgs()
             {
                 SelectedObject = _selectedObject
             });
         }
     }
 }
示例#6
0
        public VertexShader(string a_source, Pipeline a_pipeline)
        {
            m_pipeline = a_pipeline;

            if (m_pipeline.ApplicationType == e_ApplicationType.Managed)
            {
                m_internalObject = new OpenTKVertexShader(a_source, m_pipeline);
            }
            else
            {
                m_internalObject = new NativeVertexShader(a_source, m_pipeline);
            }

            m_pipeline.AddObject(this);
        }
示例#7
0
        public void OnSelectionEvent(IGraphicsObject graphicsObject)
        {
            var atlas = _objects.Where(o => o is SpintronicsObject)
                        .Where(o => (o as SpintronicsObject).GraphicsObject == graphicsObject).FirstOrDefault();
            var energy = _energies.Where(e => e is SpintronicsEnergy)
                         .Where(o => (o as SpintronicsEnergy).GraphicsObjects.Any(g => g == graphicsObject)).FirstOrDefault();

            if (atlas != null)
            {
                OnClickSelectMethod(atlas, typeof(IObject));
            }
            else
            {
                OnClickSelectMethod(energy, typeof(IEnergy));
            }
        }
示例#8
0
        public T Cast <T>(IGraphicsObject obj, string parameterName) where T : class, IGraphicsObject
        {
            if (obj == null)
            {
                throw new ArgumentNullException(parameterName);
            }
            if (obj.IsDisposed)
            {
                throw new ObjectDisposedException(parameterName);
            }
            T ret = obj as T;

            if (ret == null)
            {
                throw new ArgumentException("GraphicsObject is not part of this api.", parameterName);
            }
            if (obj.GraphicsDevice != this)
            {
                throw new ArgumentException("GraphicsObject is not part of this graphics device.", parameterName);
            }
            return(ret);
        }
示例#9
0
 /* Constructors */
 public Circle(IGraphicsObject parent, float radius)
     : base(parent)
 {
     Radius = radius;
 }
示例#10
0
        protected void SetGraphicsObjects(IGraphicsObject fullGraphics, IGraphicsObject emptyGraphics)
        {
            if (fullGraphics == null) { throw new ArgumentNullException("The item block's \"full\" graphics cannot be null."); }
            if (emptyGraphics == null) { throw new ArgumentNullException("The item block's \"empty\" graphics cannot be null."); }

            this.fullGraphics = fullGraphics;
            this.emptyGraphics = emptyGraphics;
        }
示例#11
0
 public void RemoveObject(IGraphicsObject a_object)
 {
     m_disposalQueue.Enqueue(a_object);
 }
示例#12
0
 public void AddObject(IGraphicsObject a_object)
 {
     m_inputQueue.Enqueue(a_object);
 }
示例#13
0
 public void Add(IGraphicsObject obj)
 {
     objects.Add(obj);
 }
示例#14
0
        public void Deserialize(string json)
        {
            JObject obj = JObject.Parse(json);

            string resourceName = (string)obj["resourceName"];
            BackgroundScrollDirection direction = (BackgroundScrollDirection)(int)obj["scrollDirection"];
            float scrollRate = (float)obj["scrollRate"];

            BackgroundTextureResourceName = resourceName;
            backgroundTexture = ContentPackageManager.GetGraphicsResource(BackgroundTextureResourceName);
            ScrollDirection = direction;
            ScrollRate = scrollRate;
        }
示例#15
0
 /// <summary>
 ///   Initializes this layer.
 /// </summary>
 public void Initialize()
 {
     backgroundTexture = ContentPackageManager.GetGraphicsResource(BackgroundTextureResourceName);
 }
示例#16
0
 public override void LoadContent()
 {
     graphics = ContentPackageManager.GetGraphicsResource(GraphicsResourceName);
     graphics.LoadContent();
 }
示例#17
0
 public Circle(IGraphicsObject parent)
     : base(parent)
 {
     Radius = new Vector2(parent.GetBounds().X, parent.GetBounds().Y).Length() * 0.5f;
 }
 public SpintronicsExchange(IMifEnergy energy, IGraphicsObject graphic)
 {
     _energy  = energy;
     _graphic = graphic;
 }
示例#19
0
 public void RemoveObject(IGraphicsObject a_object)
 {
     m_internalPipeline.RemoveObject(a_object);
 }
示例#20
0
 public void AddObject(IGraphicsObject a_object)
 {
     m_internalPipeline.AddObject(a_object);
 }
 public static void Remove(IGraphicsObject @object)
 {
     _elements.Remove(@object);
 }
 public static void Add(IGraphicsObject @object)
 {
     _elements.Add(@object);
 }