示例#1
0
    // HELPER FUNC
    void FireCannon(Cannon _cannon, Vector3 _targetPos)
    {
        if (_targetPos.x > ManageSceneSetup.Ins.spawnHorizontalRange.y ||
            _targetPos.x < ManageSceneSetup.Ins.spawnHorizontalRange.x ||
            _targetPos.y > ManageSceneSetup.Ins.spawnVerticalRange.y ||
            _targetPos.y < ManageSceneSetup.Ins.spawnVerticalRange.x)
        {
            return;
        }

        _cannon.FireNow();
        if (_cannon.IsRecharging() || _cannon.AmmoIsDepleted())
        {
            GameEventSignals.DoCannonFailToFire();
        }
        else
        {
            GameEventSignals.DoCannonFire(_targetPos);
        }
    }