Esempio n. 1
0
    void HandleFiring()
    {
        if (secondsToNextCannon > 0)
        {
            secondsToNextCannon -= Time.deltaTime;
        }

        if (secondsToNextCannon <= 0 &&
            (Input.GetKey(KeyCode.Space) || Input.GetMouseButton(0) || IsHaywireActive(HaywireType.ShipCannonsNonStop)))
        {
            CannonBehaviour currentCannon = cannons[nextCannon];

            bool backwards = IsHaywireActive(HaywireType.ShipCannonsBackwards);
            bool weighted  = IsHaywireActive(HaywireType.ShipProjectilesWeighted);

            currentCannon.FireCannon(backwards, weighted);

            secondsToNextCannon = GetCannonCooldownTime();
            nextCannon         += 1;
            if (nextCannon >= cannons.Count)
            {
                nextCannon = 0;
            }
        }
    }
    protected override void HandleFiring()
    {
        if (targetPlayer != null) {
            if (secondsToNextCannon > 0) {
                secondsToNextCannon -= Time.deltaTime;
            }

            if (secondsToNextCannon <= 0) {
                CannonBehaviour currentCannon = cannons[nextCannon];
                currentCannon.FireCannon(true);

                secondsToNextCannon = cannonCooldownTime + (Random.Range(0, 0.50f) * cannonCooldownTime);
                nextCannon += 1;
                if (nextCannon >= cannons.Count) nextCannon = 0;
            }
        }
    }