• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Cube类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Cube的典型用法代码示例。如果您正苦于以下问题:C# Cube类的具体用法?C# Cube怎么用?C# Cube使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Cube类属于命名空间,在下文中一共展示了Cube类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: getCubeEffectDefinition

 public static EffectDefinition getCubeEffectDefinition(Cube.CubeEffect_e effect)
 {
     if (EFFECT_DEFS.ContainsKey(effect)) {
         return EFFECT_DEFS[effect];
     }
     return new EffectDefinition();
 }
开发者ID:spencewenski,项目名称:Vision,代码行数:7,代码来源:Shoot.cs


示例2: Main

        static void Main(string[] args)
        {
            // Create four-element Shape array
            Shape[] shapes = new Shape[4];

            // Populate array with objects that implement Shape
            shapes[0] = new Square(10); //length of side is 10
            shapes[1] = new Circle(5); //radius is 5
            shapes[2] = new Sphere(5); //radius is 5
            shapes[3] = new Cube(10); //length of side is 10

            // Process each element in array shapes
            foreach (Shape shape in shapes)
            {
                if (shape is TwoDimensionalShape)
                {
                    Console.WriteLine(shape);
                    Console.WriteLine("The area is {0:N} square units.", shape.Area);
                    Console.WriteLine();
                }
                else
                {
                    // Downcast Shape reference to ThreeDimensionalShape
                    ThreeDimensionalShape Shape = (ThreeDimensionalShape)shape;
                    Console.WriteLine(shape);
                    Console.WriteLine("The area is {0:N} square units.", shape.Area);
                    Console.WriteLine("The volume is {0:N} cubic units.", Shape.Volume);
                    Console.WriteLine();
                }
            }
            Console.Read();
        }
开发者ID:amynpeterson,项目名称:COP2360AmyPeterson,代码行数:32,代码来源:TestShape.cs


示例3: MazeCube

 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="cube">
 /// A <see cref="Cube"/>
 /// </param>
 public MazeCube(Cube cube)
 {
     this.cube = cube;
     cube.userData = this;
     this.cube.TiltEvent += OnTilt;
     this.cube.ButtonEvent += OnButton;
 }
开发者ID:amechtley,项目名称:Reunion,代码行数:13,代码来源:MazeCube.cs


示例4: FormSceneSample

        /// <summary>
        /// Initializes a new instance of the <see cref="FormSceneSample"/> class.
        /// </summary>
        public FormSceneSample()
        {
            InitializeComponent();

            sceneControl1.MouseDown += new MouseEventHandler(FormSceneSample_MouseDown);
            sceneControl1.MouseMove += new MouseEventHandler(FormSceneSample_MouseMove);
            sceneControl1.MouseUp += new MouseEventHandler(sceneControl1_MouseUp);

            //  Add some design-time primitives.
            sceneControl1.Scene.SceneContainer.AddChild(new
                UnU.OpenGL.SceneGraph.Primitives.Grid());
            sceneControl1.Scene.SceneContainer.AddChild(new
                UnU.OpenGL.SceneGraph.Primitives.Axies());

            //  Create a light.
            Light light = new Light()
            {
                On = true,
                Position = new Vertex(3, 10, 3),
                GLCode = OpenGL.GL_LIGHT0
            };

            //  Add the light.
            sceneControl1.Scene.SceneContainer.AddChild(light);

            //  Create a sphere.
            Cube cube = new Cube();
            cube.AddEffect(arcBallEffect);

            //  Add it.
            sceneControl1.Scene.SceneContainer.AddChild(cube);

            //  Add the root element to the tree.
            AddElementToTree(sceneControl1.Scene.SceneContainer, treeView1.Nodes);
        }
开发者ID:chantsunman,项目名称:sharpgl,代码行数:38,代码来源:FormSceneSample.cs


示例5: Calculate

	public CubeMesh Calculate(ref int visualVertexCount, ref int collisionVertexCount, Cube[,,] cubes, CubeLegend cubeLegend, ColliderType colliderType, string cubeTag) {
		// TODO: Put this back in when preprocessor directives are supported in Boo
		// Use UNITY_EDITOR
		//CubeGeneratorProgressEditor.ReportCube(chunk.gridPosition, gridPosition) if chunk
		
		// TODO: Vector3i.zero
		// TODO: Cached cube position of the chunk
		var position = (indexes - (chunk.dimensionsInCubes * chunk.gridPosition)).ToVector3() * cubeSize;
		
		var meshData = new CubeMesh();
		
		if(!AdjacentCubeExistsInsideChunk(cubes, indexes.Down))  AddSide(Direction.Down,  position, ref visualVertexCount, cubeLegend, meshData);
		if(!AdjacentCubeExistsInsideChunk(cubes, indexes.Up))	  AddSide(Direction.Up,    position, ref visualVertexCount, cubeLegend, meshData);
		if(!AdjacentCubeExistsInsideChunk(cubes, indexes.Right)) AddSide(Direction.Right, position, ref visualVertexCount, cubeLegend, meshData);
		if(!AdjacentCubeExistsInsideChunk(cubes, indexes.Left))  AddSide(Direction.Left,  position, ref visualVertexCount, cubeLegend, meshData);
		if(!AdjacentCubeExistsInsideChunk(cubes, indexes.Front)) AddSide(Direction.Front, position, ref visualVertexCount, cubeLegend, meshData);
		if(!AdjacentCubeExistsInsideChunk(cubes, indexes.Back))  AddSide(Direction.Back,  position, ref visualVertexCount, cubeLegend, meshData);
		
		if (cubeLegend.cubeDefinitions[type].hasCollision) {
			if(colliderType == ColliderType.MeshColliderPerChunk) {
				if(!AdjacentCubeExistsInsideChunkWithCollision(cubes, cubeLegend, indexes.Down))  AddCollisionSide(Direction.Down,  position, ref collisionVertexCount, cubeLegend, meshData);
				if(!AdjacentCubeExistsInsideChunkWithCollision(cubes, cubeLegend, indexes.Up))	   AddCollisionSide(Direction.Up,    position, ref collisionVertexCount, cubeLegend, meshData);
				if(!AdjacentCubeExistsInsideChunkWithCollision(cubes, cubeLegend, indexes.Right)) AddCollisionSide(Direction.Right, position, ref collisionVertexCount, cubeLegend, meshData);
				if(!AdjacentCubeExistsInsideChunkWithCollision(cubes, cubeLegend, indexes.Left))  AddCollisionSide(Direction.Left,  position, ref collisionVertexCount, cubeLegend, meshData);
				if(!AdjacentCubeExistsInsideChunkWithCollision(cubes, cubeLegend, indexes.Front)) AddCollisionSide(Direction.Front, position, ref collisionVertexCount, cubeLegend, meshData);
				if(!AdjacentCubeExistsInsideChunkWithCollision(cubes, cubeLegend, indexes.Back))  AddCollisionSide(Direction.Back,  position, ref collisionVertexCount, cubeLegend, meshData);
			}
			else if(colliderType == ColliderType.BoxColliderPerCube) {
				// TODO: Defer this until the game objects are being created for async compatibility
//				if(generateCollider) CreateCollision(cubeTag);
			}
		}
		return meshData;
	}
开发者ID:carriercomm,项目名称:cubed,代码行数:34,代码来源:Cube.cs


示例6: addEffect

 public void addEffect(Cube.CubeEffect_e effect)
 {
     if (effects.Contains(effect)) {
         return;
     }
     effects.Add(effect);
 }
开发者ID:spencewenski,项目名称:Vision,代码行数:7,代码来源:Shoot.cs


示例7: Configure

	public void Configure()
	{
		Cube = FindObjectOfType<Cube>();

		if ( Node == null ) return;

		if ( Node.Type == NodeTypeEnum.Start )
		{
			var go = Instantiate( Cube.StartPointPrefab ) as GameObject;
			if ( go != null )
			{
				go.transform.parent = transform;
				go.transform.localPosition = Vector3.zero;
				go.transform.localEulerAngles = new Vector3( -90, 0, 0 );
			}

		}
		else if ( Node.Type == NodeTypeEnum.End )
		{
			var go = Instantiate( Cube.EndPointPrefab ) as GameObject;
			if ( go != null )
			{
				go.transform.parent = transform;
				go.transform.localPosition = Vector3.zero;
				go.transform.localEulerAngles = new Vector3( -90, 0, 0 );
			}
		}

		Node.Quad = this;

		StartCoroutine( WaitForFrame() );
	}
开发者ID:DigitalMachinist,项目名称:tojam10-david-and-goliath,代码行数:32,代码来源:Quad.cs


示例8: Main

        static void Main(string[] args)
        {
            string command = Console.ReadLine();
            while(command != "End")
            {
                string[] tokens = command.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);
                switch(tokens[0])
                {
                    case "Cube":
                        Cube cube = new Cube(double.Parse(tokens[1]));
                        Console.WriteLine("{0:F3}", VolumeCalculator.CubeVolume(cube));
                        break;
                    case "Cylinder":
                        Cylinder cylinder = new Cylinder(double.Parse(tokens[1]), double.Parse(tokens[2]));
                        Console.WriteLine("{0:F3}", VolumeCalculator.CylinderVolume(cylinder));
                        break;
                    case "TrianglePrism":
                        TriangularPrism prism = new TriangularPrism(double.Parse(tokens[1]), double.Parse(tokens[2]),
                            double.Parse(tokens[3]));
                        Console.WriteLine("{0:F3}", VolumeCalculator.TriangularPrismVolume(prism));
                        break;
                }

                command = Console.ReadLine();
            }
        }
开发者ID:hammer4,项目名称:SoftUni,代码行数:26,代码来源:Program.cs


示例9: Solve

        /// <summary>
        /// Solves the cube and returns the list of the movements to be done.
        /// </summary>
        /// <returns>List of movements to be sent to the robot</returns>
        public List<Movement> Solve(String inputCubeString)
        {
            // isto não existirá! é apenas para testarmos enviando como entrada do Solver um cubo em formato string
            // para testarmos o algoritmo dos movimentos... na implementação final, esta linha
            // No algoritmo real, passo da visão já fornecerá a estrutura do cubo montada
            Cube = TranslateInputStringToCube(inputCubeString);

            // valida o cubo, primeiramente
            if (!Cube.Validate())
                return new List<Movement>();

            // traduz cubo para a entrada da DLL
            inputCubeString = TranslateCubeToSolverInput(Cube);

            // chama dll em C
            String outputOfSolver = SolveRubikCube(inputCubeString);

            // traduz movimentos retornados para uma lista de Movement (movements)
            // os RotateFaceMovement.PositionFace não estão preenchidos, pois nesta etapa,
            // ainda não se tem esta informação. eles serão preenchdiso no AdjustMovementsBasedOnTheClaws
            List<Movement> movements = TranslateStringToListOfMovements(outputOfSolver);

            // add rotation movements to bring faces to the robot claws
            AdjustMovementsBasedOnTheClaws(movements);

            return movements;
        }
开发者ID:petcomputacaoufrgs,项目名称:roborubik,代码行数:31,代码来源:RobotCubeSolver.cs


示例10: ToString

        /// <summary>
        /// Converts this object to an OpenSCAD script
        /// </summary>
        /// <returns>Script for this object</returns>
        public override string ToString()
        {
            OSCADObject inner = new Cube(new Vector3(this.Size.X - WallThickness*2, 
                this.Size.Y - WallThickness*2, 
                this.Size.Z - WallThickness*2),
                this.Center);
                        
            if (!this.Bottom && !this.Top)
            {
                ((Cube)inner).Size.Z += WallThickness * 4;
            }
            else if (!this.Top)
            {
                ((Cube)inner).Size.Z += WallThickness*2;
                inner = inner.Translate(0, 0, WallThickness);
            }
            else if (!this.Bottom)
            {
                ((Cube)inner).Size.Z += WallThickness*2;
                inner = inner.Translate(0, 0, -WallThickness);
            }


            if (!this.Center)
            {
                inner = inner.Translate(this.WallThickness, this.WallThickness, this.WallThickness);
            }

            OSCADObject box = new Cube(this.Size, this.Center) - inner;

            return box.ToString();
        }
开发者ID:Exolun,项目名称:OSCADSharp,代码行数:36,代码来源:Box.cs


示例11: Robot

        public Robot(World w, Vector2 pos)
        {
            cube = new Cube(new Vector3(pos.X, 0, pos.Y), RM.GetTexture("robot"));
            Position = pos;
            Direction = new Vector2(0, 0);
            CanRun = false;
            supportsCamera = true;

            HudIcons.Add(new HudIcon() { text = "Robocam", texture = RM.GetTexture("camera"), Action = (() => w.ToggleCamera(this)) });
            HudIcons.Add(new HudIcon() { text = "Move", texture = RM.GetTexture("arrowupicon"), Action = (() => moving = !moving) });
            HudIcons.Add(new HudIcon() { text = "Turn left", texture = RM.GetTexture("arrowlefticon"), Action = (() => {
                Matrix cameraRotation = Matrix.CreateRotationY(0.05f);
                Vector3 rotTarget = LookDir.ToVector3();
                var result = Vector3.Transform(rotTarget, cameraRotation);
                LookDir = result.ToVector2();
                lastCamDir = result;
            }), OnDown = true });
            HudIcons.Add(new HudIcon()
            {
                text = "Turn right",
                texture = RM.GetTexture("arrowrighticon"),
                Action = (() =>
                {
                    Matrix cameraRotation = Matrix.CreateRotationY(-0.05f);
                    Vector3 rotTarget = LookDir.ToVector3();
                    var result = Vector3.Transform(rotTarget, cameraRotation);
                    LookDir = result.ToVector2();
                    lastCamDir = result;
                }),
                OnDown = true
            });
            HudIcons.Add(new HudIcon() { text = "Grab/drop", texture = RM.GetTexture("grabicon"), Action = ToggleGrab });
        }
开发者ID:Frib,项目名称:LD25,代码行数:33,代码来源:Robot.cs


示例12: DrawTo

        /// <summary>
        /// Draws to the supplied cube.
        /// </summary>
        /// <param name='cube'>
        /// The cube to which the room should be drawn.
        /// </param>
        public void DrawTo(Cube cube)
        {
            // draw the background
            cube.FillScreen(bgColor);

            // draw the center
            cube.FillRect(passageColor, segmentSize, segmentSize, segmentSize, segmentSize);

            // draw open passages
            for (int i=0; i<entryStates.Length; i++)
            {
                if (entryStates[i] == EntryState.Closed) continue;
                int x=segmentSize, y=segmentSize;
                switch ((Cube.Side)i)
                {
                case Cube.Side.BOTTOM:
                    y = 2*segmentSize;
                    break;
                case Cube.Side.LEFT:
                    x = 0;
                    break;
                case Cube.Side.RIGHT:
                    x = 2*segmentSize;
                    break;
                case Cube.Side.TOP:
                    y = 0;
                    break;
                }
                cube.FillRect(passageColor, x, y, segmentSize, segmentSize);
            }

            // paint the cube
            cube.Paint();
        }
开发者ID:dennispr,项目名称:Reunion,代码行数:40,代码来源:MazeRoom.cs


示例13: Main

    //TODO: fixup display of numbers to match .net
    static void Main()
    {
        // Input the side:
        System.Console.Write("Enter the side: ");
        double side = 5;//double.Parse(System.Console.ReadLine());

        // Compute the areas:
        Square s = new Square(side);
        Cube c = new Cube(side);

        // Display the results:
        System.Console.Write("Area of the square =");
        System.Console.WriteLine(s.Area);
        System.Console.Write("Area of the cube =");
        System.Console.WriteLine(c.Area);
        // System.Console.WriteLine();

        // Input the area:
        System.Console.Write("Enter the area: ");
        double area = 125; //double.Parse(System.Console.ReadLine());

        // Compute the sides:
        s.Area = area;
        c.Area = area * 6;

        // Display the results:
        System.Console.Write("Side of the square = ");
        System.Console.WriteLine((int)s.side);
        System.Console.Write("Side of the cube = ");
        System.Console.WriteLine((int)c.side);
    }
开发者ID:mortezabarzkar,项目名称:SharpNative,代码行数:32,代码来源:AbstractTest01.cs


示例14: SideOf

 public Cube.Side SideOf(Cube c)
 {
     if (this._neighbors[(int)Cube.Side.TOP] == c) return Cube.Side.TOP;
     if (this._neighbors[(int)Cube.Side.RIGHT] == c) return Cube.Side.RIGHT;
     if (this._neighbors[(int)Cube.Side.LEFT] == c) return Cube.Side.LEFT;
     if (this._neighbors[(int)Cube.Side.BOTTOM] == c) return Cube.Side.BOTTOM;
     return Cube.Side.NONE;
 }
开发者ID:veatchje,项目名称:Siftables-477,代码行数:8,代码来源:Neighbors.cs


示例15: AlarmPanel

 public AlarmPanel(Vector2 pos)
     : base(pos)
 {
     workTime = 0;
     cube = new Cube(new Vector3(pos.X, 0, pos.Y), RM.GetTexture("work"));
     cube.ScaleVector = new Vector3(8, 1, 8);
     cube.SetPosition(Position.ToVector3());
 }
开发者ID:Frib,项目名称:LD25,代码行数:8,代码来源:Workplace.cs


示例16: Main

 public static void Main()
 {
    double x = 5.2;
    Square s = new Square(x);
    Square c = new Cube(x);
    Console.WriteLine("Area of Square = {0:F2}", s.Area());
    Console.WriteLine("Area of Cube = {0:F2}", c.Area());
 }
开发者ID:hattya,项目名称:ctags,代码行数:8,代码来源:input.cs


示例17: Incinerator

        public Incinerator(Vector2 position)
        {
            this.Position = position;
            cube = new Cube(new Vector3(position.X, 0, position.Y), RM.GetTexture("incinerator"));

            cube.ScaleVector = new Vector3(24, 64, 24);
            cube.SetPosition(position.ToVector3() + new Vector3(0, -56, 0));
        }
开发者ID:Frib,项目名称:LD25,代码行数:8,代码来源:Incinerator.cs


示例18: DefaultSettingsInit_Test

        public void DefaultSettingsInit_Test()
        {
            Cube<int> cube = new Cube<int>();

            cube.Initialize();

            Assert.AreEqual(StorageType.Molap,cube.Storage.StorageType);
        }
开发者ID:arman-arian,项目名称:NSimpleOLAP,代码行数:8,代码来源:CubeInitializationTests.cs


示例19: Actor

        public Actor( CubeGame game, CubeScreen screen, Cube cube, Vector3 worldPos, Direction upDir )
            : this(game, screen)
        {
            Cube = cube;
            mCubePosition = worldPos;
            UpDir = upDir;

            CubeFace = Cube.GetFaceFromPosition( mCubePosition );
        }
开发者ID:theLOLflashlight,项目名称:CyberCube,代码行数:9,代码来源:Actor.cs


示例20: Contains

 public bool Contains(Cube c)
 {
     for (int i = 0; i < 4; i++)
     {
         if (this._neighbors[i] == c)
             return true;
     }
     return false;
 }
开发者ID:veatchje,项目名称:Siftables-477,代码行数:9,代码来源:Neighbors.cs



注:本文中的Cube类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CubeFlag类代码示例发布时间:2022-05-24
下一篇:
C# CsvWriter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap