Пример #1
0
        public void Clean()
        {
            if (targetMecha)
            {
                if (targetMecha.MechaInfo != null)
                {
                    targetMecha.MechaInfo.RefreshHUDPanelCoreLifeSliderCount = null;
                    targetMecha.MechaInfo.OnLifeChange = null;
                    //targetMecha.MechaInfo.OnInputPowerChange = null;
                }

                targetMecha = null;
            }

            foreach (HUDSlider coreHudSlider in Core_HUDSliders)
            {
                coreHudSlider.PoolRecycle();
            }

            Core_HUDSliders.Clear();
            LifeSlider?.PoolRecycle();
            PowerSlider?.PoolRecycle();
            MechaNameText.text = "";
            SliderContainer.gameObject.SetActive(false);
        }
Пример #2
0
        public void Initialize(Mecha mecha)
        {
            if (mecha == null)
            {
                Clean();
            }
            else
            {
                if (targetMecha != mecha)
                {
                    Clean();
                    SliderContainer.gameObject.SetActive(true);
                    targetMecha = mecha;
                    LifeSlider  = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.HUDSlider].AllocateGameObject <HUDSlider>(SliderContainer);
                    LifeSlider.Initialize(2, LifeSliderColor, out mecha.MechaInfo.OnLifeChange);
                    //PowerSlider = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.HUDSlider].AllocateGameObject<HUDSlider>(SliderContainer);
                    //PowerSlider.Initialize(2, PowerSliderColor, out mecha.MechaInfo.OnInputPowerChange);

                    MechaNameText.text = mecha.MechaInfo.MechaName;

                    LifeSlider.SetValue(mecha.MechaInfo.M_LeftLife, mecha.MechaInfo.M_TotalLife);
                    //PowerSlider.SetValue(mecha.MechaInfo.M_LeftPower, mecha.MechaInfo.M_TotalPower);

                    targetMecha.MechaInfo.RefreshHUDPanelCoreLifeSliderCount = RefreshCoreLifeSliders;
                    targetMecha.MechaInfo.RefreshHUDPanelCoreLifeSliderCount();
                }
            }
        }
Пример #3
0
        public void Clear()
        {
            foreach (KeyValuePair <uint, Mecha> kv in MechaDict)
            {
                kv.Value.PoolRecycle();
            }

            MechaDict.Clear();
            PlayerMecha = null;
        }
 public override void PoolRecycle()
 {
     UnregisterAbilityEvents();
     MechaComponentGridRoot.SetIsolatedIndicatorShown(true);
     MechaComponentGridRoot.SetInBattle(false);
     MechaComponentModelRoot.ResetColor();
     MechaComponentInfo?.Reset();
     MechaComponentInfo = null;
     Mecha = null;
     isReturningToBackpack     = false;
     OnRemoveMechaComponentSuc = null;
     base.PoolRecycle();
 }
        private void Initialize(MechaComponentInfo mechaComponentInfo, Mecha parentMecha)
        {
            SetLayer(LayerManager.Instance.GetLayerByMechaCamp(mechaComponentInfo.MechaInfo.MechaCamp));
            mechaComponentInfo.OnRemoveMechaComponentInfoSuc += (mci) =>
            {
                OnRemoveMechaComponentSuc?.Invoke(this);
                PoolRecycle();
            };

            mechaComponentInfo.OnHighLightColorChange += HighLightColorChange;
            HighLightColorChange(QualityManager.GetQuality(mechaComponentInfo.Quality).Color, mechaComponentInfo.CurrentPowerUpgradeData.HighLightColorIntensity);

            {
                mechaComponentInfo.InventoryItem.OnSetGridPosHandler = (gridPos_World) =>
                {
                    GridPosR.ApplyGridPosToLocalTrans(gridPos_World, transform, ConfigManager.GridSize);
                    MechaInfo.MechaEditorInventory.RefreshConflictAndIsolation();
                };
                mechaComponentInfo.InventoryItem.OnIsolatedHandler = (shown) =>
                {
                    if (shown)
                    {
                        MechaComponentModelRoot.SetBuildingBasicEmissionColor(CommonUtils.HTMLColorToColor("#E42835"));
                    }
                    else
                    {
                        MechaComponentModelRoot.ResetBuildingBasicEmissionColor();
                    }

                    MechaComponentGridRoot.SetIsolatedIndicatorShown(shown);
                };
                mechaComponentInfo.InventoryItem.OnConflictedHandler    = MechaComponentGridRoot.SetGridConflicted;
                mechaComponentInfo.InventoryItem.OnResetConflictHandler = MechaComponentGridRoot.ResetAllGridConflict;
            }

            MechaComponentInfo = mechaComponentInfo;
            GridPos.ApplyGridPosToLocalTransXZ(MechaComponentInfo.InventoryItem.GridPos_World, transform, ConfigManager.GridSize);
            Mecha = parentMecha;
            MechaComponentGridRoot.SetInBattle(true);

            Initialize_Fighting();
        }
 private void OnTriggerExit(Collider c)
 {
     StayingMecha = null;
 }
 private void OnTriggerEnter(Collider c)
 {
     StayingMecha = c.GetComponentInParent <Mecha>();
 }
        public static MechaComponent BaseInitialize(MechaComponentInfo mechaComponentInfo, Mecha parentMecha)
        {
            MechaComponent mc = GameObjectPoolManager.Instance.MechaComponentPoolDict[mechaComponentInfo.MechaComponentConfig.MechaComponentKey]
                                .AllocateGameObject <MechaComponent>(parentMecha ? parentMecha.transform : null);

            mc.Initialize(mechaComponentInfo, parentMecha);
            return(mc);
        }
Пример #9
0
 public void LoadEnemyMech(Mecha enemyMecha)
 {
     EnemyMechaInfoHUD.Initialize(enemyMecha);
 }