Beispiel #1
0
        public void OnDie()
        {
            GhostTime = 0.01f;//开始死亡
            BattleManager.Instance.MemMap.GetMouseCell(Position.X, Position.Y).UpdateOwner(-Id);
            if (Avatar.MonsterConfig.Type == (int)CardTypeSub.Hero)
            {
                if (!IsLeft)
                {
                    if (Rival is HumanPlayer)
                    {
                        UserProfile.Profile.OnKillMonster(Avatar.MonsterConfig.Star, Avatar.MonsterConfig.Type, Avatar.MonsterConfig.Type);
                    }
                }
                OwnerPlayer.IsAlive = false;
            }
            else
            {
                if (!IsLeft)
                {
                    if (Rival is HumanPlayer)
                    {
                        if (BattleManager.Instance.StatisticData.Items.Count < GameConstants.MaxDropItemGetOnBattle)
                        {
                            int itemId = CardPieceBook.CheckPieceDrop(Avatar.Id, peakDamagerLuk);
                            if (itemId > 0)
                            {
                                BattleManager.Instance.StatisticData.AddItemGet(itemId);
                                BattleManager.Instance.FlowWordQueue.Add(new FlowItemInfo(itemId, Position, 20, 50), true);
                            }
                            UserProfile.Profile.OnKillMonster(Avatar.MonsterConfig.Star, Avatar.MonsterConfig.Type, Avatar.MonsterConfig.Type);
                        }
                    }
                }
                BattleManager.Instance.StatisticData.GetPlayer(!IsLeft).Kill++;
            }

            SkillManager.CheckRemoveEffect();
            var rival = Rival as Player;

            rival.OnKillMonster(Avatar.Id, Level, Avatar.MonsterConfig.Star, Position);

            MakeSound(false);
        }