Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        armRotation.y += Input.GetAxis("RHoriz") * panSpeed;
        armRotation.x += Input.GetAxis("RVert") * panSpeed;

        transform.position = player.transform.position;
        transform.rotation = Quaterion.Euler(armRotation);
    }
Ejemplo n.º 2
0
 public MoveToData(   Vector3 pos,
         Vector3 scale,
         Quaterion rot,
         bool flip,
         bool instant,
         float ttt = 0.0f,
         bool smooth = false)
 {
     NewPos = pos;
     NewScale = scale;
     NewRot = rot;
     this.flip = flip;
     this.instant = instant;
     this.ttt = ttt;
     this.originalTTT = ttt;
 }
Ejemplo n.º 3
0
 public MoveToData
     (Vector3 pos,
     Vector3 scale,
     Quaterion rot,
     bool flip,
     bool instant,
     float ttt   = 0.0f,
     bool smooth = false)
 {
     NewPos           = pos;
     NewScale         = scale;
     NewRot           = rot;
     this.flip        = flip;
     this.instant     = instant;
     this.ttt         = ttt;
     this.originalTTT = ttt;
 }
 void OnTriggerEnter(Collider hit)
 {
     //player has hit the collider
     if (hit.gameObject.tag == Constants.PlayerTag)
     {
         //find whether the next path will be straight, left or right
         int pathChoice = Random.Range(1, Paths.Length);
         var path       = Paths[pathChoice - 1];
         //Get offset between new path and old path
         int offset = (int)PreviousPath.transform.position.y - (int)path.transform.position.y;
         //Create Path
         Instantiate(path, path.transform.position, Quaterion.Euler(path.transform.rotation));
         //REduce offset to acceptable range
         while (offset > 360)
         {
             offset -= 360;
         }
         //Straight
         if (offset == 0)
         {
             //Add to queue
             GameManager.getManager().getDirection().Enqueue(GameManager.turnDirection.Straight);
             return;
         }
         //Generate left border
         if (offset == -90 || offset == 270)
         {
             var border = BorderSpawnPoints[0];
             Instantiate(border, border.position, border.rotation);
             GameManager.getManager().getDirection().Enqueue(GameManager.turnDirection.Left);
             return;
         }
         //Generate right border
         if (offset == 90)
         {
             var border = BorderSpawnPoints[1];
             Instantiate(border, border.position, border.rotation);
             //Add to direction queue
             GameManager.getManager().getDirection().Enqueue(GameManager.turnDirection.right);
             return;
         }
     }
 }