Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     lazorCooldown     = lazorCooldownMax;
     health            = GetComponent <Health>();
     lazorLowerScript  = lazorLower.GetComponent <lazorScript>();
     lazorMiddleScript = lazorMiddle.GetComponent <lazorScript>();
     lazorTopScript    = lazorTop.GetComponent <lazorScript>();
 }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (!health.dead)
        {
            if (attackable == false)
            {
                lazorLowerScript.fireBeam();
                attackable = true;
            }

            if (canFire)
            {
                if (firstShot == null)
                {
                    firstShot            = randomFire();
                    firstShot.lazorState = LazorState.Ready;
                }
                else
                {
                    if (firstShot.lazorState == LazorState.Dormant)
                    {
                        firstShot = null;
                    }
                    else
                    {
                        firstShot.fireBeam();
                    }
                }
                if (secondShot == null)
                {
                    secondShot            = randomFire();
                    secondShot.lazorState = LazorState.Ready;
                }
                else
                {
                    if (secondShot.lazorState == LazorState.Dormant)
                    {
                        secondShot = null;
                    }
                    else
                    {
                        secondShot.fireBeam();
                    }
                }

                if (secondShot == null && firstShot == null)
                {
                    canFire = false;
                }
            }
        }
    }