Example #1
0
 public void DestroyPrimitive(IRenderPrimitive primitive)
 {
     //var wpfRenderPrimitive = primitive as WPFRenderPrimitive;
     //if (wpfRenderPrimitive != null)
     if (primitive is WPFRenderPrimitive wpfRenderPrimitive)
     {
         WpfCanvas.Children.Remove(wpfRenderPrimitive.WpfImage);
         primitives.Remove(wpfRenderPrimitive);
     }
 }
Example #2
0
        public void OnTick(float dt, IRenderPrimitive SourcePrimitive)
        {
            time += dt;

            if (time >= Speed)
            {
                SetImageByIndex((currentIndex + 1) % ImageCount, SourcePrimitive);
                time -= Speed;
            }
        }
Example #3
0
 public void DestroyPrimitive(IRenderPrimitive primitive)
 {
     // проверяет, что primitive типа WPFRenderPrimitive
     // и кастует сразу же к нему
     if (primitive is WPFRenderPrimitive wpfRenderPrimitive)
     {
         WpfCanvas.Children.Remove(wpfRenderPrimitive.WpfImage);
         primitives.Remove(wpfRenderPrimitive);
     }
 }
Example #4
0
        public override void OnAttachToWorld()
        {
            if (World.RenderManager != null)
            {
                RenderPrimitive = World.RenderManager.CreatePrimitive();

                RenderPrimitive.Size      = Size;
                RenderPrimitive.Position  = Position;
                RenderPrimitive.ImageName = ImageName;
            }
        }
Example #5
0
        // тут просто захардкожено добавление физических моделей к определённым ячейкам
        public void AddPhysicsModel(IRenderPrimitive initPrimitive)
        {
            var cellWithPhysics = new MapObject
            {
                Position = initPrimitive.Position,
                Size     = initPrimitive.Size
            };

            var PhysicModel = new PhysicsSphere
            {
                IsSatatic = true,
                Radius    = cellWithPhysics.Size.Length() / 2.0f,
                MapObject = cellWithPhysics
            };

            World.PhysicsManager.Models.Add(PhysicModel);
        }
Example #6
0
 public void SetImageByIndex(int index, IRenderPrimitive SourcePrimitive)
 {
     currentIndex = index;
     SourcePrimitive.ImageName = string.Format(PathMask, index + 1);
 }