Exemplo n.º 1
0
        // Sets up scene elements
        private void CreateScene()
        {
            // Subscribe to touch event
            Input.SubscribeToTouchMove(OnTouched);

            // Createnew scene
            scene = new Scene();

            // Creates default scene octree (-1000:1000)
            sceneOctree = scene.CreateComponent <Octree>();

            // Create camera node and then attach camera object to it
            Node cameraNode = scene.CreateChild("camera");

            camera = cameraNode.CreateComponent <Camera>();

            // HACK: Arbitraty position.. for now!
            cameraNode.Position = new Vector3(20, -40, -140);

            // Create background plane
            Node backPlaneNode = scene.CreateChild("backPlane");

            backPlane = backPlaneNode.CreateComponent <Urho.Shapes.Plane>();
            backPlane.SetMaterial(Material.FromColor(new Color(0.1f, 0.1f, 0.1f), true));

            // Rotate plane
            backPlaneNode.SetScale(500);
            backPlaneNode.Position = new Vector3(0, 0, 180);
            backPlaneNode.Rotate(new Quaternion(-90, 0, 0), TransformSpace.Local);
        }
Exemplo n.º 2
0
        public GridElement(int _id, Vector3 position, int width, int height, Color color)
        {
            Position = position;
            Width    = width;
            Height   = height;
            id       = _id;

            // Create plane node and attach a plane shape to it
            Node planeNode = CreateChild("plane");

            backgroundPlane = planeNode.CreateComponent <Urho.Shapes.Plane>();

            // Set unlit color
            backgroundPlane.SetMaterial(Material.FromColor(color, true));

            // Set scale
            planeNode.SetScale(20);

            // Rotate plane
            planeNode.Rotate(new Quaternion(-90, 0, 0), TransformSpace.Local);
        }