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);
            }
        }
Example #3
0
        public void RemoveObject(IGraphicsObject a_object)
        {
            while (m_handle == IntPtr.Zero)
            {
                Thread.Yield();
            }

            a_object.DisposeObject();
        }
Example #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
             });
         }
     }
 }
Example #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);
        }
Example #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));
            }
        }
Example #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);
        }
Example #9
0
 /* Constructors */
 public Circle(IGraphicsObject parent, float radius)
     : base(parent)
 {
     Radius = radius;
 }
Example #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;
        }
Example #11
0
 public void RemoveObject(IGraphicsObject a_object)
 {
     m_disposalQueue.Enqueue(a_object);
 }
Example #12
0
 public void AddObject(IGraphicsObject a_object)
 {
     m_inputQueue.Enqueue(a_object);
 }
Example #13
0
 public void Add(IGraphicsObject obj)
 {
     objects.Add(obj);
 }
Example #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;
        }
Example #15
0
 /// <summary>
 ///   Initializes this layer.
 /// </summary>
 public void Initialize()
 {
     backgroundTexture = ContentPackageManager.GetGraphicsResource(BackgroundTextureResourceName);
 }
Example #16
0
 public override void LoadContent()
 {
     graphics = ContentPackageManager.GetGraphicsResource(GraphicsResourceName);
     graphics.LoadContent();
 }
Example #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;
 }
Example #19
0
 public void RemoveObject(IGraphicsObject a_object)
 {
     m_internalPipeline.RemoveObject(a_object);
 }
Example #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);
 }