public void EquipSelectedObject(EquipmentSlotInventory equipmentSlotInventory) { switch (equipmentSlotInventory.GetEquipmentType) { case (EquipmentType.Hull): ShipEquipmentHull hullEquipment = equipmentSlotInventory.GetPlacedEquipment as ShipEquipmentHull; if (hullEquipment == null) { Debug.LogWarning("Pas une coque : impossible d'équiper"); break; } compositionInterface.HullSlot.SetPlacedEquipment(equipmentSlotInventory, true); GameManager.gameManager.PlrInterface.SetLifeBar(hullEquipment.GetShipMaximumLife, Mathf.Clamp(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerCurrentArmorValue, 0, hullEquipment.GetShipMaximumArmor), hullEquipment.GetShipMaximumArmor); break; case (EquipmentType.Canon): compositionInterface.MainWeaponSlot.SetPlacedEquipment(equipmentSlotInventory, true); break; case (EquipmentType.Catapult): compositionInterface.SecondaryWeaponSlot.SetPlacedEquipment(equipmentSlotInventory, true); break; } }
public void UpdateArmorAmountAndLifeInterface() { ShipEquipmentHull hullEquip = EquipedEquipments.GetHullEquipment as ShipEquipmentHull; if (hullEquip != null) { relatedShip.LfManager.SetUpArmorAndLife(hullEquip.GetShipMaximumLife, Mathf.Clamp(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerCurrentArmorValue, 0, hullEquip.GetShipMaximumArmor), hullEquip.GetShipMaximumArmor); relatedShip.PlrInterface.SetLifeBar(hullEquip.GetShipMaximumLife, Mathf.Clamp(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerCurrentArmorValue, 0, hullEquip.GetShipMaximumArmor), hullEquip.GetShipMaximumArmor); PlayerEquipmentsDatas equipmentsData = PlayerDataSaver.LoadPlayerEquipmentsDatas(); equipmentsData.SetPlayerArmorAmount(relatedShip.LfManager.GetCurrentArmorAmount); equipmentsData.SetPlayerGoldAmount(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerGoldAmount); PlayerDataSaver.SavePlayerEquipmentsDatas(equipmentsData); } }
public void OpenInformationsPanel(EquipmentSlot slot, bool noInteractions) { currentEquipmentSlot = slot; currentEquipment = currentEquipmentSlot.GetPlacedEquipment; informationsInterface.OpenInformationPanel(currentEquipment.GetEquipmentInformations, currentEquipment.GetEquipmentType); if (noInteractions) { informationsInterface.CloseAllActions(); } else { switch (slot.GetEquipmentActionsType) { case (EquipmentInformationsOpeningType.EquipOrUpgrade): informationsInterface.OpenPlayerInventoryEquipmentActions(currentEquipment.Upgradable, currentEquipment.PriceToUpgrade, currentEquipment.GetSellingPrice); break; case (EquipmentInformationsOpeningType.Upgrade): informationsInterface.OpenPlayerEquippedEquipmentActions(currentEquipment.Upgradable, currentEquipment.PriceToUpgrade); break; case (EquipmentInformationsOpeningType.Buy): informationsInterface.OpenSellerEquipmentActions(currentEquipment.PriceToBuy); break; case (EquipmentInformationsOpeningType.Throw): informationsInterface.OpenThrowEquipmentActions(); break; } } if (currentEquipment.GetEquipmentType == EquipmentType.Hull) { ShipEquipmentHull hull = currentEquipment as ShipEquipmentHull; if (hull != null) { informationsInterface.OpenHullInformations(hull.GetShipMaximumLife, hull.GetShipMaximumArmor); } } else { EquipmentInformations infos = currentEquipment.GetEquipmentInformations; informationsInterface.OpenWeaponInformations(infos.GetWeaponType, infos.GetWeaponShotType, infos.GetWeaponEffect); } }
public void TryEquipEquipment(EquipmentSlot equipmentSlot) { ShipEquipment equipment = equipmentSlot.GetPlacedEquipment; mapManager.ShipCompoManager.EquipSelectedObject(equipmentSlot as EquipmentSlotInventory); mapManager.EquipmentsInfoManager.CloseInformationsPanel(); inventoryManager.UpdatePlayerEquipmentValue(); mapManager.SavePlayerDatas(); ShipEquipmentHull hull = equipment as ShipEquipmentHull; if (hull != null) { //docksInterface.UpdatePlayerHullLifeText(hull.GetShipMaximumLife); docksInterface.UpdatePlayerHullArmorText(Mathf.Clamp(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerCurrentArmorValue, 0, hull.GetShipMaximumArmor), hull.GetShipMaximumArmor); } }
public void SetUpPlayerInventoryAndSet() { PlayerEquipmentsDatas playerEquipmentsDatas = PlayerDataSaver.LoadPlayerEquipmentsDatas(); if (playerEquipmentsDatas != null) { IntersceneManager.intersceneManager.GetPlayerDatas.SetPlayerCurrentArmorValue(playerEquipmentsDatas.GetPlayerArmorAmount); IntersceneManager.intersceneManager.GetPlayerDatas.SetCurrentPlayerGoldAmount(playerEquipmentsDatas.GetPlayerGoldAmount); mapManager.ShipCompoManager.SetPlayerEquipmentsSet(playerEquipmentsDatas.GetPlayerEquipmentsSet); List <ShipEquipment> playerEquipmentsInventory = playerEquipmentsDatas.GetPlayerEquipmentsInventory; inventoryManager.SetPlayerEquipments(playerEquipmentsInventory); mapManager.UpdatePlayerEquipments(); docksInterface.UpdatePlayerGoldText(); ShipEquipmentHull hull = playerEquipmentsDatas.GetPlayerEquipmentsSet.GetHullEquipment as ShipEquipmentHull; if (hull != null) { //docksInterface.UpdatePlayerHullLifeText(hull.GetShipMaximumLife); docksInterface.UpdatePlayerHullArmorText(Mathf.Clamp(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerCurrentArmorValue, 0, hull.GetShipMaximumArmor), hull.GetShipMaximumArmor); } } }
/// <summary> /// Initialisation des équipements du joueur /// </summary> /// <param name="equipments">Equipements à équiper sur le joueurs</param> public void SetUpEquipments(EquipmentsSet equipments) { ClearInstantiatedObjects(); ShipEquipment hullEquipmentClone = null; if (equipments.GetHullEquipment != null) { ShipEquipmentHull hullEquip = equipments.GetHullEquipment as ShipEquipmentHull; if (hullEquip == null) { Debug.LogWarning("Pas une coque : impossible d'équiper"); } else { hullEquipmentClone = ScriptableObject.Instantiate(equipments.GetHullEquipment); List <EquipmentObject> hullEquipmentsObjects = hullEquipmentClone.InstantiateAllObjects(/*relatedShip.transform*/ equipmentObjectsParent, relatedShip); AddObjectsToInstantiatedObjects(hullEquipmentsObjects); relatedShip.PlrInterface.SetLifeBar(hullEquip.GetShipMaximumLife, Mathf.Clamp(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerCurrentArmorValue, 0, hullEquip.GetShipMaximumArmor), hullEquip.GetShipMaximumArmor); relatedShip.LfManager.SetUpArmorAndLife(hullEquip.GetShipMaximumLife, Mathf.Clamp(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerCurrentArmorValue, 0, hullEquip.GetShipMaximumArmor), hullEquip.GetShipMaximumArmor); if (hullEquip.GetHullPrefab != null) { relatedShip.ShipRenderManager.InstantiateHullRenderer(hullEquip.GetHullPrefab, (equipments.GetMainWeaponEquipment != null ? equipments.GetMainWeaponEquipment.GetEquipmentInformations.GetWeaponType : WeaponInformationType.MultiCanons)); } if (hullEquip.GetHullHitboxDimensions != Vector3.zero) { relatedShip.SetShipBoxColliderDimensions(hullEquip.GetHullHitboxDimensions); } } } ShipEquipment mainWeaponEquipmentClone = null; if (equipments.GetMainWeaponEquipment != null) { mainWeaponEquipmentClone = ScriptableObject.Instantiate(equipments.GetMainWeaponEquipment); List <EquipmentObject> mainWeaponEquipmentsObjects = mainWeaponEquipmentClone.InstantiateAllObjects(/*relatedShip.transform*/ equipmentObjectsParent, relatedShip); AddObjectsToInstantiatedObjects(mainWeaponEquipmentsObjects); } ShipEquipment secondaryWeaponEquipmentClone = null; if (equipments.GetSecondaryWeaponEquipment != null) { secondaryWeaponEquipmentClone = ScriptableObject.Instantiate(equipments.GetSecondaryWeaponEquipment); List <EquipmentObject> secondaryWeaponEquipmentsObjects = secondaryWeaponEquipmentClone.InstantiateAllObjects(/*relatedShip.transform*/ equipmentObjectsParent, relatedShip); AddObjectsToInstantiatedObjects(secondaryWeaponEquipmentsObjects); } #region Composition deck/compétences equipedEquipments = new EquipmentsSet(hullEquipmentClone, mainWeaponEquipmentClone, secondaryWeaponEquipmentClone); normalEquipParentRotation = equipmentObjectsParent.localRotation.eulerAngles; #endregion #region Hull ShipEquipmentHull hull = hullEquipmentClone as ShipEquipmentHull; if (hull != null) { relatedShip.ShipMvt.AffectMovementValues(hull.GetMovementParameters); } else { Debug.LogWarning("L'équipement affecté sur l'emplacement de la coque n'est pas de type 'Hull'"); } #endregion }