Ejemplo n.º 1
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 targetMecha.OnLifeChange);
                PowerSlider = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.HUDSlider].AllocateGameObject <HUDSlider>(SliderContainer);
                PowerSlider.Initialize(2, PowerSliderColor, out targetMecha.OnPowerChange);

                MechaNameText.text = mecha.MechaInfo.MechaName;

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

                targetMecha.RefreshHUDPanelCoreLifeSliderCount = RefreshCoreLifeSliders;
                targetMecha.RefreshHUDPanelCoreLifeSliderCount();
            }
        }
    }
Ejemplo n.º 2
0
    public void StartGame()
    {
        PlayerMecha?.PoolRecycle();
        PlayerMecha = null;
        foreach (Mecha em in EnemyMechas)
        {
            em.PoolRecycle();
        }

        EnemyMechas.Clear();

        PlayerMecha = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.Mecha].AllocateGameObject <Mecha>(MechaContainer);
        PlayerMecha.Initialize(new MechaInfo("Solar 0", MechaType.Self, new List <MechaComponentInfo>
        {
            new MechaComponentInfo(MechaComponentType.Core, new GridPos(0, 0, GridPos.Orientation.Up), 300, 0),
        }));

        GameManager.Instance.MainCameraFollow.SetTarget(PlayerMecha.transform);
        GameManager.Instance.SetState(GameState.Fighting);

        HUDPanel.Initialize();
        PlayerMecha.RefreshHUDPanelCoreLifeSliderCount();
    }