Exemple #1
0
    //attack Timer Finished Event
    // Fire laser + reset timer duration
    void LaserFire()
    {
        GameObject laser = ObjectPools.GetLaser();

        laser.SetActive(true);
        laser.transform.position = transform.position - new Vector3(2 * radius, 0, 0);
        laser.GetComponent <Laser> ().StartMoving(-20f);
        laserCD.Duration = Random.Range(0.1f, 0.5f);
        laserCD.Run();
    }
Exemple #2
0
 // Update is called once per frame
 void Update()
 {
     // Fire!
     if (Input.GetKeyDown("space") && !laserCD.Running)
     {
         GameObject laser = ObjectPools.GetLaser();
         laser.SetActive(true);
         laser.transform.position = transform.position + new Vector3(2 * radius, 0, 0);
         laser.GetComponent <Laser> ().StartMoving(20f);
         laserCD.Run();
     }
 }