Beispiel #1
0
        public override void Update(double deltaTime)
        {
            if (Input.GetKeyDown(Key.Enter))
            {
                /* var go = new GameObject();
                 * go.transform.position = this.transform.position;
                 * go.transform.rotation = this.transform.rotation;
                 * var renderer = go.AddComponent<MeshRenderer>();
                 * renderer.mesh = Factory.GetMesh(path);
                 * renderer.material.albedo = new Vector4(colors[(next++)%colors.Length]);
                 * var rb = go.AddComponent<Rigidbody>();
                 * rb.velocity = this.transform.forward*20;
                 * go.AddComponent<BoxCollider>();*/

                var go = LegoPiece.Create();

                go.transform.position = this.transform.position;
                go.transform.rotation = this.transform.rotation;

                var rb = go.GetComponent <Rigidbody>();
                if (rb)
                {
                    rb.velocity = this.transform.forward * 20;
                }
            }
        }
Beispiel #2
0
        public override void Start()
        {
            var r     = new Random();
            int count = 10;

            while (count-- > 0)
            {
                var go = LegoPiece.Create();
                go.transform.position = new Vector3((float)r.NextDouble() * 20 - 10, (float)r.NextDouble() * 5, (float)r.NextDouble() * 20 - 10);
            }
        }