Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        if (displayManager == null)
        {
            displayManager = ObjectManager.Instance.weaponDisplayManager;
        }

        primaryWeaponIndex = Globals.Instance.equippedPrimaryWeapon;
        secondaryWeaponIndex = Globals.Instance.equippedSecondaryWeapon;

        DebugLogger.Log("WeaponController::Start()");

        weaponSlots = new Dictionary<WeaponLocation, WeaponSlot>();

        WeaponSlot slot = new WeaponSlot();

        slot.weaponLocation = WeaponLocation.Primary;
        slot.displayManager = displayManager;
        slot.weaponAnimator = primaryWeaponAnimator;
        slot.equippedWeaponIndex = primaryWeaponIndex;
        slot.cycledWeaponIndex = primaryWeaponIndex;
        slot.weaponSelectionDelay = weaponSelectionDelay;
        slot.weaponList = primaryWeapons;
        slot.equipSound = equipSound;
        slot.unequipSound = unequipSound;
        slot.weaponCycleSound = weaponCycleSound;
        slot.weaponSelectSound = weaponSelectSound;

        slot.Initialize();

        weaponSlots.Add(WeaponLocation.Primary, slot);

        slot = new WeaponSlot();

        slot.weaponLocation = WeaponLocation.Secondary;
        slot.displayManager = displayManager;
        slot.weaponAnimator = secondaryWeaponAnimator;
        slot.equippedWeaponIndex = secondaryWeaponIndex;
        slot.cycledWeaponIndex = secondaryWeaponIndex;
        slot.weaponSelectionDelay = weaponSelectionDelay;
        slot.weaponList = secondaryWeapons;
        slot.equipSound = equipSound;
        slot.unequipSound = unequipSound;
        slot.weaponCycleSound = weaponCycleSound;
        slot.weaponSelectSound = weaponSelectSound;

        slot.Initialize();

        weaponSlots.Add(WeaponLocation.Secondary, slot);

        slot = new WeaponSlot();

        slot.weaponLocation = WeaponLocation.Utility;
        slot.displayManager = displayManager;
        slot.weaponAnimator = null;
        slot.equippedWeaponIndex = utilityWeaponIndex;
        slot.cycledWeaponIndex = utilityWeaponIndex;
        slot.weaponSelectionDelay = weaponSelectionDelay;
        slot.weaponList = utilityWeapons;
        slot.equipSound = equipSound;
        slot.unequipSound = unequipSound;
        slot.weaponCycleSound = weaponCycleSound;
        slot.weaponSelectSound = weaponSelectSound;

        slot.Initialize();

        weaponSlots.Add(WeaponLocation.Utility, slot);

        //EquipCurrentWeapon(WeaponLocation.Primary);
        //EquipCurrentWeapon(WeaponLocation.Secondary);
        //EquipCurrentWeapon(WeaponLocation.Utility);
    }