public bool selectByLockType(Radar.LockType lockType)
    {
        int goodType = -1;

        // don't bother changing if Air_or_Ground
        //  this function is only useful for selecting AMRAAM's or Mavericks
        //   in other cases, I should directly set specific weapon instead of just by lock type
        if (lockType != Radar.LockType.AIR_OR_GROUND)
        {
            for (int i = 0; i < weaponTypeHardpointLists.Count && goodType == -1; i++)
            {
                Radar weapRadar = weaponTypeHardpointLists[i][0].weaponTypePrefab.GetComponent <Radar>();

                if (weapRadar != null && weapRadar.lockType == lockType)
                {
                    goodType = i;
                }
            }
        }

        if (goodType != -1)
        {
            setWeaponType((short)goodType);
        }

        return(goodType != -1); // whether we were able to find weapon of desired radar locktype
    }
示例#2
0
    // Air to air use amraams
    // ground: use mavericks if available
    //   - if not, use rockets if available
    //   - if not, use bombs if available
    //   - if not, return false
    private bool equipProperWeapon(CombatFlow target)
    {
        Radar.LockType reqType = Radar.LockType.AIR_OR_GROUND;

        if (target.type == CombatFlow.Type.AIRCRAFT)
        {
            reqType = Radar.LockType.AIR_ONLY;
        }
        //else if(target.type == CombatFlow.Type.SAM || target.type == CombatFlow.Type.ANTI_AIR)
        else
        {
            reqType = Radar.LockType.GROUND_ONLY;
        }

        bool typeFound = hardpoints.selectByLockType(reqType);

        // Debug.Log("LockType is: " + reqType + ", so I've selected: " + hardpoints.getActiveHardpoint().weaponTypePrefab.name);

        // aircraft and sams/AAA are the only ones that require specific lock type
        // in other cases, I'll have to make AI select a specific weapon instead of just by type

        return(typeFound);
    }