Ejemplo n.º 1
0
    // 情节结束
    private void StoryEnd()
    {
        BaseScene scene = SceneManager.Instance.GetCurScene();

        if (scene != null)
        {
            scene.AddAllActionFlag();
        }

//         BattleUnit unit = PlayerController.Instance.GetControlObj() as BattleUnit;
//         if (unit != null)
//         {
//             unit.SetLeague(LeagueDef.Red);
//         }
        mCurRes    = null;
        mIsRunning = false;
        EventSystem.Instance.PushEvent(new StoryEvent(StoryEvent.STORY_END, mOriginalId));

        mOriginalId = -1;
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 设置定身效果
    /// </summary>
    /// <param name="isFreeze"> true为定身,false为解除定身</param>
    public void SetFreeze(bool isFreeze)
    {
        BaseScene scene  = SceneManager.Instance.GetCurScene();
        Player    player = PlayerController.Instance.GetControlObj() as Player;

        if (player == null)
        {
            return;
        }
        if (player != null)
        {
            player.SetLeague(LeagueDef.Neutral);
        }

        if (isFreeze)
        {
            scene.RemoveAllActionFlag();
            player.SetLeague(LeagueDef.Neutral);
        }
        else
        {
            scene.AddAllActionFlag();
            player.SetLeague(LeagueDef.Red);
            if (player.IsDead())
            {
                player.Relive((int)player.GetMaxHP(), (int)player.GetMaxMana());
            }
            else
            {
                player.ModifyPropertyValue((int)PropertyTypeEnum.PropertyTypeHP, (int)(player.GetMaxHP()));
                player.ModifyPropertyValue((int)(int)PropertyTypeEnum.PropertyTypeMana, (int)(player.GetMaxMana()));
            }
            //重置子弹数
            player.AddWeaponBullet(player.GetWeaponMaxBullet());
            player.ResetAllSKillCd();
        }

        Crops maincrops = GetMainCropsControlObj() as Crops;
        Crops subcrops  = GetSubCropsControlObj() as Crops;

        if (null != maincrops)
        {
            if (maincrops.IsDead())
            {
                maincrops.Relive((int)maincrops.GetMaxHP(), (int)maincrops.GetMaxMana());
            }
            else
            {
                maincrops.ModifyPropertyValue((int)PropertyTypeEnum.PropertyTypeHP, (int)(maincrops.GetMaxHP()));
                maincrops.ModifyPropertyValue((int)(int)PropertyTypeEnum.PropertyTypeMana, (int)(maincrops.GetMaxMana()));
            }
        }

        if (null != subcrops)
        {
            if (subcrops.IsDead())
            {
                subcrops.Relive((int)subcrops.GetMaxHP(), (int)subcrops.GetMaxMana());
            }
            else
            {
                subcrops.ModifyPropertyValue((int)PropertyTypeEnum.PropertyTypeHP, (int)(subcrops.GetMaxHP()));
                subcrops.ModifyPropertyValue((int)(int)PropertyTypeEnum.PropertyTypeMana, (int)(subcrops.GetMaxMana()));
            }
        }

        if (null != maincrops || null != subcrops)
        {
            (scene as GameScene).ResetCropsReliveTimes();
            EventSystem.Instance.PushEvent(new CropsEvent(CropsEvent.CROPS_RELIVE_NO_TIME_DOWN));
        }
    }