Exemplo n.º 1
0
        public override void Init(int nGPU)
        {
            discreteCosineTransform = MyKernelFactory.Instance.Kernel(nGPU, @"\DCTKernel", "DiscreteCosineTransform");
            discreteCosineTransform.SetupExecution(Owner.MaxNumberOfCoefficients * Owner.MaxNumberOfWeights);
            discreteCosineTransform.DynamicSharedMemory = sizeof(float) * (uint)Owner.MaxNumberOfCoefficients;

            if (agent)
            {
                agentWorld = (My2DAgentWorld)Owner.Owner.World;
            }
            else if (grid)
            {
                gridworld = (MyGridWorld)Owner.Owner.World;
            }
        }
 public override void Init(int nGPU)
 {
     if (Owner.Owner.World is MyGridWorld)
     {
         MyGridWorld w     = (MyGridWorld)Owner.Owner.World;
         String[]    names = null;
         if (Owner.ConnectedToGlobal)
         {
             names = w.Engine.GetGlobalOutputDataNames();
         }
         else
         {
             names = w.Engine.GetGlobalOutputVarNames();
         }
         for (int i = 0; i < names.Length; i++)
         {
             Owner.Rds.VarManager.GetVarNo(i).SetLabel(names[i]);
         }
     }
     else
     {
         MyLog.DEBUG.WriteLine("MyGridWorld world expected, will not parse variable names.");
     }
 }
Exemplo n.º 3
0
 public void UpdateGraphics(MyGridWorld.MyGraphicsPrototype off_g, MyGridWorld.MyGraphicsPrototype on_g)
 {
     this.OnGraphics = on_g;
     this.OffGraphics = off_g;
     if (this.IsOn())
     {
         this.Graphics = on_g;
     }
     else
     {
         this.Graphics = off_g;
     }
 }
Exemplo n.º 4
0
        public void registerGraphics(
            MyGridWorld.MyGraphicsPrototype empty_g,
            MyGridWorld.MyGraphicsPrototype obstacle_g,
            MyGridWorld.MyGraphicsPrototype agent_g,
            MyGridWorld.MyGraphicsPrototype doorOpened_g,
            MyGridWorld.MyGraphicsPrototype doorClosed_g,
            MyGridWorld.MyGraphicsPrototype doorControl_g,
            MyGridWorld.MyGraphicsPrototype doorControlOff_g,
            MyGridWorld.MyGraphicsPrototype lightsControl_g,
            MyGridWorld.MyGraphicsPrototype lightsControlOff_g,
            MyGridWorld.MyGraphicsPrototype lightsOff_g,
            MyGridWorld.MyGraphicsPrototype lightsOn_g)
        {
            Agent.Graphics = agent_g;

            // register all tales' graphics
            for (int j = 0; j < m_height; j++)
            {
                for (int i = 0; i < m_width; i++)
                {
                    if (Tiles[i, j].IsObstacle)
                    {
                        Tiles[i, j].Graphics = empty_g;
                    }
                    else
                    {
                        Tiles[i, j].Graphics = obstacle_g;
                    }
                }
            }

            // all static objects
            MyStaticObject tmp;
            for (int i = 0; i < StaticObjects.Length; i++)
            {
                tmp = StaticObjects[i];
                if (tmp is DoorControl)
                {
                    //tmp.graphics = doorControl_g;
                    ((AbstractTwoStateObject)tmp).UpdateGraphics(doorControl_g, doorControlOff_g);
                }
                else if (tmp is LightsControl)
                {
                    //tmp.graphics = lightsControl_g;
                    ((AbstractTwoStateObject)tmp).UpdateGraphics(lightsControl_g, lightsControlOff_g);
                }
                else if (tmp is MyDoor)
                {
                    ((AbstractTwoStateObject)tmp).UpdateGraphics(doorOpened_g, doorClosed_g);
                }
                else if (tmp is Lights)
                {
                    ((AbstractTwoStateObject)tmp).UpdateGraphics(lightsOn_g, lightsOff_g);
                }
            }
        }