Exemple #1
0
 public void create()
 {
     if (arrow == null)
     {
         CreateWind();
         arrow = arrow_factory.GetArrow();
     }
 }
 public void Shoot()
 {
     if ((!game_over || game_start) && arrow_num <= 10)
     {
         arrow = arrow_factory.GetArrow();
         arrow_queue.Add(arrow);
         //wind direction
         Vector3 wind = new Vector3(wind_directX, wind_directY, 0);
         action_manager.ArrowFly(arrow, wind);
         //open the child camera when shoot
         child_camera.GetComponent <ChildCamera>().StartShow();
         //reduce the arrow the player can shoot
         recorder.arrow_number--;
         //add arrow count in the sense
         arrow_num++;
     }
 }
Exemple #3
0
 void Update()
 {
     if (game_start)
     {
         Vector3 mpos = Camera.main.ScreenPointToRay(Input.mousePosition).direction;
         if (Input.GetButtonDown("Fire1"))
         {
             Shoot(mpos * 15);
         }
         if (arrow == null)
         {
             arrow = arrow_factory.GetArrow();
             arrow.transform.position = bow.transform.position;
             arrow.gameObject.SetActive(true);
             arrow.GetComponent <Rigidbody>().isKinematic = true;
         }
         bow.transform.LookAt(mpos * 30);
         arrow.transform.LookAt(mpos * 30);
         arrow_factory.FreeArrow();
     }
 }