示例#1
0
 private void Start()
 {
     planetaria_rigidbody         = this.GetComponent <PlanetariaRigidbody>();
     planetaria_collider          = this.GetComponent <PlanetariaCollider>();
     planetaria_collider.material = material;
     transform.direction          = Vector3.up;
     transform.localScale         = +0.1f;
     planetaria_collider.shape    = PlanetariaShape.Create(+0.1f / 2); // FIXME: cached
 }
示例#2
0
        private void Update()
        {
            Vector3 character_position  = main_character.forward;
            Vector3 controller_position = main_controller.forward;
            List <SerializedArc> laser  = new List <SerializedArc> {
                ArcFactory.line(character_position, controller_position)
            };

            arc_renderer.shape = PlanetariaShape.Create(laser, false);
            arc_renderer.recalculate();

            bool firing;

#if UNITY_EDITOR
            firing = Input.GetButton("Fire1");
#else
            firing = Input.GetButton("OSVR_IndexTrigger");
#endif
            if (firing)
            {
                arc_renderer.material.color = Color.red;
            }
            else
            {
                arc_renderer.material.color = Color.blue;
            }

            /*PlanetariaRaycastHit[] collision_info = PlanetariaPhysics.raycast_all(Arc.line(character_position, controller_position));
             * Vector3 last_position = character_position;
             * bool blue = true;
             * Color color;
             * foreach (PlanetariaRaycastHit hit in collision_info)
             * {
             *  color = blue ? Color.blue : Color.red;
             *  Debug.DrawLine(last_position, hit.point, color);
             *  last_position = hit.point;
             *  blue = !blue;
             * }
             * color = blue ? Color.blue : Color.red;
             * Debug.DrawLine(last_position, controller_position, color);
             * arc_renderer.*/

            /*if (Input.GetButtonDown("Jump"))
             * {
             *  PlanetariaGameObject.Instantiate(prefabricated_object, controller_position);
             *  //Destroy(new object, 3 seconds) + test Destroy for PlanetariaGameObject
             * }*/
        }
示例#3
0
 private ArcVisitor(PlanetariaShape shape, int index)
 {
     shape_variable = shape;
     index_variable = index;
 }
示例#4
0
 /// <summary>
 /// Constructor - finds the ArcVisitor at a given position in a shape
 /// </summary>
 /// <param name="shape">The shape representing the list of Arc segments</param>
 /// <param name="index">The index of the referenced arc segment.</param>
 /// <returns>An ArcVisitor struct (for iterating across the arcs in a block).</returns>
 public static ArcVisitor arc_visitor(PlanetariaShape shape, int index)
 {
     return(new ArcVisitor(shape, index));
 }